Bug 177972

Summary: [WK2][iOS] Audio may keep playing for 10 seconds after closing a tab
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: WebKit2Assignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, ap, beidson, commit-queue, ggaren, sam, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=49090
Bug Depends on: 188241    
Bug Blocks:    
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Chris Dumez
Reported 2017-10-05 15:12:59 PDT
More aggressively terminate child processes when the connection to their parent process is severed. Previously, we would dispatch to the main thread and then exit the process. This would sometimes cause the process to say alive for 10 seconds until our watchdog would forcefully terminate the process. This could happen in particular when the main thread is blocked on a synchronous IPC.
Attachments
Patch (9.64 KB, patch)
2017-10-05 15:16 PDT, Chris Dumez
no flags
Patch (10.27 KB, patch)
2018-05-03 16:47 PDT, Chris Dumez
no flags
Patch (9.95 KB, patch)
2018-05-03 19:24 PDT, Chris Dumez
no flags
Note You need to log in before you can comment on or make changes to this bug.
Chris Dumez
Comment 1 2017-10-05 15:13:53 PDT
Chris Dumez
Comment 2 2017-10-05 15:16:22 PDT
Alexey Proskuryakov
Comment 3 2017-10-09 12:56:56 PDT
Comment on attachment 322923 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=322923&action=review > Source/WebKit/ChangeLog:12 > + process. This could happen in particular when the main thread is blocked on a synchronous IPC. Is it possible to fix this in sync IPC case? Exiting the process from a background thread increases the likelihood of permanently corrupting data that was being written out at the moment. I don't think that we have a good story for that either way, but making it more likely to happen seems like the wrong direction to go in.
Chris Dumez
Comment 4 2017-10-09 13:01:07 PDT
Comment on attachment 322923 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=322923&action=review >> Source/WebKit/ChangeLog:12 >> + process. This could happen in particular when the main thread is blocked on a synchronous IPC. > > Is it possible to fix this in sync IPC case? > > Exiting the process from a background thread increases the likelihood of permanently corrupting data that was being written out at the moment. I don't think that we have a good story for that either way, but making it more likely to happen seems like the wrong direction to go in. > Is it possible to fix this in sync IPC case? I do not understand the question, the cases I experienced were cookie-related IPC messages (because the corresponding DOM API is synchronous). Getting rid of those synchronous IPCs is not trivial. When I discussed this with Sam, he indicated that the WebProcess should be robust to being terminated at any point and that we used to terminate it more aggressively. Maybe I should restrict the more aggressive killing to the WebProcess and not all child processes?
Alexey Proskuryakov
Comment 5 2017-10-09 13:35:18 PDT
I was thinking of sync IPC towards UI process, which would be possible to interrupt if they were blocking (it's quite likely that they are already interrupted as necessary). Cookies are of course Networking process. > WebProcess should be robust to being terminated at any point I should, I don't know if it is, or even if there is any way to make it so. > we used to terminate it more aggressively Can you find out why we no longer do?
Alexey Proskuryakov
Comment 6 2017-10-09 13:35:37 PDT
*It* should
Geoffrey Garen
Comment 7 2017-12-01 14:43:38 PST
> > we used to terminate it more aggressively > > Can you find out why we no longer do? I wasn't able to find a full record of terminating more aggressively or not, but I did find a motivation for not doing so: <https://trac.webkit.org/changeset/57549/webkit>. The concern was that exit-style termination publishes "LEAK: " reports due to WebCore objects not being deallocated before exit. Even so, I think the test case in Radar and the FIXMEs deleted in this patch demonstrate the need to forcefully exit child processes without waiting for main thread execution. So, I think we should resurrect this patch.
Geoffrey Garen
Comment 8 2018-05-03 14:10:53 PDT
Comment on attachment 322923 [details] Patch r=me
WebKit Commit Bot
Comment 9 2018-05-03 14:13:11 PDT
Comment on attachment 322923 [details] Patch Rejecting attachment 322923 [details] from commit-queue. Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.webkit.org', '--bot-id=webkit-cq-01', 'apply-attachment', '--no-update', '--non-interactive', 322923, '--port=mac']" exit_code: 2 cwd: /Volumes/Data/EWS/WebKit Last 500 characters of output: -- saving rejects to file Source/WebKit/StorageProcess/StorageProcess.h.rej patching file Source/WebKit/WebProcess/WebProcess.cpp Hunk #1 FAILED at 662. 1 out of 1 hunk FAILED -- saving rejects to file Source/WebKit/WebProcess/WebProcess.cpp.rej patching file Source/WebKit/WebProcess/WebProcess.h Hunk #1 succeeded at 365 (offset 24 lines). Failed to run "[u'/Volumes/Data/EWS/WebKit/Tools/Scripts/svn-apply', '--force', '--reviewer', u'Geoffrey Garen']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit Full output: http://webkit-queues.webkit.org/results/7555571
Chris Dumez
Comment 10 2018-05-03 16:47:46 PDT
Chris Dumez
Comment 11 2018-05-03 19:24:35 PDT
WebKit Commit Bot
Comment 12 2018-05-03 23:03:48 PDT
Comment on attachment 339506 [details] Patch Clearing flags on attachment: 339506 Committed r231348: <https://trac.webkit.org/changeset/231348>
WebKit Commit Bot
Comment 13 2018-05-03 23:03:50 PDT
All reviewed patches have been landed. Closing bug.