Skip to content

Commit

Permalink
fixed #129 crash of daemon on shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
tomatolog committed Oct 26, 2017
1 parent 7fd3d25 commit 0807240
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/searchd.cpp
Expand Up @@ -397,6 +397,7 @@ static CSphVector<SphThread_t> g_dTickPoolThread;
/// flush parameters of rt indexes /// flush parameters of rt indexes
static SphThread_t g_tRtFlushThread; static SphThread_t g_tRtFlushThread;
static SphThread_t g_tBinlogFlushThread; static SphThread_t g_tBinlogFlushThread;
static BinlogFlushInfo_t g_tBinlogAutoflush;


// optimize thread // optimize thread
static SphThread_t g_tOptimizeThread; static SphThread_t g_tOptimizeThread;
Expand Down Expand Up @@ -1497,7 +1498,8 @@ void Shutdown ()


// tell flush-rt thread to shutdown, and wait until it does // tell flush-rt thread to shutdown, and wait until it does
sphThreadJoin ( &g_tRtFlushThread ); sphThreadJoin ( &g_tRtFlushThread );
sphThreadJoin ( &g_tBinlogFlushThread ); if ( g_tBinlogAutoflush.m_fnWork )
sphThreadJoin ( &g_tBinlogFlushThread );


// tell rotation thread to shutdown, and wait until it does // tell rotation thread to shutdown, and wait until it does
if ( g_bSeamlessRotate ) if ( g_bSeamlessRotate )
Expand Down Expand Up @@ -9543,8 +9545,8 @@ struct SqlParser_c : ISphNoncopyable
#ifdef CMAKE_GENERATED_LEXER #ifdef CMAKE_GENERATED_LEXER


#ifdef __GNUC__ #ifdef __GNUC__
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-compare" #pragma GCC diagnostic ignored "-Wsign-compare"
#endif #endif


#include "flexsphinxql.c" #include "flexsphinxql.c"
Expand Down Expand Up @@ -18275,7 +18277,6 @@ static void RtFlushThreadFunc ( void * )
} }
} }


static BinlogFlushInfo_t g_tBinlogAutoflush;
static void RtBinlogAutoflushThreadFunc ( void * ) static void RtBinlogAutoflushThreadFunc ( void * )
{ {
assert ( g_tBinlogAutoflush.m_pLog && g_tBinlogAutoflush.m_fnWork ); assert ( g_tBinlogAutoflush.m_pLog && g_tBinlogAutoflush.m_fnWork );
Expand Down Expand Up @@ -23947,7 +23948,10 @@ int WINAPI ServiceMain ( int argc, char **argv )
::unlink ( sNewState.cstr() ); ::unlink ( sNewState.cstr() );


if ( !bCanWrite ) if ( !bCanWrite )
{
sphWarning ( "sphinxql_state flush disabled: %s", sError.cstr() ); sphWarning ( "sphinxql_state flush disabled: %s", sError.cstr() );
g_sSphinxqlState = ""; // need to disable thread join on shutdown
}
else if ( !sphThreadCreate ( &g_tSphinxqlStateFlushThread, SphinxqlStateThreadFunc, NULL ) ) else if ( !sphThreadCreate ( &g_tSphinxqlStateFlushThread, SphinxqlStateThreadFunc, NULL ) )
sphDie ( "failed to create sphinxql_state writer thread" ); sphDie ( "failed to create sphinxql_state writer thread" );
} }
Expand Down

0 comments on commit 0807240

Please sign in to comment.