Re: compiler optimization causing issues with glib



On Thu, May 24, 2012 at 11:20 AM, Mike <puffy taco gmail com> wrote:
> Hi,
>
> I'm seeing some unexplained behavior from glib when I compile it with
> optimizations.  I am using glib 2.26.0 cross-compiled for ARM using
> Code Sourcery arm-2010q1-202.
>
> The application I'm having issues with uses gdbus and exposes a few
> methods.  The method of causing the issue is continuously calling one
> of the methods (which basically does a g_spawn_async and then we wait
> until the child is done before calling the method again).  The issue
> shows up in a few different ways:
>
> - Thread stuck in futex wait inside kernel
> - Seg fault (only got function name, didn't have debug symbols to go further)
> -- g_object_ref
> -- memset as part of a gmalloc0
>
> In addition, I did a test where I compiled with "-O3" and I saw
> "GLib:ERROR:grand.c:352:g_rand_set_seed: code should not be reached"
> print out on my console.
>
> I have not yet seen an issue if I compile with "-O0", nor if I'm
> running strace trying to figure out the futex issue.  So I'm not yet
> sure what the real issue is, but I'm curious if anyone has encountered
> anything like this?  I was going to try compiling the latest glib
> release, but it has new host tools dependencies and I don't want to
> change those for now.

Unfortunately, I just managed to get this error to trigger now even
with the optimization changes, which is probably good -- I'd like to
trust the compiler!  In any case, is there a document anywhere that
describes the different threads that glib sets up?  As far as I can
tell, there are 2 threads in all of my glib applications.  This
application uses gdbus and upon a method call, calls g_spawn_async
followed by g_child_watch_add.  As far as I'm concerned it is supposed
to be single threaded.  So, I'd like to know what is expected of the
various threads and why they exist in my otherwise single-threaded
application.

Thanks,
Mike


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]