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:
@@ -1468,6 +1468,7 @@ void hphp_session_exit() {
|
||||
}
|
||||
|
||||
void hphp_process_exit() {
|
||||
PageletServer::Stop();
|
||||
XboxServer::Stop();
|
||||
Eval::Debugger::Stop();
|
||||
Extension::ShutdownModules();
|
||||
|
||||
@@ -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 */,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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>
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário