Assertion: ASSERT(m_mainThreadLoader || m_loadingFinished) is hit in Source/WebCore/loader/WorkerThreadableLoader.cpp.
It seems that returned loader is null in all cases when CachedResource::load fails early.
This now hits
ASSERTION FAILED: !m_isolatedWorld->isNormal() || m_wrapper || !m_jsFunction
I can reproduce quite easily when running in a loop. I'll attach a patch that reduces the test case somewhat.
(In reply to Ms2ger from comment #7)
> I don't know that it's a bug in fetch code, particularly. It's the onmessage
> handler for the Worker that disappears.
Looking at the code, JSWorker is not collectable when loading the script.
After that point, it is again collectable.
I guess we could extend the fact that it is not collectable until being terminated.
Or if it has an on message event handler.
Created attachment 330379[details]
Archive of layout-test-results from ews123 for ios-simulator-wk2
The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews123 Port: ios-simulator-wk2 Platform: Mac OS X 10.12.6
Created attachment 330399[details]
Archive of layout-test-results from ews105 for mac-elcapitan-wk2
The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews105 Port: mac-elcapitan-wk2 Platform: Mac OS X 10.11.6
Created attachment 330402[details]
Archive of layout-test-results from ews101 for mac-elcapitan
The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews101 Port: mac-elcapitan Platform: Mac OS X 10.11.6
Created attachment 330406[details]
Archive of layout-test-results from ews103 for mac-elcapitan
The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews103 Port: mac-elcapitan Platform: Mac OS X 10.11.6
Created attachment 330410[details]
Archive of layout-test-results from ews115 for mac-elcapitan
The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews115 Port: mac-elcapitan Platform: Mac OS X 10.11.6
Created attachment 330412[details]
Archive of layout-test-results from ews104 for mac-elcapitan-wk2
The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews104 Port: mac-elcapitan-wk2 Platform: Mac OS X 10.11.6
Created attachment 340188[details]
Archive of layout-test-results from ews204 for win-future
The attached test failures were seen while running run-webkit-tests on the win-ews.
Bot: ews204 Port: win-future Platform: CYGWIN_NT-6.1-2.9.0-0.318-5-3-x86_64-64bit
If onmessage is set, we cannot let the worker be collected since we do not know if a message will have to be dispatched in the future.
A web page can always stop the worker or unset onmessage.
The fact that it's possible for a page to do something explicit to avoid performance problems is not enough for us. What if it doesn't?
Worker lifetime is directly addressed in the spec, <https://w3c.github.io/workers/#worker-lifetime>. Having an onmessage handler on Worker is not the end of the story.
Created attachment 340701[details]
Archive of layout-test-results from ews107 for mac-sierra-wk2
The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews107 Port: mac-sierra-wk2 Platform: Mac OS X 10.12.6
Comment on attachment 340699[details]
Patch
View in context: https://bugs.webkit.org/attachment.cgi?id=340699&action=review> Source/WebCore/workers/DedicatedWorkerGlobalScope.cpp:87
> + thread().runLoop().postTaskForMode([](auto& context) {
Can some assertions or comments be added to clarify why m_importScriptCount isn't being accessed from multiple threads concurrently? I'm assuming that's true, but I don't know how to confirm that.
Other that that, leaving for someone else to review.
(In reply to Alexey Proskuryakov from comment #38)
> Comment on attachment 340699[details]
> Patch
>
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=340699&action=review
>
> > Source/WebCore/workers/DedicatedWorkerGlobalScope.cpp:87
> > + thread().runLoop().postTaskForMode([](auto& context) {
>
> Can some assertions or comments be added to clarify why m_importScriptCount
> isn't being accessed from multiple threads concurrently? I'm assuming that's
> true, but I don't know how to confirm that.
Added a comment.
importScripts is called in the worker thread and the lambda as well so m_importScriptCount is only accessed from the worker thread.
Created attachment 344676[details]
Archive of layout-test-results from ews205 for win-future
The attached test failures were seen while running run-webkit-tests on the win-ews.
Bot: ews205 Port: win-future Platform: CYGWIN_NT-6.1-2.9.0-0.318-5-3-x86_64-64bit
Comment on attachment 344632[details]
Patch
View in context: https://bugs.webkit.org/attachment.cgi?id=344632&action=review> Source/WebCore/ChangeLog:10
> + Decrement the counter after an even loop iteration to handle the case of importScripts being called one after the other.
s/even/event/
> Source/WebCore/workers/DedicatedWorkerGlobalScope.cpp:-83
> - thread().workerObjectProxy().reportPendingActivity(hasPendingActivity());
So hasPendingActivity() has to do with ActiveDOMObjects, not loads. Could you explain to me why moving the call to thread().workerObjectProxy().reportPendingActivity(hasPendingActivity()); before the call to Base::importScripts(urls) work?
> Source/WebCore/workers/DedicatedWorkerGlobalScope.cpp:87
> + // We decrement m_importScriptCount asycnhronously in case another importScripts is made synchronously. m_importScriptCount is modified only in Worker thread.
Typo: asycnhronously
> Source/WebCore/workers/DedicatedWorkerGlobalScope.h:73
> + static bool isType(const WebCore::ScriptExecutionContext& context)
We should add an overload that takes a WorkerGlobalScope& in parameter. Then the overload that takes a ScriptExecutionContext& could do the is<WebCore::WorkerGlobalScope>(context) and call this new one.
Comment on attachment 344632[details]
Patch
This has been requesting review for more than one year. If this is still needed, please rebase and re-request review.
2017-12-16 01:36 PST, Ms2ger (he/him; ⌚ UTC+1/+2)
2018-01-03 05:30 PST, youenn fablet
2018-01-03 07:02 PST, EWS Watchlist
2018-01-03 10:18 PST, EWS Watchlist
2018-01-03 10:34 PST, EWS Watchlist
2018-01-03 10:59 PST, youenn fablet
2018-01-03 11:57 PST, EWS Watchlist
2018-01-03 12:39 PST, EWS Watchlist
2018-01-03 13:09 PST, EWS Watchlist
2018-05-11 02:39 PDT, youenn fablet
2018-05-11 04:49 PDT, EWS Watchlist
2018-05-18 08:34 PDT, youenn fablet
2018-05-18 09:49 PDT, EWS Watchlist
2018-07-09 15:52 PDT, youenn fablet
2018-07-10 00:26 PDT, EWS Watchlist