mirror of
https://github.com/privacore/open-source-search-engine.git
synced 2025-07-15 02:36:08 -04:00
Avoid two indexDoc jobs being submitted for an XmlDoc instance
Caussed coredump when the second job tried to access a indexed+deleted instance. Still not great. The exact route of the call is via the two or three callback or callback-llops in XmlDoc.
This commit is contained in:
10
XmlDoc.cpp
10
XmlDoc.cpp
@ -91,6 +91,7 @@ XmlDoc::XmlDoc() {
|
||||
void *pend = &m_VALIDEND;
|
||||
memset ( p , 0 , (char *)pend - (char *)p );//(int32_t)pend-(int32_t)p
|
||||
m_msg22Request.m_inUse = 0;
|
||||
m_indexDocJobOutstanding = false;
|
||||
m_indexedDoc = false;
|
||||
m_msg4Waiting = false;
|
||||
m_msg4Launched = false;
|
||||
@ -149,6 +150,7 @@ void XmlDoc::reset ( ) {
|
||||
|
||||
m_loaded = false;
|
||||
|
||||
m_indexDocJobOutstanding = false;
|
||||
m_indexedDoc = false;
|
||||
m_msg4Launched = false;
|
||||
|
||||
@ -1233,6 +1235,7 @@ void XmlDoc::setCallback ( void *state, bool (*callback) (void *state) ) {
|
||||
static void indexDoc3(void *state) {
|
||||
XmlDoc *that = reinterpret_cast<XmlDoc*>(state);
|
||||
logTrace( g_conf.m_logTraceXmlDoc, "Calling XmlDoc::indexDoc" );
|
||||
that->m_indexDocJobOutstanding = false;
|
||||
// return if it blocked
|
||||
if (!that->indexDoc()) {
|
||||
logTrace(g_conf.m_logTraceXmlDoc, "END, indexDoc blocked");
|
||||
@ -1261,6 +1264,12 @@ static void indexDocWrapper ( void *state ) {
|
||||
XmlDoc *THIS = (XmlDoc *)state;
|
||||
// make sure has not been freed from under us!
|
||||
if ( THIS->m_freed ) { g_process.shutdownAbort(true);}
|
||||
|
||||
if(THIS->m_indexDocJobOutstanding) {
|
||||
log(LOG_DEBUG,"xmldoc: index-doc job already submitted");
|
||||
return;
|
||||
}
|
||||
THIS->m_indexDocJobOutstanding = true;
|
||||
// note it
|
||||
THIS->setStatus ( "in index doc wrapper" );
|
||||
|
||||
@ -1270,6 +1279,7 @@ static void indexDocWrapper ( void *state ) {
|
||||
logTrace( g_conf.m_logTraceXmlDoc, "END, queued for thread" );
|
||||
return;
|
||||
}
|
||||
THIS->m_indexDocJobOutstanding = false;
|
||||
//threads not available (or oom or simmilar)
|
||||
indexDoc3(THIS);
|
||||
indexedDoc3(THIS, job_exit_normal);
|
||||
|
3
XmlDoc.h
3
XmlDoc.h
@ -1116,7 +1116,8 @@ public:
|
||||
|
||||
bool m_freed;
|
||||
|
||||
bool m_indexedDoc; //indexDoc() perfomrned completely
|
||||
bool m_indexDocJobOutstanding; //indexDoc job submitted
|
||||
bool m_indexedDoc; //indexDoc() performed completely
|
||||
|
||||
bool m_msg4Waiting;
|
||||
bool m_msg4Launched;
|
||||
|
Reference in New Issue
Block a user