dbus java DirectConnection FatalDBusException

Edgar Domingues edgar.domingues at gmail.com
Thu Jan 12 02:27:00 PST 2012


Hi Matt,

I only see the exceptions because I changed the catch blocks in
AbstractConnection to log them.
I ran the tests code  (tests/test-p2p-client and server) and the
results are the same (shown below).
I don't mind that the client die after disconnecting. My problem is
the server. I need the server to keep running after the client
disconnects so it receives other clients. Looks like the server code
blocks in "new DirectConnection" until a client connects and then dbus
crashes after the client disconnects.

There is some way of knowing if dbus is running or not, so the server
can start listening again?

test_p2p_server output:
Connected
getName called
got float: [17.093, -23.0, 0.0, 31.42]
throwme called
org.freedesktop.dbus.exceptions.FatalDBusException: Underlying
transport returned EOF
	at org.freedesktop.dbus.AbstractConnection.readIncoming(Unknown Source)
	at org.freedesktop.dbus.AbstractConnection.access$000(Unknown Source)
	at org.freedesktop.dbus.AbstractConnection$_thread.run(Unknown Source)

test_p2p_client output:
Connected
Peer2Peer Server
17.093
Caught TestException
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection
1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node name="/Test">
 <interface name="org.freedesktop.dbus.test.TestRemoteInterface">
  <method name="teststructstruct" >
  <annotation name="org.freedesktop.DBus.Description" value="Testing
structs of structs" />
   <arg type="((asv)aai)" direction="in"/>
   <arg type="aai" direction="out"/>
  </method>
  <method name="getNameAndThrow" >
   <arg type="s" direction="out"/>
  </method>
  <method name="frobnicate" >
  <annotation name="org.freedesktop.DBus.Description" value="Test of
nested maps" />
   <arg type="ax" direction="in"/>
   <arg type="a{sa{qn}}" direction="in"/>
   <arg type="v" direction="in"/>
   <arg type="i" direction="out"/>
  </method>
  <method name="throwme" >
  <annotation name="org.freedesktop.DBus.Description" value="Throws a
TestException when called" />
   <annotation name="org.freedesktop.DBus.Method.Error"
value="org.freedesktop.dbus.test.TestException" />
  </method>
  <method name="waitawhile" >
  <annotation name="org.freedesktop.DBus.Description" value="Waits
then doesn't return" />
  <annotation name="org.freedesktop.DBus.Method.NoReply" value="" />
  </method>
  <method name="overload" >
  <annotation name="org.freedesktop.DBus.Description"
value="Interface-overloaded method" />
   <arg type="i" direction="out"/>
  </method>
  <method name="newpathtest" >
  <annotation name="org.freedesktop.DBus.Description" value="Testing
object paths as Path objects" />
   <arg type="o" direction="in"/>
  </method>
  <method name="reg13291" >
  <annotation name="org.freedesktop.DBus.Description"
value="Regression test for #13291" />
   <arg type="ay" direction="in"/>
   <arg type="ay" direction="in"/>
  </method>
  <method name="pathrv" >
   <arg type="o" direction="in"/>
   <arg type="o" direction="out"/>
  </method>
  <method name="pathlistrv" >
   <arg type="ao" direction="in"/>
   <arg type="ao" direction="out"/>
  </method>
  <method name="pathmaprv" >
   <arg type="a{oo}" direction="in"/>
   <arg type="a{oo}" direction="out"/>
  </method>
  <method name="testfloat" >
  <annotation name="org.freedesktop.DBus.Description" value="Testing
the float type" />
   <arg type="ad" direction="in"/>
   <arg type="d" direction="out"/>
  </method>
  <method name="getName" >
  <annotation name="org.freedesktop.DBus.Description" value="Simple
test method" />
   <arg type="s" direction="out"/>
  </method>
  <method name="sig" >
  <annotation name="org.freedesktop.DBus.Description" value="Testing
Type Signatures" />
   <arg type="g" direction="in"/>
  </method>
 </interface>
 <interface name="org.freedesktop.DBus.Introspectable">
  <method name="Introspect">
   <arg type="s" direction="out"/>
  </method>
 </interface>
 <interface name="org.freedesktop.DBus.Peer">
  <method name="Ping">
  </method>
 </interface>
</node>
org.freedesktop.dbus.exceptions.FatalDBusException: Underlying
transport returned EOF
	at org.freedesktop.dbus.AbstractConnection.readIncoming(Unknown Source)
	at org.freedesktop.dbus.AbstractConnection.access$000(Unknown Source)
	at org.freedesktop.dbus.AbstractConnection$_thread.run(Unknown Source)

Thanks for your help,
Edgar

On Thu, Jan 12, 2012 at 12:34 AM, Matthew Johnson <dbus at matthew.ath.cx> wrote:
> On Wed Jan 11 19:24, Edgar Domingues wrote:
>> Hi,
>>
>> I'm trying to run dbus in java using DirectConnection.
>> The client connects to the server and calls remote methods with no problems.
>> But when I call the disconnect method in the client both Server and
>> Client crashes.
>> I tested my code both in linux and windows and the problem is the same.
>> Code and exception description follows.
>
> Interesting. The exceptions seem like they should be expected - you are,
> indeed, closing the socket and returning EOF. Direct connections aren't the
> primary use case, so are likely to be tested less well. I have a test
> client/server in dbus-java (tests/test-p2p-client and server) which seem to run
> without incident, including calling disconnect in the client.
>
> Can you tell me whether in the top of the source tree you get any errors with:
>
>        make peer-server &
>
>        (wait until it's running)
>
>        make peer-client
>
> I can run this without error, even on TCP, there's no _obvious_ reason yours
> should be different.
>
>> The server exception is:
>> org.freedesktop.dbus.exceptions.FatalDBusException: Underlying
>> transport returned EOF
>>       at org.freedesktop.dbus.AbstractConnection.readIncoming(Unknown Source)
>>       at org.freedesktop.dbus.AbstractConnection.access$000(Unknown Source)
>>       at org.freedesktop.dbus.AbstractConnection$_thread.run(Unknown Source)
>> The client exception is:
>> org.freedesktop.dbus.exceptions.FatalDBusException: Socket closed
>>       at org.freedesktop.dbus.AbstractConnection.readIncoming(Unknown Source)
>>       at org.freedesktop.dbus.AbstractConnection.access$000(Unknown Source)
>>       at org.freedesktop.dbus.AbstractConnection$_thread.run(Unknown Source)
>
> In fact, looking at teh code in AbstractConnection._thread.run, it's all
> wrapped in a try/catch block which will squash the message unless you have
> logging enabled in the library and have DBUS_JAVA_EXCEPTION_DEBUG set in your
> environment, so I'm slightly confused as to why you're getting the exceptions.
> If you have debugging on, then yes, it'll print the exception, but that's
> harmless. If not - I don't see why you should see it.
>
> Matt
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
>
> iQIcBAEBCgAGBQJPDip+AAoJEKVC9ua3o6NmPXgQAIA45EZ4oxoTxhgv/WeYv8sr
> gu4wcTSIi8f2uVDAzRKwTwlm1IkeghruC8+MVmn3hBnnhDKGs5HdsG620cdeTZ8N
> EIDMdOuTNstTnrBL52QRqPf9mqrBr6a2l7LO1L62AnQThI+OVRwcgLOLiSlFrF33
> flTxX8tZuO+TDShrwV2EsF3WSCwx/hWh7Ptsf3kfLqm8qy8afUNwckZJ7zmLKG/F
> /MeNXuM6/+2M/ed8rFijRGD3oTDGlFgE4vAp4TDOxpjmd9DtM15HAOr1Byeu9qd1
> pNJ9i+ZkHuWAlxwwsN5Lj0J7s5gSPIXOjup2HjEBZrIydyIxDog0i3ossH98OL+E
> DaGcslbh/QK2R6kv3aKPS1Y0MGoZNBnu4FkrJ/Qs6+wd+NibhQmA80+LOZc4vntr
> KXEXeuTJwdLpU5d1D9TCdbZ86w8uW6In7uIRTl9bOmjfNU8J06ygP0sJQ1Gfbucr
> 2Qxp9xcITenbb76i/WQSSmGWf9Nh/59xAzqmHtjf1sD8V+U7xbRuymRBupHlso3z
> xz8ldJ2xboJiWk4Hq9f1eAnwZ3gYPtnsZddQrK4BuawrEythE2SbT8shcdcUw5/b
> dxLJWTy/rGEx7C9RLCm4FCee342d4xXCjUA7Vy1zzwPyJ2bCyPtNq53WLx+adQMo
> 0dDKDBfEsdGO5hWosu+x
> =2Z+m
> -----END PGP SIGNATURE-----
>


More information about the dbus mailing list