RESOLVED FIXED 159331
Deadlock inside -[WebCoreNSURLSession dealloc]
https://bugs.webkit.org/show_bug.cgi?id=159331
Summary Deadlock inside -[WebCoreNSURLSession dealloc]
Jer Noble
Reported 2016-06-30 23:14:01 PDT
SPIN inside -[WebCoreNSURLSession dealloc]
Attachments
Patch (2.08 KB, patch)
2016-06-30 23:25 PDT, Jer Noble
no flags
Jer Noble
Comment 1 2016-06-30 23:21:51 PDT
Jer Noble
Comment 2 2016-06-30 23:25:41 PDT
Alex Christensen
Comment 3 2016-07-01 00:20:20 PDT
Comment on attachment 282513 [details] Patch Alternatively, you could just move the declaration of function inside the while loop scope (but not in the lock scope).
Jer Noble
Comment 4 2016-07-01 08:38:03 PDT
(In reply to comment #3) > Comment on attachment 282513 [details] > Patch > > Alternatively, you could just move the declaration of function inside the > while loop scope (but not in the lock scope). I considered that, but thought this way would be slightly less expensive (no call to the constructor and destructor), as well as is more explicit about what's going on.
WebKit Commit Bot
Comment 5 2016-07-01 08:41:05 PDT
Comment on attachment 282513 [details] Patch Clearing flags on attachment: 282513 Committed r202736: <http://trac.webkit.org/changeset/202736>
WebKit Commit Bot
Comment 6 2016-07-01 08:41:10 PDT
All reviewed patches have been landed. Closing bug.
Geoffrey Garen
Comment 7 2016-07-01 09:30:18 PDT
Comment on attachment 282513 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=282513&action=review > Source/WTF/wtf/MainThread.cpp:137 > + // Clearing the function can have side effects, so do so outside of the lock above. > + function = nullptr; Can we just move the declaration of function inside the loop? That's the C++ way to specify the semantics you want: Don't allow this value to outlive this loop body.
Geoffrey Garen
Comment 8 2016-07-01 09:34:54 PDT
> > Alternatively, you could just move the declaration of function inside the > > while loop scope (but not in the lock scope). > > > I considered that, but thought this way would be slightly less expensive (no > call to the constructor and destructor), as well as is more explicit about > what's going on. There's no performance concern here. The empty constructor just assigns nullptr, which is exactly what you've done manually. Actually, there's a slight performance win, since it's much easier for the compiler to notice that nullptr is never observed, and eliminate the store entirely.
Jer Noble
Comment 9 2016-07-01 10:24:16 PDT
(In reply to comment #8) > > > Alternatively, you could just move the declaration of function inside the > > > while loop scope (but not in the lock scope). > > > > > > I considered that, but thought this way would be slightly less expensive (no > > call to the constructor and destructor), as well as is more explicit about > > what's going on. > > There's no performance concern here. The empty constructor just assigns > nullptr, which is exactly what you've done manually. Actually, there's a > slight performance win, since it's much easier for the compiler to notice > that nullptr is never observed, and eliminate the store entirely. Okay, sure. I'll post a follow up.
Note You need to log in before you can comment on or make changes to this bug.