Add option to extend the time we'll wait before dropping into the dummy sandbox on debugger signals
When the proxy's signal polling thread gets a signal from the debugger client, it would normally wait one second for another thread to recognize and consume the signal. This is pretty reasonable, but with a debug build on a heavily loaded system it's very rarely possible for one second to not be long enough. Added a runtime option to extend this, and set it to 3s for the existing debugger server tests.
Esse commit está contido em:
@@ -451,6 +451,7 @@ std::string RuntimeOption::DebuggerRpcHostDomain;
|
||||
int RuntimeOption::DebuggerDefaultRpcTimeout = 30;
|
||||
std::string RuntimeOption::DebuggerDefaultSandboxPath;
|
||||
std::string RuntimeOption::DebuggerStartupDocument;
|
||||
int RuntimeOption::DebuggerSignalTimeout = 1;
|
||||
|
||||
std::string RuntimeOption::SendmailPath;
|
||||
std::string RuntimeOption::MailForceExtraParameters;
|
||||
@@ -1202,6 +1203,7 @@ void RuntimeOption::Load(Hdf &config, StringVec *overwrites /* = NULL */,
|
||||
DebuggerServerPort = debugger["Port"].getUInt16(8089);
|
||||
DebuggerDefaultSandboxPath = debugger["DefaultSandboxPath"].getString();
|
||||
DebuggerStartupDocument = debugger["StartupDocument"].getString();
|
||||
DebuggerSignalTimeout = debugger["SignalTimeout"].getInt32(1);
|
||||
|
||||
DebuggerDefaultRpcPort = debugger["RPC.DefaultPort"].getUInt16(8083);
|
||||
DebuggerDefaultRpcAuth = debugger["RPC.DefaultAuth"].getString();
|
||||
|
||||
@@ -508,6 +508,7 @@ public:
|
||||
static int DebuggerDefaultRpcTimeout;
|
||||
static std::string DebuggerDefaultSandboxPath;
|
||||
static std::string DebuggerStartupDocument;
|
||||
static int DebuggerSignalTimeout;
|
||||
|
||||
// Mail options
|
||||
static std::string SendmailPath;
|
||||
|
||||
@@ -306,14 +306,15 @@ void DebuggerProxy::startSignalThread() {
|
||||
// it will be passed to the dummy sandbox instead.
|
||||
void DebuggerProxy::pollSignal() {
|
||||
TRACE_RB(2, "DebuggerProxy::pollSignal: starting\n");
|
||||
int signalTimeout = RuntimeOption::DebuggerSignalTimeout;
|
||||
while (!m_stopped) {
|
||||
sleep(1);
|
||||
|
||||
// after 1 second that no active thread picks up the signal, we send it
|
||||
// to dummy sandbox
|
||||
if (m_signum != CmdSignal::SignalNone && m_dummySandbox) {
|
||||
// After DebuggerSignalTimeout seconds that no active thread picks
|
||||
// up the signal, we send it to dummy sandbox.
|
||||
if ((m_signum != CmdSignal::SignalNone) && m_dummySandbox) {
|
||||
Lock lock(m_signumMutex);
|
||||
if (m_signum != CmdSignal::SignalNone) {
|
||||
if ((m_signum != CmdSignal::SignalNone) && (--signalTimeout <= 0)) {
|
||||
TRACE_RB(2, "DebuggerProxy::pollSignal: sending to dummy sandbox\n");
|
||||
m_dummySandbox->notifySignal(m_signum);
|
||||
m_signum = CmdSignal::SignalNone;
|
||||
@@ -362,11 +363,13 @@ void DebuggerProxy::pollSignal() {
|
||||
break;
|
||||
}
|
||||
|
||||
m_signum = sig->getSignal();
|
||||
auto newSignum = sig->getSignal();
|
||||
|
||||
if (m_signum != CmdSignal::SignalNone) {
|
||||
if (newSignum != CmdSignal::SignalNone) {
|
||||
TRACE_RB(2, "DebuggerProxy::pollSignal: "
|
||||
"got interrupt signal from client\n");
|
||||
m_signum = newSignum;
|
||||
signalTimeout = RuntimeOption::DebuggerSignalTimeout;
|
||||
Debugger::RequestInterrupt(shared_from_this());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ Eval {
|
||||
EnableDebugger = true
|
||||
EnableDebuggerServer = true
|
||||
StartupDocument = hphpd_startup.php
|
||||
SignalTimeout = 3
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário