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

Issue 6693047: AU: HttpFetcher: Fix segfault with multi fetcher and small transfers (Closed)

Created:
9 years, 8 months ago by adlr
Modified:
9 years ago
Reviewers:
petkov
CC:
chromium-os-reviews_chromium.org, petkov, adlr
Visibility:
Public.

Description

AU: HttpFetcher: Fix segfault with multi fetcher and small transfers When a proxy resolver resolves proxies, it calls into HttpFetcher w/ the results, which then kicks off a transfer (by executing a member variable callback of HttpFetcher). After HttpFetcher calls that callback, it sets the callback to NULL. When using MultiHttpFetcher, the same HttpFetcher is used multiple times. If we have a very small transfer, what can happen is this. Time goes down, callstack grows to the right: First transfer proxies resolved ++ HttpFetcher called, calls a callback +++ Transfer begins ++++ Transfer ends +++++ MultiFetcher told transfer ends ++++++ MultiFetcher starts new transfer +++++++ HttpFetcher installs a new callback member var ++ HttpFetcher zeros out callback member var Second transfer proxies resolved ++ HttpFetcher member var is NULL - CRASH To fix this issue, HttpFetcher makes a local copy of the callback pointer, then sets the member variable to NULL, then calls the callback. (On a side note, it is CLs and bugs like these that make me wonder if maybe we should have used Chrome's threading model rather than going single threaded and async.) Also, fix a comment in MultiHttpFetcher Change-Id: Ib87c1e75211bc56cecea7f7298576371184d586c BUG=chromium-os:13388 TEST=unittests Committed: http://chrome-svn/viewvc/chromeos?view=rev&revision=ffcb6d1

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+6 lines, -2 lines) Patch
M http_fetcher.cc View 2 chunks +5 lines, -1 line 0 comments Download
M multi_range_http_fetcher.cc View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 2 (0 generated)
adlr
9 years, 8 months ago (2011-04-02 00:49:13 UTC) #1
petkov
9 years, 8 months ago (2011-04-02 04:50:28 UTC) #2
LGTM

Tricky. Yes, I'd support moving to a 2-thread model.

Powered by Google App Engine
This is Rietveld 408576698