Comments (4)
Thanks for your report, I'll take a look this weekend
from modbus.
I'm running into the same problem with the Modbus RTU client. The full stacktrace looks like this:
panic: runtime error: slice bounds out of range
goroutine 6 [running]:
github.com/goburrow/modbus.(*rtuSerialTransporter).Send(0xc42011a008, 0xc42008e188, 0x8, 0x8, 0x0, 0x0, 0x0, 0x0, 0x0)
/home/md/Projects/gosdm630/vendor/src/github.com/goburrow/modbus/rtuclient.go:153 +0x626
github.com/goburrow/modbus.(*client).send(0xc4200c7000, 0xc420440380, 0x2, 0xc42008e180, 0x4)
/home/md/Projects/gosdm630/vendor/src/github.com/goburrow/modbus/client.go:443 +0xaf
github.com/goburrow/modbus.(*client).ReadInputRegisters(0xc4200c7000, 0xc400020020, 0xc42003ada0, 0x42c72e, 0x844d90, 0xa0faa0, 0x808313)
/home/md/Projects/gosdm630/vendor/src/github.com/goburrow/modbus/client.go:143 +0xeb
github.com/gonium/gosdm630.(*ModbusEngine).retrieveOpCode(0xc420073290, 0x200416, 0xc42003aea8, 0x3, 0x3)
/home/md/Projects/gosdm630/src/github.com/gonium/gosdm630/modbus.go:146 +0x93
github.com/gonium/gosdm630.(*ModbusEngine).Transform(0xc420073290, 0xc42006c660, 0xc42006c6c0, 0xc42006c720)
/home/md/Projects/gosdm630/src/github.com/gonium/gosdm630/modbus.go:213 +0x14c
created by main.main.func1
/home/md/Projects/gosdm630/src/github.com/gonium/gosdm630/cmd/sdm630_httpd/main.go:130 +0xa24
This occurs when the RTU connection is faulty, i.e. the line corrupts error messages. The corrupted messages are then shorter/longer as expected by the functionFail code. A length check before assuming 5 bytes to read should solve this.
I tried to capture more debug information (bytes on the wire), but so far I wasn't able to record a sample for this. Sorry!
from modbus.
Thanks, I will fix this issue very soon.
Really sorry for the delay.
from modbus.
I just updated my project with your latest release, and connected my faulty device. I do not see the error, so in my case, your fix worked. Thank you!
from modbus.
Related Issues (20)
- Error: response transaction id does not match request HOT 2
- Use of the library with Raspberry Pi 3 and a MAX13487E that has AutoDirection Control HOT 1
- reading of holding register limited to 125 bytes HOT 3
- illegal function HOT 1
- Is there something like keep alive flag?
- golang >v.1.16.3 couldn't find package serial
- Write registers in parallel over tcp HOT 1
- write negative value. HOT 1
- Error "too many open files" on ReadHoldingRegisters for RTUClient HOT 1
- SYS_IOCTL (RS485): inappropriate ioctl for device HOT 1
- Why serial: timeout HOT 1
- WriteSingleRegister time out, though Python code works HOT 2
- About the functionFail
- How to tell if server closes the connection?
- Interface{} to modbus-compatible slice conversion
- panic due to concurrent closeIdle and Send()
- Modbus read velocity
- protocol error' on CentOS7 Ubantu20.04
- parity bit not working
- The ReadCoils method returned a value that was not expected
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from modbus.