<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>15686</bug_id>
          
          <creation_ts>2007-10-25 05:53:23 -0700</creation_ts>
          <short_desc>GtkLauncher aborts on launch due to uninitialized threading subsystem</short_desc>
          <delta_ts>2007-10-25 11:32:12 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKitGTK</component>
          <version>523.x (Safari 3)</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="m. dietrich">mdt</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>beidson</cc>
    
    <cc>mrowe</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>59420</commentid>
    <comment_count>0</comment_count>
    <who name="m. dietrich">mdt</who>
    <bug_when>2007-10-25 05:53:23 -0700</bug_when>
    <thetext>initialization fails with the message:

GLib-ERROR **: The thread system is not yet initialized. aborting...

glib&apos;s threading must be initilized before database stuff is initialized. i put 

if (!g_thread_supported ()) g_thread_init (NULL);

into WebKitTools/GtkLauncher/main.cpp but maybe  webkit_init() in WebKit/gtk/Api/webkitgtkglobal.cpp is a better place.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59421</commentid>
    <comment_count>1</comment_count>
    <who name="Mark Rowe (bdash)">mrowe</who>
    <bug_when>2007-10-25 05:56:53 -0700</bug_when>
    <thetext>What is happening here is that webkit_init calls DatabaseTracker::tracker to retrieve the DatabaseTracker singleton to set the database path.  The DatabaseTracker constructor allocates a SQLDatabase, which in turn allocates a Mutex.  All of this happens without WebCore calling initializeThreading.  The Gtk port could work around this by calling initializeThreading from webkit_init, but WebCore should be doing this itself before doing anything thread-related (this includes allocating mutexes).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59423</commentid>
    <comment_count>2</comment_count>
    <who name="Mark Rowe (bdash)">mrowe</who>
    <bug_when>2007-10-25 05:58:16 -0700</bug_when>
    <thetext>Copying Brady as he&apos;s done a lot of the work on the threading support in WebCore.  Brady, do you have any idea how to ensure that initializeThreading is always called at the appropriate times?  The two locations that it is currently called from seem quite arbitrary.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59428</commentid>
    <comment_count>3</comment_count>
    <who name="Alp Toker">alp</who>
    <bug_when>2007-10-25 08:17:09 -0700</bug_when>
    <thetext>Database support has been disabled in r27047 pending a fix for this bug. GtkLauncher should work again.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59434</commentid>
    <comment_count>4</comment_count>
    <who name="Brady Eidson">beidson</who>
    <bug_when>2007-10-25 09:17:58 -0700</bug_when>
    <thetext>Actually, there&apos;s already an abstraction for this in WebCore.  Check out threading.h - 

void initializeThreading();

It seems that GTK already hooked into that in r26864

initializeThreading() is called at any point a secondary thread might be kicked off.  Currently this include the IconDatabase c&apos;tor and the Database c&apos;tor.  GTK&apos;s impl in ThreadingGTK.cpp seems to do exactly what you say needs to be done -
if (!g_thread_supported ()) g_thread_init (NULL);

So in other words, I&apos;m surprised this isn&apos;t working already.


</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59435</commentid>
    <comment_count>5</comment_count>
    <who name="Brady Eidson">beidson</who>
    <bug_when>2007-10-25 09:19:25 -0700</bug_when>
    <thetext>Per Mark&apos;s comment of &quot;the two locations now seem quite arbritrary&quot; - perhaps the specific locations can be tweaked somewhat, but I like the idea of initializing threading *only* when a secondary thread might be kicked off.

If a client doesn&apos;t use the icon database and never visits a page with client-side databases, there&apos;s no reason they should init threading</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59447</commentid>
    <comment_count>6</comment_count>
      <attachid>16861</attachid>
    <who name="Alp Toker">alp</who>
    <bug_when>2007-10-25 11:28:03 -0700</bug_when>
    <thetext>Created attachment 16861
Fix, initialize thread support early as possible</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59448</commentid>
    <comment_count>7</comment_count>
      <attachid>16861</attachid>
    <who name="Brady Eidson">beidson</who>
    <bug_when>2007-10-25 11:29:47 -0700</bug_when>
    <thetext>Comment on attachment 16861
Fix, initialize thread support early as possible

I&apos;m still curious why the initialize-on-the-spot didn&apos;t work, but this seems reasonable.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59449</commentid>
    <comment_count>8</comment_count>
    <who name="Alp Toker">alp</who>
    <bug_when>2007-10-25 11:32:12 -0700</bug_when>
    <thetext>Fixed in r27050.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>16861</attachid>
            <date>2007-10-25 11:28:03 -0700</date>
            <delta_ts>2007-10-25 11:29:47 -0700</delta_ts>
            <desc>Fix, initialize thread support early as possible</desc>
            <filename>enable-db-fix.patch</filename>
            <type>text/plain</type>
            <size>2777</size>
            <attacher name="Alp Toker">alp</attacher>
            
              <data encoding="base64">SW5kZXg6IFdlYkNvcmUvQ2hhbmdlTG9nCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIFdlYkNvcmUvQ2hhbmdlTG9n
CShyZXZpc2lvbiAyNzA0OSkKKysrIFdlYkNvcmUvQ2hhbmdlTG9nCSh3b3JraW5nIGNvcHkpCkBA
IC0xLDMgKzEsMTQgQEAKKzIwMDctMTAtMjUgIEFscCBU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MgZGVmYXVsdCBsb2NhdGlvbgogICAg
IGdjaGFyKiBkYXRhYmFzZURpcmVjdG9yeSA9IGdfYnVpbGRfZmlsZW5hbWUoZ19nZXRfdXNlcl9k
YXRhX2RpcigpLCAid2Via2l0IiwgImRhdGFiYXNlcyIsIE5VTEwpOwo=
</data>
<flag name="review"
          id="7140"
          type_id="1"
          status="+"
          setter="beidson"
    />
          </attachment>
      

    </bug>

</bugzilla>