You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've found a bug that can cause a panic. I was able to trigger this by having Dataplane API sync map files while another external process was restarting HAProxy. If I was correct in my reading of the code the cause here is that client-native is reading from a socket and the connection is lost when HAProxy restarts. Because the data is not validated as complete it is then returned and failed to be parsed correctly by other functions.
Setup
A process (Dataplane API) using client-native to read from a socket.
A process that restarts HAProxy
Problem
panic: runtime error: index out of range [2] with length 2
goroutine 503 [running]:
github.com/haproxytech/client-native/v2/runtime.parseMapEntry(0xc005147871, 0x10, 0xc01, 0xc001a99f80)
/home/mjuraga/projects/go/pkg/mod/github.com/haproxytech/client-native/[email protected]/runtime/maps.go:171 +0x226
github.com/haproxytech/client-native/v2/runtime.ParseMapEntries(0xc005112001, 0x35880, 0x1, 0xc005112001, 0x35880, 0x0)
/home/mjuraga/projects/go/pkg/mod/github.com/haproxytech/client-native/[email protected]/runtime/maps.go:148 +0x10b
github.com/haproxytech/client-native/v2/runtime.(*SingleRuntime).ShowMapEntries(0xc000c4fe30, 0xc0010f8388, 0x3, 0xc0010f8388, 0x3, 0x0, 0x0, 0x47c762)
/home/mjuraga/projects/go/pkg/mod/github.com/haproxytech/client-native/[email protected]/runtime/maps.go:133 +0x1ba
github.com/haproxytech/client-native/v2/runtime.(*Client).ShowMapEntries(0xc002fc3d10, 0xc0010f8388, 0x3, 0x1, 0x1, 0xc0010f8388, 0x3, 0x24)
/home/mjuraga/projects/go/pkg/mod/github.com/haproxytech/client-native/[email protected]/runtime/runtime_client.go:493 +0x38d
github.com/haproxytech/dataplaneapi.syncMapFilesToRuntimeEntries(0xc002135920, 0xc001e96fa0)
/home/mjuraga/projects/haproxytech/release/dataplaneapi/configure_data_plane.go:806 +0x189
created by github.com/haproxytech/dataplaneapi.syncMaps
/home/mjuraga/projects/haproxytech/release/dataplaneapi/configure_data_plane.go:788 +0xbe
The text was updated successfully, but these errors were encountered:
jaredcurtis
added a commit
to jaredcurtis/client-native
that referenced
this issue
Sep 21, 2020
It's possible if an external process causes a reload/restart of HAProxy
that the data from the socket will be truncated. If it is not trucated
on a new line then other functions processing the results will have
malformed data and likely cause a panic.
Resolveshaproxytech#44
It's possible if an external process causes a reload/restart of HAProxy
that the data from the socket will be truncated. If it is not trucated
on a new line then other functions processing the results will have
malformed data and likely cause a panic.
Resolveshaproxytech#44
Description
Hello,
I've found a bug that can cause a panic. I was able to trigger this by having Dataplane API sync map files while another external process was restarting HAProxy. If I was correct in my reading of the code the cause here is that
client-native
is reading from a socket and the connection is lost when HAProxy restarts. Because the data is not validated as complete it is then returned and failed to be parsed correctly by other functions.Setup
client-native
to read from a socket.Problem
The text was updated successfully, but these errors were encountered: