vapor-ware / synse-modbus-ip-plugin

Modbus over TCP/IP plugin for Synse
GNU General Public License v3.0
2 stars 3 forks source link

Panic appending nil reading on image 2.0.6 #64

Open MatthewHink opened 4 years ago

MatthewHink commented 4 years ago

As usual there are at least two issues here. First off we are getting no reading from the device for some reason. Second is that a plugin cannot currently append a nil reading to a read context in synse v3 as in v2.

The panic is happening here in the scheduler since rctx.Reading is nil there is no rtcx.Reading.Value. https://github.com/vapor-ware/synse-sdk/blob/daad6cb4f63a975772e0584783ca7c7e5e6823f6/sdk/scheduler.go#L487

Logs:

modbus-panic-logs.txt

TODO:

MatthewHink commented 4 years ago

Have test updates where we make and test for a reading with a nil value (nil reading is an error). We didn't get data from the vsm controller on the pass in the log. The command line tool is getting data right now, so it could be a blip.

Took a look in the scheduler and I don't think we will need the nil check mentioned above to get modbus up now.

I did see this in the scheduler where it looks like bulk read is done in parallel for each handler. https://github.com/vapor-ware/synse-sdk/blob/daad6cb4f63a975772e0584783ca7c7e5e6823f6/sdk/scheduler.go#L338-L347

This could be an issue because there will be parallel reads on read_only_coils/coils and read_only_holding_register/holding_register and the modbus devices may not be able to handle that load. For now my proposal is to try it out, and if it's a problem, that is the next thing to look at.

Going to get a patch together.