Thanks for the responses. <br><br>Everything I can see indicates the messages are UTF-8 and thus the messages are legit. That wouldn't explain why sometimes it works and sometimes it fails though.<br><br>I put the debug on all, but it's logging the bytes of the messages. Looking at that, I can't really tell if the messages are off. <br>
<br>One detail I left out is the Observable/Observer pattern I'm using. The Observer implements my DBusInterface and exports itself to the dbus. The Observable is a thread that runs and updates its state every so often. When the Observable updates, the DbusObserver gets the update and emits a signal to the dbus. Is this perhaps a bad design? Could having N Observers accessing the dbus be an issue? (I'm guessing no since the dbus library appears thread-safe. I'm somewhat grasping at straws now.)<br>
<br>I went ahead and tried to create a small project to demonstrate the issue (mostly for myself). Again, sometimes it fails, sometimes it doesn't. Sometimes it takes a while to fail. If anyone somehow has the time/desire to dive into it, <a href="https://www.dropbox.com/s/ffbjp24h58s1yg3/dbus-test.tar.gz">https://www.dropbox.com/s/ffbjp24h58s1yg3/dbus-test.tar.gz</a><br>

<br>
-- <br>
Colby M. White<br>
<br><br><div class="gmail_quote">On Tue, Sep 4, 2012 at 6:07 PM, Matthew Johnson <span dir="ltr"><<a href="mailto:dbus@matthew.ath.cx" target="_blank">dbus@matthew.ath.cx</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div>On Tue Sep 04 11:40, Colby M White wrote:<br>
> I am attempting to use the java bindings for dbus and am encountering a<br>
> disconnecting problem. When I send a signal, the connection is disconnected<br>
> with out given me much of a reason as to why. Part of the issue is it<br>
> doesn't happen all the time, just when it feels like it. That's making it<br>
> hard to reproduce.<br>
<br>
</div>Hi, that's really strange - it definitely shouldn't do that.<br>
<div><br>
> So my main question: What are the possible reasons that a connection would<br>
> decide to disconnect (other then hitting the DBusConnection.disconnect()<br>
> method, which I confirmed is never being called in my code)? If I knew what<br>
> could cause a disconnection, then it would narrow my search.<br>
<br>
</div>Generally sending malformed stuff. Aside from strings I really should be<br>
stopping you sending anything illegal though.<br>
<div><br>
> One unique aspect to my setup is that I'm sending multiple signals, each by<br>
> its own thread. As far as I can tell, I've done this in a thread-safe<br>
> manner. When the signals are sent, they are sent in a synchronized block.<br>
> Here's a quick stream-lined glance at my class (Topic is a basic<br>
> DBusInterface that only has a signal):<br>
<br>
</div>it should already be thread-safe. Sending any message just appends it to a<br>
queue, which a background thread pops from and does the actual send.<br>
<div><br>
><br>
> Is there something about using this java binding in a threaded environment<br>
> that I'm missing? Are there some dbus-thread guidelines/safe practices? I'm<br>
> not entirely sure my threaded environment and the disconnections are<br>
> related (or at least my tests aren't showing that they are), but the very<br>
> nature of threads makes it hard to know. My gut tells me they probably are<br>
> related.<br>
<br>
</div>Nothing in that snippet looks obvious. Do you have a testcase you can reproduce<br>
with?<br>
<div><br>
> I recompiled my dbus jar with debug enabled and here is what is happening<br>
> after I send the signal. As you can see it writes, then disconnects right<br>
> after.<br>
><br>
> [org.freedesktop.dbus.AbstractConnection$_sender.run()] Got message:<br>
> DataChanged(0,7) { Path=>..., Interface=>dbus.topics.Topic,<br>
> Member=>DataChanged, Signature=>a{sv} } { { //the contents of my map//} }<br>
> [org.freedesktop.dbus.Message.append()] Appending sig: a{sv} data: [{ //the<br>
> contents of my map//}]<br>
> [org.freedesktop.dbus.MessageWriter.writeMessage()] <= DataChanged(0,7) {<br>
> Path=>..., Interface=>dbus.topics.Topic, Member=>DataChanged,<br>
> Signature=>a{sv} } { { //the contents of my map//} }<br>
> [org.freedesktop.dbus.MessageWriter.writeMessage()] Writing all 102 buffers<br>
> simultaneously to Unix Socket<br>
> [org.freedesktop.dbus.DBusConnection.disconnect()] Disconnecting<br>
> DBusConnection<br>
><br>
> Any help on dbus disconnections and/or how to get it to tell me why it is<br>
> disconnecting would be helpful.<br>
<br>
</div>Can you try changing the log levels by adding a debug.conf in the working<br>
directory? Try:<br>
<br>
org.freedesktop.dbus.MessageWriter=VERBOSE<br>
<br>
or (warning, lots of output) ALL=VERBOSE<br>
<br>
Matt<br>
<br>-----BEGIN PGP SIGNATURE-----<br>
Version: GnuPG v1.4.9 (GNU/Linux)<br>
<br>
iQIcBAEBCgAGBQJQRomtAAoJEKVC9ua3o6Nmop0P/jlI1RZDxIFAhwK82IN2o8aN<br>
hGHRa5p208bnI9ND3GGt2QNzXA1evCy15CoLIsurMQUlDrqV+uu6OnUelGkkk4da<br>
R8enExKwRI94xssdYzb47n8DQBsxxG6Chmu8z9KCUFSlECFGivMwCyt5ptDRvWMv<br>
mxN0O6D8LOMsOusm7bA9ceUELYK6B+mtE2UT7yqVvlbnw3U18DtqK7naGx/UwEdL<br>
zTpWC00W7gpaBP3f6OPDUcCuOPycvNlv5hNcFgbgSes7rskRCcnk2zOXkX0/MudM<br>
cJ4URSVuDvQWGJsdwNs2WW7d0lSHRKvNBfnK289hvr7mpgnIui1v3y+HpX+9epW8<br>
QwAboaKNF/1a3xkxtiClshpZBLDkEsd5oyUOu6H0qOisTEHq+xaXJnXEePa0Y7Vs<br>
+5uPzhLKx9Sc2yBwGrVrwA8mTHA+tdC7l5Wwr4JxblR7g0Yv1IQd/xl30SUWd4Cl<br>
fo1T17YgC9CnZzrjEaUHPDu8/cD/QNx8HciOI5EbX+slVx0DCYjjA7ZybzqlTMz7<br>
sXdiqE0GhWg17i4biE6/+2iPKn7PXDoUQqPJIrjW0qfN911etebBFkVtugGoeQ8C<br>
ltNqWFYpK09jX2XK1QzOrj4EAsHtg0jC8pZEm2G3/rkFlY2xmDX4SSfyDWAOcy1m<br>
AJsxwJQbkoMiNmzv1Qyz<br>
=ijnA<br>
-----END PGP SIGNATURE-----<br>
<br></blockquote></div><br>