Skip to content

Instantly share code, notes, and snippets.

@jzawodn
Created April 16, 2012 22:26
Show Gist options
  • Save jzawodn/2402061 to your computer and use it in GitHub Desktop.
Save jzawodn/2402061 to your computer and use it in GitHub Desktop.
remove sphinx shutdown race condition
--- searchd.cpp.orig 2012-04-16 15:23:46.000000000 -0700
+++ searchd.cpp 2012-04-16 15:24:45.000000000 -0700
@@ -1398,6 +1398,13 @@
ARRAY_FOREACH ( i, g_dListeners )
if ( g_dListeners[i].m_iSock>=0 )
sphSockClose ( g_dListeners[i].m_iSock );
+
+ // remove pid
+ if ( g_bHeadDaemon && g_sPidFile )
+ {
+ ::close ( g_iPidFD );
+ ::unlink ( g_sPidFile );
+ }
#if USE_WINDOWS
CloseHandle ( g_hPipe );
@@ -1411,13 +1418,6 @@
}
#endif
- // remove pid
- if ( g_bHeadDaemon && g_sPidFile )
- {
- ::close ( g_iPidFD );
- ::unlink ( g_sPidFile );
- }
-
if ( g_bHeadDaemon )
sphInfo ( "shutdown complete" );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment