WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
ASSIGNED
131078
some Web worker threads never terminate
https://bugs.webkit.org/show_bug.cgi?id=131078
Summary
some Web worker threads never terminate
abaldeva
Reported
2014-04-01 16:27:17 PDT
Hi, If a web worker is executing a javascript in a while(true){..} loop, the OS Worker thread created for it never terminates. An example can be seen here -
http://www.whatwg.org/demos/workers/primes/page.html
The watchdog mechanism starts out as disabled. This means that timeout JIT::emit_op_loop_hint in JITOpcodes.cpp never emits the timeout check mechanism. Thus, when the web worker is expected to terminate (either by explicitly calling worker.terminate() or moving away from the page), execution never comes out of script->evaluate in WorkerThread::workerThread(). This results in the OS thread hanging around. The C Loop interpreter backend has the same issue except that it ends up waiting on m_timerDidFire in watchdog which never turns true. --Arpit
Attachments
Add attachment
proposed patch, testcase, etc.
abaldeva
Comment 1
2014-04-01 16:41:04 PDT
One possible solution to this problem might be to start VM watchdog timer with a small timeout value (1-2 sec? )and a callback (using Watchdog::setTimeLimit API). This will force the script execution to check the WorkerScriptController regularly. The callback keeps returning false unless the WorkerScriptController::scheduleExecutionTermination has been called. --Arpit
Mark Lam
Comment 2
2015-07-29 19:04:27 PDT
I’ve confirmed that m_didFire is indeed not reset. Let me think about what the right thing to do is, and implement a fix.
Mark Lam
Comment 3
2015-07-29 19:24:26 PDT
(In reply to
comment #2
)
> I’ve confirmed that m_didFire is indeed not reset. Let me think about what > the right thing to do is, and implement a fix.
Oops. Commented in wrong bug. Please disregard.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug