gos7 icon indicating copy to clipboard operation
gos7 copied to clipboard

When calling the PLCGetStatus method, an occasional panic of array out-of-bounds occurs.

Open Ethanim opened this issue 8 months ago • 2 comments

Hello, the project is running, and occasionally a panic of array out-of-bounds occurs when calling the PLCGetStatus method. I wonder why this happens. Could you please help me figure it out?  runtime error: index out of range [44] with length 35 goroutine 868489 [running]: panic({0x117a1a0, 0xc007906780}) /usr/local/go/src/runtime/panic.go:884 +0x213 github.com/robinson/gos7.(*client).PLCGetStatus(0x1bacda0?) /go/src/xxx/vendor/github.com/robinson/gos7/control.go:97 +0x21e xxx/conn.GetS7Conn(0xc006973870?, {0xc00b6a50c3, 0x12}, {0x1208a2f, 0x7}) /go/src/xxx/conn/s7.go:72 +0x1d3

Ethanim avatar Jun 04 '25 06:06 Ethanim

what is your initial configuration?

robinson avatar Jun 04 '25 07:06 robinson

My configuration is as follows, it can run normally, but occasionally it will report this panic

newHandler = gos7.NewTCPClientHandler(address, 0, 1) newHandler.Timeout = time.Duration(500) * time.Millisecond newHandler.Connect() conn.Handler = newHandler client := gos7.NewClient(newHandler)

Ethanim avatar Jun 04 '25 08:06 Ethanim