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

Adapter terminating with uncaught exception #88

Closed
ExecuteGK opened this issue Mar 8, 2022 · 5 comments
Closed

Adapter terminating with uncaught exception #88

ExecuteGK opened this issue Mar 8, 2022 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@ExecuteGK
Copy link

Adapter terminates with the following log entry:

RangeError [ERR_OUT_OF_RANGE]: The value of "value" is out of range. It must be >= 0 and <= 4294967295. Received -4034 at checkInt (internal/buffer.js:63:11) at writeU_Int32LE (internal/buffer.js:683:3) at Buffer.writeUInt32LE (internal/buffer.js:696:10) at E3dcRscp.addTagtoFrame (/opt/iobroker/node_modules/iobroker.e3dc-rscp/main.js:585:11) at E3dcRscp.queueSetValue (/opt/iobroker/node_modules/iobroker.e3dc-rscp/main.js:917:9) at E3dcRscp.onStateChange (/opt/iobroker/node_modules/iobroker.e3dc-rscp/main.js:1749:11) at E3dcRscp.emit (events.js:310:20) at Immediate._onImmediate (/opt/iobroker/node_modules/@iobroker/js-controller-adapter/build/lib/adapter/adapter.js:5379:53) at processImmediate (internal/timers.js:456:21)

Proper error handling should be introduced in order to ignore illegal values and keep the adapter running.

Regards,

Sebastian

@git-kick
Copy link
Owner

git-kick commented Mar 9, 2022

@ExecuteGK thank you for the bug report.
Please provide the adapter version, so I can match the source code line numbers.
(Best practice is to use the Bug Report template for reporting problems.)

@git-kick git-kick self-assigned this Mar 9, 2022
@git-kick git-kick added the bug Something isn't working label Mar 9, 2022
@ExecuteGK
Copy link
Author

Hi,

the version is 1.0.1.
Issue was caused by writing a wrong value into one of the objects. Although the javascript doing that has been fixed, the adapter should perform input validation at least for any external provided data. Best practice is to verify the input and return a save default value in case the input is out of bounds.

@git-kick
Copy link
Owner

Okay @ExecuteGK ,
I understand you can reproduce the issue.
Would you please provide the steps, i.e. the object, the value entered.

@ExecuteGK
Copy link
Author

On my instance, it was: e3dc-rscp.0.EMS.MAX_DISCHARGE_POWER

It should be an easy fix. Default value could be 0 in case a negative value is dropped in here.

Regards,

Sebastian

@git-kick
Copy link
Owner

Will be fixed in v1.0.3
You can preview it now in the master branch

Like suggested above, out-of-range values are silently replaced by 0 (or "" in case of strings).
This "correction" is not visible in the object tree unless the response from E3/DC was processed, but I consider this acceptable in case of invalid input.
(For a "clean" solution we would need a state-specific handling, which I think is not worth of.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants