[webkit-dev] Gdklauncher Craches

Krzysztof Kowalczyk kkowalczyk at gmail.com
Thu Feb 22 19:49:50 PST 2007


Looking more closely at both callstacks, there is a re-entrance in
curl i.e. a data callback is called from within curl_multi_perform, it
triggers html processing which triggers a download of another resource
which enters curl again. Maybe the problem is that curl version on
Ubuntu 6.10 is not re-entrant (or maybe it's not re-entrant at all and
I'm just lucky to not see it so often using custom debug build of
latest curl code).

Either way, my final plan is to move curl networking to a separate
thread, the way qt and windows do, so that the app can be more
responsive (currently I see cases where blocking network calls,
especially DNS resolution, stalls gdklauncher for a long time). That
might help with this problem since in that model the curl data
callback would just post received data for processing to the main
thread, removing the curl re-entrancy. But don't hold your breath -
for now I would recommend building your own curl library.

-- kjk

On 2/22/07, Robin Dunn <robin at alldunn.com> wrote:
> Krzysztof Kowalczyk wrote:
> > On my Ubuntu 6.10 with the default curl libraries (7.15.4, I believe),
> > I've been seeing often crashes in curl. They all pretty much went away
> > when I uninstalled curl and build my own debug version from latest
> > curl sources (http://curl.haxx.se/download/curl-7.16.1.tar.gz) and
> > made gdklauncher use that.
> >
> > While it's hard for me to believe that such a widely used library like
> > curl could be broken on one of the most popular distros, the evidence
> > is in favor of that conclusion.
> >
> > Another possibility is that we're not using curl code correctly in gdk
> > port and newer version (or debug build) is more resilient to that
> > incorrect usage, but I spent some time studying the code and nothing
> > jumps out as wrong.
>
>
> I can confirm this problem when using the wxWidgets build on Linux (also
> Ubuntu 6.10 here.)  I've pasted a gdb backtrace below since mine is a
> little different than the one posted already.  Maybe that will give some
> additional hints for fixing this.
>
> Also, on Windows when using libcurl for the network layer it's possible
> that the first time that downloadTimerCallback is called for each job
> that curl_multi_fdset will not load any handles into the fd_sets, so the
> call to select will fail, returning -1.  However this seems to be a
> valid state so downloadTimerCallback should not be bailing out as it
> currently does right after the select() call.  Commenting out that if
> statement allows it to work properly and be able to do the downloading
> on subsequent timer callbacks.
>
>
> Here's the backtrace on Ubuntu:
>
> Program received signal SIGSEGV, Segmentation fault.
> 0xb7358f52 in curl_memdebug () from /usr/lib/libcurl.so.3
> (gdb) bt
> #0  0xb7358f52 in curl_memdebug () from /usr/lib/libcurl.so.3
> #1  0xb7358fa5 in curl_memdebug () from /usr/lib/libcurl.so.3
> #2  0xb735a5de in curl_multi_add_handle () from /usr/lib/libcurl.so.3
> #3  0xb6ea218a in WebCore::ResourceHandleManager::add (this=0x825c5a8,
> job=0x845b450) at ../../platform/network/gdk/ResourceHandleManager.cpp:239
> #4  0xb6e9ff1f in WebCore::ResourceHandle::start (this=0x845b450,
> frame=0x822b630) at ../../platform/network/gdk/ResourceHandleCurl.cpp:56
> #5  0xb6e6bf06 in WebCore::ResourceHandle::create (request=@0xbf896620,
> client=0x8442360, frame=0x822b630, defersLoading=false,
> mightDownloadFromHandle=false) at
> ../../platform/network/ResourceHandle.cpp:43
> #6  0xb6d23ccc in WebCore::ResourceLoader::load (this=0x8442360,
> r=@0xbf8968f8) at ../../loader/ResourceLoader.cpp:116
> #7  0xb6d26b40 in WebCore::SubresourceLoader::load (this=0x8442360,
> r=@0xbf8968f8) at ../../loader/SubresourceLoader.cpp:81
> #8  0xb6d271ba in WebCore::SubresourceLoader::create (frame=0x822b630,
> client=0xb70918b8, request=@0xbf896a60) at
> ../../loader/SubresourceLoader.cpp:119
> #9  0xb6d1830d in WebCore::Loader::servePendingRequests
> (this=0xb70918b8) at ../../loader/loader.cpp:88
> #10 0xb6d19528 in WebCore::Loader::load (this=0xb70918b8, dl=0x8290fc0,
> object=0x845b2c8, incremental=true) at ../../loader/loader.cpp:63
> #11 0xb6cdeb8e in CachedImage (this=0x845b2c8, docLoader=0x8290fc0,
> url=@0xbf896e94, cachePolicy=WebCore::CachePolicyVerify, _expireDate=0)
> at ../../loader/CachedImage.cpp:63
> #12 0xb6cdc879 in WebCore::Cache::requestResource (this=0xb70918a0,
> docLoader=0x8290fc0, type=WebCore::CachedResource::ImageResource,
> url=@0xbf897020, expireDate=0, charset=0x0) at ../../loader/Cache.cpp:65
> #13 0xb6ce4521 in WebCore::DocLoader::requestResource (this=0x8290fc0,
> type=WebCore::CachedResource::ImageResource, url=@0xbf897178,
> charset=0x0, skipCanLoadCheck=false) at ../../loader/DocLoader.cpp:134
> #14 0xb6ce4734 in WebCore::DocLoader::requestImage (this=0x8290fc0,
> url=@0xbf897178) at ../../loader/DocLoader.cpp:88
> #15 0xb6c3b614 in WebCore::HTMLImageLoader::updateFromElement
> (this=0x845beac) at ../../html/HTMLImageLoader.cpp:102
> #16 0xb6c39b2e in WebCore::HTMLImageElement::parseMappedAttribute
> (this=0x845be40, attr=0x8459dc0) at ../../html/HTMLImageElement.cpp:95
> #17 0xb6b62ffe in WebCore::StyledElement::attributeChanged
> (this=0x845be40, attr=0x8459dc0, preserveDecls=false) at
> ../../dom/StyledElement.cpp:178
> #18 0xb6b36522 in WebCore::Element::setAttributeMap (this=0x845be40,
> list=0x843d850) at ../../dom/Element.cpp:437
> #19 0xb6c5dc7c in WebCore::HTMLParser::parseToken (this=0x8297030,
> t=0x8296af4) at ../../html/HTMLParser.cpp:208
> #20 0xb6c7a88f in WebCore::HTMLTokenizer::processToken (this=0x8296ae0)
> at ../../html/HTMLTokenizer.cpp:1590
> #21 0xb6c80133 in WebCore::HTMLTokenizer::parseTag (this=0x8296ae0,
> src=@0x8296fe0, state={static EntityShift = 4, m_bits = 1}) at
> ../../html/HTMLTokenizer.cpp:1163
> #22 0xb6c82cba in WebCore::HTMLTokenizer::write (this=0x8296ae0,
> str=@0xbf89752c, appendData=true) at ../../html/HTMLTokenizer.cpp:1389
> #23 0xb6cf1ed8 in WebCore::FrameLoader::write (this=0x822b2c0,
> str=0x827da10 "<html><head><meta http-equiv=\"content-type\"
> content=\"text/html;
> charset=UTF-8\"><title>Google</title><style><!--\nbody,td,a,p,.h{font-family:arial,sans-serif}\n.h{font-size:20px}\n.h{color:#3366cc}\n.q{col"...,
> len=4904, flush=false) at ../../loader/FrameLoader.cpp:896
> #24 0xb6cf22ec in WebCore::FrameLoader::addData (this=0x822b2c0,
> bytes=0x827da10 "<html><head><meta http-equiv=\"content-type\"
> content=\"text/html;
> charset=UTF-8\"><title>Google</title><style><!--\nbody,td,a,p,.h{font-family:arial,sans-serif}\n.h{font-size:20px}\n.h{color:#3366cc}\n.q{col"...,
> length=4904) at ../../loader/FrameLoader.cpp:1516
> #25 0xb6cec96c in WebCore::FrameLoader::committedLoad (this=0x822b2c0,
> loader=0x8255868, data=0x827da10 "<html><head><meta
> http-equiv=\"content-type\" content=\"text/html;
> charset=UTF-8\"><title>Google</title><style><!--\nbody,td,a,p,.h{font-family:arial,sans-serif}\n.h{font-size:20px}\n.h{color:#3366cc}\n.q{col"...,
> length=4904) at ../../loader/FrameLoader.cpp:2944
> #26 0xb6ce6931 in WebCore::DocumentLoader::commitLoad (this=0x8255868,
> data=0x827da10 "<html><head><meta http-equiv=\"content-type\"
> content=\"text/html;
> charset=UTF-8\"><title>Google</title><style><!--\nbody,td,a,p,.h{font-family:arial,sans-serif}\n.h{font-size:20px}\n.h{color:#3366cc}\n.q{col"...,
> length=4904) at ../../loader/DocumentLoader.cpp:320
> #27 0xb6ce6a35 in WebCore::DocumentLoader::receivedData (this=0x8255868,
> data=0x827da10 "<html><head><meta http-equiv=\"content-type\"
> content=\"text/html;
> charset=UTF-8\"><title>Google</title><style><!--\nbody,td,a,p,.h{font-family:arial,sans-serif}\n.h{font-size:20px}\n.h{color:#3366cc}\n.q{col"...,
> length=4904) at ../../loader/DocumentLoader.cpp:332
> #28 0xb6ced383 in WebCore::FrameLoader::receivedData (this=0x822b2c0,
> data=0x827da10 "<html><head><meta http-equiv=\"content-type\"
> content=\"text/html;
> charset=UTF-8\"><title>Google</title><style><!--\nbody,td,a,p,.h{font-family:arial,sans-serif}\n.h{font-size:20px}\n.h{color:#3366cc}\n.q{col"...,
> length=4904) at ../../loader/FrameLoader.cpp:1911
> #29 0xb6d1ac06 in WebCore::MainResourceLoader::addData (this=0x825ba78,
> data=0x827da10 "<html><head><meta http-equiv=\"content-type\"
> content=\"text/html;
> charset=UTF-8\"><title>Google</title><style><!--\nbody,td,a,p,.h{font-family:arial,sans-serif}\n.h{font-size:20px}\n.h{color:#3366cc}\n.q{col"...,
> length=4904, allAtOnce=false) at ../../loader/MainResourceLoader.cpp:133
> #30 0xb6d218d1 in WebCore::ResourceLoader::didReceiveData
> (this=0x825ba78, data=0x827da10 "<html><head><meta
> http-equiv=\"content-type\" content=\"text/html;
> charset=UTF-8\"><title>Google</title><style><!--\nbody,td,a,p,.h{font-family:arial,sans-serif}\n.h{font-size:20px}\n.h{color:#3366cc}\n.q{col"...,
> length=4904, lengthReceived=0, allAtOnce=false) at
> ../../loader/ResourceLoader.cpp:206
> #31 0xb6d1bc31 in WebCore::MainResourceLoader::didReceiveData
> (this=0x825ba78, data=0x827da10 "<html><head><meta
> http-equiv=\"content-type\" content=\"text/html;
> charset=UTF-8\"><title>Google</title><style><!--\nbody,td,a,p,.h{font-family:arial,sans-serif}\n.h{font-size:20px}\n.h{color:#3366cc}\n.q{col"...,
> length=4904, lengthReceived=0, allAtOnce=false) at
> ../../loader/MainResourceLoader.cpp:291
> #32 0xb6d20fa8 in WebCore::ResourceLoader::didReceiveData
> (this=0x825ba78, data=0x827da10 "<html><head><meta
> http-equiv=\"content-type\" content=\"text/html;
> charset=UTF-8\"><title>Google</title><style><!--\nbody,td,a,p,.h{font-family:arial,sans-serif}\n.h{font-size:20px}\n.h{color:#3366cc}\n.q{col"...,
> length=4904, lengthReceived=0) at ../../loader/ResourceLoader.cpp:318
> #33 0xb6ea1110 in writeCallback (ptr=0x827da10, size=1, nmemb=4904,
> obj=0x823b028) at ../../platform/network/gdk/ResourceHandleManager.cpp:80
> #34 0xb73417d0 in curl_slist_free_all () from /usr/lib/libcurl.so.3
> #35 0xb735a951 in curl_multi_init () from /usr/lib/libcurl.so.3
> #36 0xb735aaf2 in curl_multi_init () from /usr/lib/libcurl.so.3
> #37 0xb73563f9 in curl_mvsnprintf () from /usr/lib/libcurl.so.3
> #38 0xb735970d in curl_multi_timeout () from /usr/lib/libcurl.so.3
> #39 0xb7359d94 in curl_multi_perform () from /usr/lib/libcurl.so.3
> #40 0xb6ea1302 in WebCore::ResourceHandleManager::downloadTimerCallback
> (this=0x825c5a8, timer=0x825c5a8) at
> ../../platform/network/gdk/ResourceHandleManager.cpp:120
> #41 0xb6ea23db in WebCore::Timer<WebCore::ResourceHandleManager>::fired
> (this=0x825c5a8) at ../../platform/Timer.h:96
> #42 0xb6d90dc4 in WebCore::TimerBase::fireTimers
> (fireTime=1172200670.95, firingTimers=@0xbf897bec) at
> ../../platform/Timer.cpp:336
> #43 0xb6d90ebf in WebCore::TimerBase::sharedTimerFired () at
> ../../platform/Timer.cpp:353
> #44 0xb6e9c408 in WebCore::WebKitTimer::Notify (this=0x826ed58) at
> ../../platform/wx/wxSharedTimer.cpp:62
> #45 0xb6584f72 in timeout_callback (data=0x826ed58) at
> ../src/gtk/timer.cpp:43
> #46 0xb59b8dd6 in g_source_get_current_time () from
> /usr/lib/libglib-2.0.so.0
> #47 0xb59b8802 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
> #48 0xb59bb7df in g_main_context_check () from /usr/lib/libglib-2.0.so.0
> #49 0xb59bbb89 in g_main_loop_run () from /usr/lib/libglib-2.0.so.0
> #50 0xb5e18574 in IA__gtk_main () at gtkmain.c:1024
> #51 0xb657a3bb in wxEventLoop::Run (this=0x8279088) at
> ../src/gtk/evtloop.cpp:76
> #52 0xb6625774 in wxAppBase::MainLoop (this=0x809c098) at
> ../src/common/appcmn.cpp:308
> #53 0xb66250bd in wxAppBase::OnRun (this=0x809c098) at
> ../src/common/appcmn.cpp:363
> #54 0xb630023c in wxEntry (argc=@0xb6407a2c, argv=0x808a758) at
> ../src/common/init.cpp:449
> #55 0xb6300307 in wxEntry (argc=@0xbf897ee0, argv=0xbf897f64) at
> ../src/common/init.cpp:461
> #56 0x080620e0 in main (argc=Cannot access memory at address 0x0
> ) at webkittest.cpp:151
> (gdb)
>
>
>
> --
> Robin Dunn
> Software Craftsman
> http://wxPython.org  Java give you jitters?  Relax with wxPython!
>
>



More information about the webkit-dev mailing list