RESOLVED WONTFIX 211127
[iOS][WK2] Make sure the network process always resumes its database threads when coming out of suspension
https://bugs.webkit.org/show_bug.cgi?id=211127
Summary [iOS][WK2] Make sure the network process always resumes its database threads ...
Chris Dumez
Reported 2020-04-28 08:19:01 PDT
Make sure the network process always resumes its database threads when coming out of suspension, even if the main thread is hung.
Attachments
Patch (17.59 KB, patch)
2020-04-28 08:27 PDT, Chris Dumez
no flags
Patch (17.49 KB, patch)
2020-04-28 09:02 PDT, Chris Dumez
no flags
Chris Dumez
Comment 1 2020-04-28 08:19:15 PDT
Chris Dumez
Comment 2 2020-04-28 08:27:01 PDT
Chris Dumez
Comment 3 2020-04-28 09:02:55 PDT
Sihui Liu
Comment 4 2020-04-28 09:06:26 PDT
What are the cases where main thread is blocked by a suspended database thread? Doesn't main thread know database threads' state? Or we probably should not block main thread on a database thread at all?
Chris Dumez
Comment 5 2020-04-28 09:07:26 PDT
(In reply to Sihui Liu from comment #4) > What are the cases where main thread is blocked by a suspended database > thread? Doesn't main thread know database threads' state? > > Or we probably should not block main thread on a database thread at all? Well, we probably should not but it happens. See rdar://problem/62377357 for one example.
Chris Dumez
Comment 6 2020-04-28 09:10:16 PDT
(In reply to Chris Dumez from comment #5) > (In reply to Sihui Liu from comment #4) > > What are the cases where main thread is blocked by a suspended database > > thread? Doesn't main thread know database threads' state? > > > > Or we probably should not block main thread on a database thread at all? > > Well, we probably should not but it happens. See rdar://problem/62377357 for > one example. Alex fixed the case in rdar://problem/62377357 but it is not the first time we have radars about similar issues so I thought we should tweak the design to make sure it does not happen again.
Sihui Liu
Comment 7 2020-04-28 09:56:04 PDT
(In reply to Chris Dumez from comment #6) > (In reply to Chris Dumez from comment #5) > > (In reply to Sihui Liu from comment #4) > > > What are the cases where main thread is blocked by a suspended database > > > thread? Doesn't main thread know database threads' state? > > > > > > Or we probably should not block main thread on a database thread at all? > > > > Well, we probably should not but it happens. See rdar://problem/62377357 for > > one example. > > Alex fixed the case in rdar://problem/62377357 but it is not the first time > we have radars about similar issues so I thought we should tweak the design > to make sure it does not happen again. I see. Looks like we can apply Alex's fix to all the cases where main thread is blocked on a database thread(I currently see ~StorageManagerSet() and waitUntilSyncingLocalStorageFinished()). It might be worthwhile to get those fixed and make sure network process not wait especially when it's suspended(m_suspended is true). Your fix will solve most hang issues on suspension, but it covers those blocking on main thread issues and relies on ProcessTaskStateObserver to do the right thing and adds another thread(?).
Chris Dumez
Comment 8 2020-05-07 09:31:46 PDT
We’ve gotten rid of all cases of hangs of the NetworkProcess main thread on database threads. Let’s see if this is sufficient before doing this change, given that it adds complexity.
Note You need to log in before you can comment on or make changes to this bug.