node-red-nodes icon indicating copy to clipboard operation
node-red-nodes copied to clipboard

SNMP get: Read integer 3579457891 is outside the signed 32-bit range

Open Sergio-tix opened this issue 3 years ago • 6 comments

Which node are you reporting an issue on?

  • node-red-node-snmp v1.0.5 (SNMP Get)

What are the steps to reproduce?

  • Reading SMART SSD, parameter № 241 "Total_LBAs_Written"

What happens?

  • I get an error: "RangeError: Read integer 3579457891 is outside the signed 32-bit range"

What do you expect to happen?

  • I want to get the real value which is "12150544793". In the future, this value may increase by one more digit.

Please tell us about your environment:

  • [ ] Node-RED version: 3.0.2
  • [ ] node.js version: 18.12.1
  • [ ] npm version: 9.0.2
  • [ ] Platform/OS: Synology (DVA1622 DSM v.7.1.1 ) Docker - Ubuntu 20.04.5 LTS
  • [ ] Browser: Google Chrome 108.0.5359.125, x64

Need to change the type of the variable to get huge numbers.

Sergio-tix avatar Jan 11 '23 07:01 Sergio-tix

can you attach a copy of the node-red log file - that should also show the error with a bit more context. Certainly a signed 32 bit Int can't be greater than about 2.1 million so it is correct in what it is reporting ... but it's not clear if it's the snmp library or something we are doing with it afterwards.

dceejay avatar Jan 11 '23 09:01 dceejay

The node-red LOG has exactly the same information and nothing more: SNMP Get 2

SNMP Get

[{"id":"31d93ddc.b29162","type":"snmp","z":"975b3811b4e20b9b","host":"192.168.15.5","version":"1","timeout":5,"community":"public","auth":"noAuthNoPriv","authprot":"MD5","privprot":"DES","oids":"1.3.6.1.4.1.6574.5.1.1.8.14\n","name":"","credentials":{},"x":1290,"y":240,"wires":[["279326ae.a27b6a"]]},{"id":"40af2498.6eaf7c","type":"inject","z":"975b3811b4e20b9b","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":1130,"y":240,"wires":[["31d93ddc.b29162"]]},{"id":"279326ae.a27b6a","type":"debug","z":"975b3811b4e20b9b","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1470,"y":240,"wires":[]}]

ssd SMART ssd

test01_nodered (1).csv

UPD And here is a log from another system. Raspberry Pi 3b, NodeRED v 1.3.7

<html>
<body>
<!--StartFragment-->

2023-01-11 14:08:21.899 - error: node-red.0 (1351) 11 Jan 14:08:21 - [error] [snmp:31d93ddc.b29162] RangeError: Read integer 3582748741 is outside the signed 32-bit range
--
at readInt32 (/opt/iobroker/iobroker-data/node-red/node_modules/net-snmp/index.js:401:9)
at readVarbindValue (/opt/iobroker/iobroker-data/node-red/node_modules/net-snmp/index.js:438:11)
at readVarbinds (/opt/iobroker/iobroker-data/node-red/node_modules/net-snmp/index.js:493:15)
at GetResponsePdu.SimpleResponsePdu.initializeFromBuffer (/opt/iobroker/iobroker-data/node-red/node_modules/net-snmp/index.js:827:2)
at Function.GetResponsePdu.createFromBuffer (/opt/iobroker/iobroker-data/node-red/node_modules/net-snmp/index.js:845:6)
at readPdu (/opt/iobroker/iobroker-data/node-red/node_modules/net-snmp/index.js:886:24)
at Function.Message.createFromBuffer (/opt/iobroker/iobroker-data/node-red/node_modules/net-snmp/index.js:1667:17)
at Session.onMsg (/opt/iobroker/iobroker-data/node-red/node_modules/net-snmp/index.js:2116:25)
at Socket.emit (events.js:315:20)
at UDP.onMessage [as onmessage] (dgram.js:910:8)
2023-01-11 14:08:26.831 - error: node-red.0 (1351) 11 Jan 14:08:26 - [error] [snmp:31d93ddc.b29162] RangeError: Read integer 3582748741 is outside the signed 32-bit range
at readInt32 (/opt/iobroker/iobroker-data/node-red/node_modules/net-snmp/index.js:401:9)
at readVarbindValue (/opt/iobroker/iobroker-data/node-red/node_modules/net-snmp/index.js:438:11)
at readVarbinds (/opt/iobroker/iobroker-data/node-red/node_modules/net-snmp/index.js:493:15)
at GetResponsePdu.SimpleResponsePdu.initializeFromBuffer (/opt/iobroker/iobroker-data/node-red/node_modules/net-snmp/index.js:827:2)
at Function.GetResponsePdu.createFromBuffer (/opt/iobroker/iobroker-data/node-red/node_modules/net-snmp/index.js:845:6)
at readPdu (/opt/iobroker/iobroker-data/node-red/node_modules/net-snmp/index.js:886:24)
at Function.Message.createFromBuffer (/opt/iobroker/iobroker-data/node-red/node_modules/net-snmp/index.js:1667:17)
at Session.onMsg (/opt/iobroker/iobroker-data/node-red/node_modules/net-snmp/index.js:2116:25)
at Socket.emit (events.js:315:20)
at UDP.onMessage [as onmessage] (dgram.js:910:8)
2023-01-11 14:08:31.808 - error: node-red.0 (1351) 11 Jan 14:08:31 - [error] [snmp:31d93ddc.b29162] RequestTimedOutError: Request timed out

<!--EndFragment-->
</body>
</html>

Sergio-tix avatar Jan 11 '23 11:01 Sergio-tix

Yes I think it may well be an error in the MIB definition of your device eg https://www.reddit.com/r/synology/comments/q2x7bv/synology_smart_mib_oid_13614165745_uses_only/ So not much we can do about it, as the type is defined as a 32bit integer and indeed that number is too large. You could possibly riase an issue on the net-snmp project to ask if they could try to automatically handle it as indeed they are printing out the value in the error message but it would be a hacky way around it to redefine the type - so they may well not wish to do so.

dceejay avatar Jan 11 '23 11:01 dceejay

erf Yes. Apparently this is a Synology bug. I am 100% sure of this, I have been using their products for a long time. This bug will not be fixed soon. But in any case, even if Synology fixes the problem, the node will still not accept this value. We need to fix the node so that it is ready to accept large numbers. INTEGER64 would be enough for a long time. I went to write in support of Synology.

Sergio-tix avatar Jan 11 '23 12:01 Sergio-tix