node-red / node-red/node-red-nodes
Multiple SNMP Triggers Get Grouped Together
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.1k
- Forks
- 612
- Avg merge
- 13h 57m
- Merged PRs (30d)
- 3
Description
Which node are you reporting an issue on?
SNMP
What are the steps to reproduce?
If you send multiple concurrent requests to snmp.subtree the responses will get jumbled up with each other. I've set up a stripped down test set up with docker-compose and a couple of mock snmp servers for testing. I will attach a zip file containing the the docker-compose set up (docker-compose.yaml) and custom walk file that the mock snmp servers use to give their responses (custom.walk). I will also provide an export of the flows. One is to show that initiating 3 requests at the same time results in combined results and the other shows that if you add delay and stagger the requests the debug output is as expected.
Flow Exports
[{"id":"45682656.0f6098","type":"function","z":"42a3b381.5c9fb4","name":"","func":"msg.host = \"snmp2\"\nmsg.community = \"public\"\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":520,"y":180,"wires":[["193500d.d27baff"]]},{"id":"4253c740.d42d28","type":"inject","z":"42a3b381.5c9fb4","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":340,"y":180,"wires":[["20c03f09.051f18","45682656.0f6098","165e9fc2.2fb92"]]},{"id":"193500d.d27baff","type":"snmp subtree","z":"42a3b381.5c9fb4","host":"","community":"","version":"2c","oids":"1.3.6.1.2.1.2.2.1","timeout":5,"name":"","x":1020,"y":320,"wires":[["71fe90dc.ed0cc8"]]},{"id":"20c03f09.051f18","type":"function","z":"42a3b381.5c9fb4","name":"","func":"msg.host = \"snmp1\"\nmsg.community = \"public\"\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":520,"y":100,"wires":[["193500d.d27baff"]]},{"id":"165e9fc2.2fb92","type":"function","z":"42a3b381.5c9fb4","name":"","func":"msg.host = \"snmp3\"\nmsg.community = \"public\"\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":520,"y":260,"wires":[["193500d.d27baff"]]},{"id":"71fe90dc.ed0cc8","type":"debug","z":"42a3b381.5c9fb4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"{\"host\": host, \"payload\": $count(payload)}","targetType":"jsonata","statusVal":"","statusType":"auto","x":1210,"y":320,"wires":[]},{"id":"7b6cf2f9.7383e4","type":"function","z":"42a3b381.5c9fb4","name":"","func":"msg.host = \"snmp2\"\nmsg.community = \"public\"\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":492,"y":460,"wires":[["ab01ea75.44fa"]]},{"id":"3e82457b.649352","type":"inject","z":"42a3b381.5c9fb4","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":312,"y":460,"wires":[["bcb6e309.36e2f","7b6cf2f9.7383e4","5ff15abd.8310d4"]]},{"id":"bcb6e309.36e2f","type":"function","z":"42a3b381.5c9fb4","name":"","func":"msg.host = \"snmp1\"\nmsg.community = \"public\"\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":492,"y":380,"wires":[["a08626b3.4fbf38"]]},{"id":"5ff15abd.8310d4","type":"function","z":"42a3b381.5c9fb4","name":"","func":"msg.host = \"snmp3\"\nmsg.community = \"public\"\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":492,"y":540,"wires":[["198175d6.25bee2"]]},{"id":"a08626b3.4fbf38","type":"delay","z":"42a3b381.5c9fb4","name":"","pauseType":"delay","timeout":"0","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":692,"y":420,"wires":[["193500d.d27baff"]]},{"id":"ab01ea75.44fa","type":"delay","z":"42a3b381.5c9fb4","name":"","pauseType":"delay","timeout":"500","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":690,"y":460,"wires":[["193500d.d27baff"]]},{"id":"198175d6.25bee2","type":"delay","z":"42a3b381.5c9fb4","name":"","pauseType":"delay","timeout":"1000","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":700,"y":500,"wires":[["193500d.d27baff"]]}]
What happens?
The responses from multiple snmp requests get jumbled together
A screenshot below of my example setup. The first 3 log messages are initiated by the top and as you can see snmp1 got the results from all 3 requests. Where the second 3 log messages are initiated by the bottom one and with the delays each snmp request got it's respective data.

What do you expect to happen?
Each snmp request to result in a payload from it's respective request.
Please tell us about your environment:
- Node-RED version: v1.1.3
- node.js version: v10.22.0
- npm version: 6.14.6
- Platform/OS: Docker/Alpine-3.11.6
- Browser: Firefox
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the attached docker-compose.yaml, custom.walk, and the concurrent snmp.subtree flow export to reproduce the request mix-up. Compare concurrent and staggered runs; done means each SNMP request produces a payload containing only its respective response.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker-compose, javascript
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100