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

Issue 5784005: Properly lock access to static variables.... (Closed)

Created:
10 years ago by MAD
Modified:
9 years, 7 months ago
CC:
chromium-reviews, brettw-cc_chromium.org
Visibility:
Public.

Description

Properly lock access to static variables. There were a few race conditions where the static method would test the validity of the hitograms_ static variable before attempting to use the lock_ to protect access to it but nothing then prevented the destructor to free both the lock_ and the hitograms_ memory. So I decided to not use a dynamic allocation of the static lock_ to resolve this problem. BUG=38354 TEST=Hard to repro exit scenario crashes. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=70054

Patch Set 1 #

Patch Set 2 : '' #

Patch Set 3 : '' #

Total comments: 6

Patch Set 4 : '' #

Patch Set 5 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+43 lines, -16 lines) Patch
M base/message_loop.cc View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M base/metrics/histogram.h View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M base/metrics/histogram.cc View 1 2 3 8 chunks +39 lines, -12 lines 0 comments Download
M chrome/renderer/renderer_main.cc View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M net/socket_stream/socket_stream_metrics_unittest.cc View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 22 (0 generated)
MAD
How about this? BYE MAD
10 years ago (2010-12-14 15:59:11 UTC) #1
jar (doing other things)
I believe the code is still vulnerable to the same class of races, as an ...
10 years ago (2010-12-14 22:54:37 UTC) #2
Vitaly Buka (NO REVIEWS)
It fixes crash issue (or may be just move to other location). We better should ...
10 years ago (2010-12-15 00:57:47 UTC) #3
Vitaly Buka (NO REVIEWS)
Personally I rather join the thread and wait for upload. It may slow shutdown but ...
10 years ago (2010-12-15 01:00:11 UTC) #4
Vitaly Buka (NO REVIEWS)
I just checked. CL definitely does not fix to much. Last time it crashed in ...
10 years ago (2010-12-15 01:03:52 UTC) #5
MAD
Which other static lock? Maybe we should try the compromise proposed by jar@, which is ...
10 years ago (2010-12-15 01:19:31 UTC) #6
Vitaly Buka corp
On Tue, Dec 14, 2010 at 17:19, Marc-Andre Decoste <mad@chromium.org> wrote: > Which other static ...
10 years ago (2010-12-15 01:37:03 UTC) #7
Vitaly Buka corp
This is one of them. I seen others. Lock rollover_lock; in base\time_win.cc ntdll.dll!_RtlpWaitOnCriticalSection@8() + 0x99 ...
10 years ago (2010-12-15 01:41:41 UTC) #8
Vitaly Buka corp
I am strongly against leaking threads if you don't know 100% resources it uses. On ...
10 years ago (2010-12-15 01:44:10 UTC) #9
MAD
Ha, I thought you saw other crashes with the same metrics code... Yes, this other ...
10 years ago (2010-12-15 01:59:18 UTC) #10
Vitaly Buka corp
Sorry. This is different one. On Tue, Dec 14, 2010 at 17:59, Marc-Andre Decoste <mad@chromium.org> ...
10 years ago (2010-12-15 02:14:07 UTC) #11
MAD
> > I don't afraid about leaking resources. It will sometimes crash accessing > other ...
10 years ago (2010-12-15 02:19:48 UTC) #12
Vitaly Buka corp
It looks like chrome.dll was released before this moment. Maybe best fix is to release ...
10 years ago (2010-12-15 03:12:31 UTC) #13
Vitaly Buka (NO REVIEWS)
LGTM. I don't know details to continue argue about this.
10 years ago (2010-12-15 03:32:00 UTC) #14
jar (doing other things)
Performance of Chrome shutdown precludes joining most threads. We can't afford to wait for all ...
10 years ago (2010-12-15 16:01:30 UTC) #15
mad-corp
How about this? BYE MAD
10 years ago (2010-12-16 21:17:14 UTC) #16
MAD
Made one more small change to get the tests happy... BYE MAD
10 years ago (2010-12-17 22:49:22 UTC) #17
MAD
PING? Can I commit this now? Thanks... BYE MAD
10 years ago (2010-12-21 20:51:22 UTC) #18
jar (doing other things)
Please anticipate that there is good chance that you'll break the build on valgrind, and ...
10 years ago (2010-12-22 00:05:16 UTC) #19
mad-corp
Thanks... The linux_valgrind try bot seems happy with the change: http://build.chromium.org/p/tryserver.chromium/builders/linux_valgrind/builds/299 Memory test for base ...
10 years ago (2010-12-22 20:31:43 UTC) #20
MAD
Thanks... Addressed all comments, even the special credit naming nits... (I'm a big fan of ...
10 years ago (2010-12-22 21:15:13 UTC) #21
jar (doing other things)
10 years ago (2010-12-22 21:43:21 UTC) #22
LGTM

(including extra credit for renaming ;-) )

Powered by Google App Engine
This is Rietveld 408576698