Coder Social home page Coder Social logo

Comments (4)

nqv avatar nqv commented on June 22, 2024

Thanks for your report, I'll take a look this weekend

from modbus.

gonium avatar gonium commented on June 22, 2024

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.

nqv avatar nqv commented on June 22, 2024

Thanks, I will fix this issue very soon.
Really sorry for the delay.

from modbus.

gonium avatar gonium commented on June 22, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.