WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
173739
LibWebRTCSocketClient should not destroy its socket within signalClose callback
https://bugs.webkit.org/show_bug.cgi?id=173739
Summary
LibWebRTCSocketClient should not destroy its socket within signalClose callback
youenn fablet
Reported
2017-06-22 15:16:03 PDT
LibWebRTCSocketClient should not destroy its socket within signalClose callback
Attachments
Patch
(1.86 KB, patch)
2017-06-22 15:23 PDT
,
youenn fablet
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
youenn fablet
Comment 1
2017-06-22 15:16:17 PDT
rdar://problem/32922877
youenn fablet
Comment 2
2017-06-22 15:23:45 PDT
Created
attachment 313666
[details]
Patch
Brent Fulgham
Comment 3
2017-06-23 09:21:32 PDT
Comment on
attachment 313666
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=313666&action=review
> Source/WebKit2/NetworkProcess/webrtc/LibWebRTCSocketClient.cpp:141 > + m_rtcProvider.callOnRTCNetworkThread([socket = m_rtcProvider.takeSocket(m_identifier)] { });
How do we know this is sufficient lifespan? I don't think that anything really guarantees that the RTCNetworkThread doesn't wake up and do the destruction before the caller of LibWebRTCSocketClient::signalClose() has a chance to finish using the socket. It seems like the caller needs some way to keep 'socket' alive for as long as it needs to use it.
Brent Fulgham
Comment 4
2017-06-23 09:24:29 PDT
Comment on
attachment 313666
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=313666&action=review
r=me
>> Source/WebKit2/NetworkProcess/webrtc/LibWebRTCSocketClient.cpp:141 >> + m_rtcProvider.callOnRTCNetworkThread([socket = m_rtcProvider.takeSocket(m_identifier)] { }); > > How do we know this is sufficient lifespan? I don't think that anything really guarantees that the RTCNetworkThread doesn't wake up and do the destruction before the caller of LibWebRTCSocketClient::signalClose() has a chance to finish using the socket. It seems like the caller needs some way to keep 'socket' alive for as long as it needs to use it.
Looking further, I guess the only caller of LibWebRTCSocketClient::signalClose is the WebRTCSocket message handler, which calls this method and doesn't do anything else. We might have a number of queued up messages to be handled that need socket, but by putting the destruction in the message queue, we guarantee that those tasks are done by the time we are allowed to destroy the socket. So I'm confident this change is correct.
youenn fablet
Comment 5
2017-06-23 09:45:48 PDT
(In reply to Brent Fulgham from
comment #4
)
> Comment on
attachment 313666
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=313666&action=review
> > r=me > > >> Source/WebKit2/NetworkProcess/webrtc/LibWebRTCSocketClient.cpp:141 > >> + m_rtcProvider.callOnRTCNetworkThread([socket = m_rtcProvider.takeSocket(m_identifier)] { }); > > > > How do we know this is sufficient lifespan? I don't think that anything really guarantees that the RTCNetworkThread doesn't wake up and do the destruction before the caller of LibWebRTCSocketClient::signalClose() has a chance to finish using the socket. It seems like the caller needs some way to keep 'socket' alive for as long as it needs to use it. > > Looking further, I guess the only caller of > LibWebRTCSocketClient::signalClose is the WebRTCSocket message handler, > which calls this method and doesn't do anything else. > > We might have a number of queued up messages to be handled that need socket, > but by putting the destruction in the message queue, we guarantee that those > tasks are done by the time we are allowed to destroy the socket. > > So I'm confident this change is correct.
Right, maybe I should beef up the change log?
WebKit Commit Bot
Comment 6
2017-06-23 13:43:45 PDT
Comment on
attachment 313666
[details]
Patch Clearing flags on attachment: 313666 Committed
r218759
: <
http://trac.webkit.org/changeset/218759
>
WebKit Commit Bot
Comment 7
2017-06-23 13:43:46 PDT
All reviewed patches have been landed. Closing bug.
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