[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freedesktop-dbus
Subject:    Re: Out-of-memory error when using multiple threads
From:       Havoc Pennington <hp () redhat ! com>
Date:       2007-12-29 14:01:46
Message-ID: 4776534A.3070208 () redhat ! com
[Download RAW message or body]

Hi,

Olivier Hochreutiner wrote:
> The bug can be reproduced easily with the 'echo-client-mt' example of
> D-Bus C++ binding. For recall this program creates 16 threads. Each
> thread does the same method call 100 times in a loop (method calls are
> done with dbus_connection_send_with_reply_and_block()), and the main
> thread is the dispatcher thread.
> When echo-client-mt is run it dies after a few method calls with an
> OOM error returned by dbus_connection_send_with_reply_and_block(). I
> backtraced the error and I found it happens in
> protected_change_timeout() (see attached backtrace). When a thread
> reaches this point it sets connection->timeouts to NULL and then drops
> the connection lock to do the callbacks. If in the meantime another
> thread reach the same point it will find a NULL connection->timeouts
> and fail.
> I guess the problem can be fixed by adding a separate lock to protect
> the timeouts field of DBusConnection. What do you think ?
> 

Is this the same as the "Phantom Out of Memory error" problem here:
http://lists.freedesktop.org/archives/dbus/2007-July/thread.html#8144

Another lock is expensive and complex, it would be better to avoid it if 
we can - the earlier thread has a few suggested alternatives.

Havoc


_______________________________________________
dbus mailing list
dbus@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dbus
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic