Skip to content

Some error responses from dbus get silently ignored #284

@Chris927

Description

@Chris927

Describe the bug

When receiving error responses via dbus, we silently ignore (some of) them.

To Reproduce

Steps to reproduce the behavior:

  1. Apply the patches below, which log such errors instead of ignoring them.
  2. Restart node-red.
  3. Check the logs (/var/log/node-red-venus/current if on Venus OS)

Expected behavior

For services where GetValue on /DeviceInstance is rightfully not available, we should not make the call.

Flow

Happens with any flow, flow can be empty.

Hardware:

  • Hardware: I tested on a Cerbo GX, but it should not matter.

Software:

  • node-red-contrib-victron version: current master
  • Venus OS version: V3.66 and V3.70

Additional context

Patch:

diff --git a/src/services/dbus-listener.js b/src/services/dbus-listener.js
index c24ecc4..1b4091d 100644
--- a/src/services/dbus-listener.js
+++ b/src/services/dbus-listener.js
@@ -188,7 +188,7 @@ class VictronDbusListener {
         }
       }
       if (err && err.length > 0) {
-        debug(`initService ${name} : ${err}`)
+        console.warn(`initService ${name}, unable to GetValue on /DeviceInstance: ${err}`)
       }
     })
     this._requestRoot(service)
@@ -354,6 +354,8 @@ class VictronDbusListener {
           senderName: destination,
           value: res[1][0]
         }])
+      } else {
+        console.warn(`Error getting value for ${destination}, ${path}, IGNORING: ${err}`)
       }
     })
   }

I also patched dbus-native-victron, to show the full error message there:

diff --git a/lib/bus.js b/lib/bus.js
index dd5f8a8..e899b53 100644
--- a/lib/bus.js
+++ b/lib/bus.js
@@ -97,6 +97,11 @@ module.exports = function bus(conn, opts) {

   // route reply/error
   this.connection.on('message', function(msg) {
+
+    if (msg && msg.errorName) {
+      console.error('DBUS ERROR MESSAGE', msg);
+    }
+
     function invoke(impl, func, resultSignature) {
       Promise.resolve()
         .then(function() {

Logs:

...
Polling is disabled. All roots have been requested once successfully.
DBUS ERROR MESSAGE {
  serial: 118173,
  destination: ':1.5513',
  errorName: 'org.freedesktop.DBus.Error.UnknownObject',
  replySerial: 18,
  signature: 's',
  sender: ':1.39',
  type: 3,
  flags: 1,
  body: [
    `Method "GetValue" with signature "" on interface "com.victronenergy.BusItem" doesn't exist\n`
  ]
}
initService com.victronenergy.settings, unable to GetValue on /DeviceInstance: Method "GetValue" with signature "" on interface "com.victronenergy.BusItem" doesn't exist

DBUS ERROR MESSAGE {
  serial: 44271,
  destination: ':1.5513',
  errorName: 'org.freedesktop.DBus.Error.UnknownObject',
  replySerial: 20,
  sender: ':1.56',
  type: 3,
  flags: 1
}
DBUS ERROR MESSAGE {
  serial: 15515,
  destination: ':1.5513',
  errorName: 'org.freedesktop.DBus.Error.UnknownObject',
  replySerial: 30,
  signature: 's',
  sender: ':1.36',
  type: 3,
  flags: 1,
  body: [
    `Method "GetValue" with signature "" on interface "com.victronenergy.BusItem" doesn't exist\n`
  ]
}
initService com.victronenergy.digitalinputs, unable to GetValue on /DeviceInstance: Method "GetValue" with signature "" on interface "com.victronenergy.BusItem" doesn't exist

DBUS ERROR MESSAGE {
  serial: 15534,
  destination: ':1.5513',
  errorName: 'org.freedesktop.DBus.Error.UnknownObject',
  replySerial: 32,
  signature: 's',
  sender: ':1.63',
  type: 3,
  flags: 1,
  body: [
    `Method "GetValue" with signature "" on interface "com.victronenergy.BusItem" doesn't exist\n`
  ]
}
initService com.victronenergy.modbusclient.tcp, unable to GetValue on /DeviceInstance: Method "GetValue" with signature "" on interface "com.victronenergy.BusItem" doesn't exist

DBUS ERROR MESSAGE {
  serial: 15517,
  destination: ':1.5513',
  errorName: 'org.freedesktop.DBus.Error.UnknownObject',
  replySerial: 34,
  sender: ':1.71',
  type: 3,
  flags: 1
}
DBUS ERROR MESSAGE {
  serial: 17399,
  destination: ':1.5513',
  errorName: 'org.freedesktop.DBus.Error.UnknownObject',
  replySerial: 36,
  signature: 's',
  sender: ':1.77',
  type: 3,
  flags: 1,
  body: [
    `Method "GetValue" with signature "" on interface "com.victronenergy.BusItem" doesn't exist\n`
  ]
}
initService com.victronenergy.logger, unable to GetValue on /DeviceInstance: Method "GetValue" with signature "" on interface "com.victronenergy.BusItem" doesn't exist

DBUS ERROR MESSAGE {
  serial: 15517,
  errorName: 'org.freedesktop.DBus.Error.UnknownObject',
  destination: ':1.5513',
  replySerial: 26,
  signature: 's',
  sender: ':1.51',
  type: 3,
  flags: 1,
  body: [ "No such object path '/DeviceInstance'" ]
}
initService com.victronenergy.fronius, unable to GetValue on /DeviceInstance: No such object path '/DeviceInstance'
DBUS ERROR MESSAGE {
  serial: 15534,
  errorName: 'org.freedesktop.DBus.Error.UnknownObject',
  destination: ':1.5513',
  replySerial: 40,
  signature: 's',
  sender: ':1.75',
  type: 3,
  flags: 1,
  body: [ "No such object path '/DeviceInstance'" ]
}
initService com.victronenergy.modbustcp, unable to GetValue on /DeviceInstance: No such object path '/DeviceInstance'
DBUS ERROR MESSAGE {
  serial: 15515,
  destination: ':1.5513',
  errorName: 'org.freedesktop.DBus.Error.UnknownObject',
  replySerial: 38,
  sender: ':1.47',
  type: 3,
  flags: 1
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions