Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught exception: Cannot read property 'from' of null #45

Closed
tnowak opened this issue Apr 27, 2021 · 2 comments · Fixed by #46
Closed

Uncaught exception: Cannot read property 'from' of null #45

tnowak opened this issue Apr 27, 2021 · 2 comments · Fixed by #46

Comments

@tnowak
Copy link

tnowak commented Apr 27, 2021

I found out that something is crashing my mqtt-client adapter. Here's the log:

host.a54f0d9ed4df | 2021-04-27 23:30:58.306 | info | Restart adapter system.adapter.mqtt-client.0 because enabled
-- | -- | -- | --
host.a54f0d9ed4df | 2021-04-27 23:30:58.304 | error | instance system.adapter.mqtt-client.0 terminated with code 6 (UNCAUGHT_EXCEPTION)
mqtt-client.0 | 2021-04-27 23:30:57.701 | warn | (29453) Terminated (UNCAUGHT_EXCEPTION): Without reason
mqtt-client.0 | 2021-04-27 23:30:57.469 | error | (29453) Cannot read property 'from' of null
mqtt-client.0 | 2021-04-27 23:30:57.468 | error | at processImmediate (internal/timers.js:461:21)
mqtt-client.0 | 2021-04-27 23:30:57.468 | error | at Immediate.<anonymous> (/opt/iobroker/node_modules/iobroker.js-controller/lib/adapter.js:5559:38)
mqtt-client.0 | 2021-04-27 23:30:57.468 | error | at MqttClient.emit (events.js:314:20)
mqtt-client.0 | 2021-04-27 23:30:57.468 | error | at MqttClient.onStateChange (/opt/iobroker/node_modules/iobroker.mqtt-client/main.js:597:11)
mqtt-client.0 | 2021-04-27 23:30:57.468 | error | (29453) TypeError: Cannot read property 'from' of null
mqtt-client.0 | 2021-04-27 23:30:57.445 | error | (29453) uncaught exception: Cannot read property 'from' of null
mqtt-client.0 | 2021-04-27 23:30:36.348 | warn | (29453) adapter.objects.getObjectView is deprecated, and will be removed in the future. Please use adapter.getObjectView/Async. Report this to Developer!
host.a54f0d9ed4df | 2021-04-27 23:30:34.408 | info | instance system.adapter.mqtt-client.0 started with pid 29453

This happens on an object from Zwave2 adapter, from Fibaro Dimmer, from object Scene_Activation.SceneId"

  "from": "system.adapter.zwave2.0",
  "user": "system.user.admin",
  "ts": 1619558168447,
  "common": {
    "name": "Scene ID",
    "role": "level",
    "type": "number",
    "min": 1,
    "max": 255,
    "read": true,
    "write": true
  },
  "native": {
    "nodeId": 14,
    "valueId": {
      "commandClass": 43,
      "endpoint": 0,
      "property": "sceneId"
    }
  },
  "acl": {
    "object": 1636,
    "owner": "system.user.admin",
    "ownerGroup": "system.group.administrator",
    "state": 1636
  },
  "_id": "zwave2.0.Node_014.Scene_Activation.sceneId",
  "type": "state"
}

Depending on how many click you make on the device switch, the value becomes an integer for instance 24 or 26, but only for a second. Then it the object value go backs to null. And I suppose that crashes mqtt-client.

Is there any quick fix for that?

PS. I'm on version 1.3.1

@tnowak tnowak changed the title uncaught exception: Cannot read property 'from' of null Uncaught exception: Cannot read property 'from' of null Apr 27, 2021
@Apollon77
Copy link
Member

yes, missing error handling. formally state can be empty when gets deleted. this check needs to be added

@tnowak
Copy link
Author

tnowak commented Apr 28, 2021

I confirm the fix works (no mqtt-client crashes anymore on objects going stateless)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants