Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(137)

Issue 2583613003: Fix segfault when PeerConnection is destroyed during stats collection. (Closed)

Created:
4 years ago by hbos
Modified:
4 years ago
CC:
webrtc-reviews_webrtc.org, the sun, tterriberry_mozilla.com
Target Ref:
refs/heads/master
Project:
webrtc
Visibility:
Public.

Description

Fix segfault when PeerConnection is destroyed during stats collection. RTCStatsCollector relies on PeerConnection and its WebRtcSession. If the PeerConnection is destroyed, reference counting keeps the RTCStatsCollector alive until the request has completed. But the request is using PeerConnection/WebRtcSession resources that are destroyed in ~PeerConnection(). To get around this problem, RTCStatsCollector::WaitForPendingRequest() is added, which is invoked at ~PeerConnection(). Integration test added, it caused a segmentation fault before this change / EXPECT failure. BUG=chromium:627816 Review-Url: https://codereview.webrtc.org/2583613003 Cr-Commit-Position: refs/heads/master@{#15674} Committed: https://chromium.googlesource.com/external/webrtc/+/b78306a7d339bfcc3c4a6043023ab57d95444b99

Patch Set 1 #

Total comments: 8

Patch Set 2 : Fix possible nullptr dereferencing #

Patch Set 3 : Addressed comments #

Total comments: 4

Patch Set 4 : DCHECK in destructor added #

Unified diffs Side-by-side diffs Delta from patch set Stats (+37 lines, -0 lines) Patch
M webrtc/api/peerconnection.cc View 1 1 chunk +4 lines, -0 lines 0 comments Download
M webrtc/api/rtcstats_integrationtest.cc View 1 2 1 chunk +13 lines, -0 lines 0 comments Download
M webrtc/api/rtcstatscollector.h View 1 2 3 1 chunk +5 lines, -0 lines 0 comments Download
M webrtc/api/rtcstatscollector.cc View 1 2 3 2 chunks +15 lines, -0 lines 0 comments Download

Messages

Total messages: 27 (18 generated)
hbos
Please take a look, hta and beefy
4 years ago (2016-12-16 13:47:33 UTC) #6
hbos
https://codereview.webrtc.org/2583613003/diff/20001/webrtc/api/rtcstatscollector.h File webrtc/api/rtcstatscollector.h (right): https://codereview.webrtc.org/2583613003/diff/20001/webrtc/api/rtcstatscollector.h#newcode73 webrtc/api/rtcstatscollector.h:73: // If there are any |GetStatsReport| requests in-flight, waits ...
4 years ago (2016-12-16 13:49:35 UTC) #7
hta-webrtc
A few comments. Good find! https://codereview.webrtc.org/2583613003/diff/20001/webrtc/api/peerconnection.cc File webrtc/api/peerconnection.cc (right): https://codereview.webrtc.org/2583613003/diff/20001/webrtc/api/peerconnection.cc#newcode611 webrtc/api/peerconnection.cc:611: stats_collector_->WaitForPendingRequest(); Doing waiting in ...
4 years ago (2016-12-16 14:05:31 UTC) #10
hbos
PTAL hta, deadbeef. https://codereview.webrtc.org/2583613003/diff/20001/webrtc/api/peerconnection.cc File webrtc/api/peerconnection.cc (right): https://codereview.webrtc.org/2583613003/diff/20001/webrtc/api/peerconnection.cc#newcode611 webrtc/api/peerconnection.cc:611: stats_collector_->WaitForPendingRequest(); On 2016/12/16 14:05:31, hta-webrtc wrote: ...
4 years ago (2016-12-16 14:34:52 UTC) #13
Taylor Brandstetter
lgtm with nits. I'd prefer if the SleepMs could be avoided. https://codereview.webrtc.org/2583613003/diff/60001/webrtc/api/peerconnection.cc File webrtc/api/peerconnection.cc (right): ...
4 years ago (2016-12-16 18:53:27 UTC) #19
hta-webrtc
lgtm rtc::Event seems like it might fit the bill for avoiding the busy-wait. A little ...
4 years ago (2016-12-17 19:51:30 UTC) #20
hbos
https://codereview.webrtc.org/2583613003/diff/60001/webrtc/api/peerconnection.cc File webrtc/api/peerconnection.cc (right): https://codereview.webrtc.org/2583613003/diff/60001/webrtc/api/peerconnection.cc#newcode612 webrtc/api/peerconnection.cc:612: stats_collector_->WaitForPendingRequest(); On 2016/12/16 18:53:27, Taylor Brandstetter wrote: > nit: ...
4 years ago (2016-12-19 09:52:49 UTC) #21
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.webrtc.org/2583613003/80001
4 years ago (2016-12-19 12:53:17 UTC) #24
commit-bot: I haz the power
4 years ago (2016-12-19 13:07:01 UTC) #27
Message was sent while issue was closed.
Committed patchset #4 (id:80001) as
https://chromium.googlesource.com/external/webrtc/+/b78306a7d339bfcc3c4a60430...

Powered by Google App Engine
This is Rietveld 408576698