Shut down pagelet server before exiting

There was nothing stopping a pagelet thread from continuing
to run after the server was shut down. If it continued to run after
main exited, it could access data structures (such as the global maps
used by Apc and FileRepository) that had been torn down, and crash.
Esse commit está contido em:
mwilliams
2013-06-21 12:14:43 -07:00
commit de Sara Golemon
commit 9cecd8956a
4 arquivos alterados com 12 adições e 10 exclusões
+1
Ver Arquivo
@@ -1468,6 +1468,7 @@ void hphp_session_exit() {
}
void hphp_process_exit() {
PageletServer::Stop();
XboxServer::Stop();
Eval::Debugger::Stop();
Extension::ShutdownModules();
+9 -5
Ver Arquivo
@@ -288,11 +288,7 @@ bool PageletServer::Enabled() {
}
void PageletServer::Restart() {
if (s_dispatcher) {
s_dispatcher->stop();
delete s_dispatcher;
s_dispatcher = nullptr;
}
Stop();
if (RuntimeOption::PageletServerThreadCount > 0) {
s_dispatcher = new JobQueueDispatcher<PageletTransport*, PageletWorker>
(RuntimeOption::PageletServerThreadCount,
@@ -305,6 +301,14 @@ void PageletServer::Restart() {
}
}
void PageletServer::Stop() {
if (s_dispatcher) {
s_dispatcher->stop();
delete s_dispatcher;
s_dispatcher = nullptr;
}
}
Object PageletServer::TaskStart(CStrRef url, CArrRef headers,
CStrRef remote_host,
CStrRef post_data /* = null_string */,
+1
Ver Arquivo
@@ -26,6 +26,7 @@ class PageletServer {
public:
static bool Enabled();
static void Restart();
static void Stop();
/**
* Create a task. This returns a task handle, or null object
+1 -5
Ver Arquivo
@@ -204,11 +204,7 @@ private:
static JobQueueDispatcher<XboxTransport*, XboxWorker> *s_dispatcher;
void XboxServer::Restart() {
if (s_dispatcher) {
s_dispatcher->stop();
delete s_dispatcher;
s_dispatcher = nullptr;
}
Stop();
if (RuntimeOption::XboxServerThreadCount > 0) {
s_dispatcher = new JobQueueDispatcher<XboxTransport*, XboxWorker>