Shouqun / node-dbus

dbus module for node
MIT License
150 stars 70 forks source link

Re-creating bus results in 'No Introspectable' #206

Open telphan opened 5 years ago

telphan commented 5 years ago

Here is a little example code that I use:

d = require('.')
b = d.getBus('system')
b.getInterface('org.freedesktop.NetworkManager', '/org/freedesktop/NetworkManager/Settings',  'org.freedesktop.NetworkManager.Settings', console.log)
a = d.getBus('system')
a.getInterface('org.freedesktop.NetworkManager', '/org/freedesktop/NetworkManager/Settings',  'org.freedesktop.NetworkManager.Settings', console.log)

The first getInterface call returns successfully with the dbus object, but if I try to getBus again it results in 'No Introspectable', the real error being:

{ Error: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
    at new DBusError (/home/telphan/scratchpad/node-dbus/lib/error.js:9:9)
    at createError (/home/telphan/scratchpad/node-dbus/lib/bus.js:242:9)
  message:
   'Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.',
  dbusName: 'org.freedesktop.DBus.Error.NoReply' }

Calling disconnect() between the two getBus does not help either.

The following snippet also results in the same error:

d = require('.')
b = d.getBus('system')
b.reconnect()
b.getInterface('org.freedesktop.NetworkManager', '/org/freedesktop/NetworkManager/Settings',  'org.freedesktop.NetworkManager.Settings', console.log)

Any reason for this?

jfether commented 4 years ago

Duplicate of #183.

qubiack commented 4 years ago

Try to run this in your terminal:

qdbus org.freedesktop.NetworkManager /org/freedesktop/NetworkManager/Settings

Do you get any response? If not, probably you try to use inaccessible resources.