pires / go-proxyproto

A Go library implementation of the PROXY protocol, versions 1 and 2.
Apache License 2.0
478 stars 107 forks source link

Crashes can occur in high concurrency scenarios #101

Open athenakia opened 1 year ago

athenakia commented 1 year ago

Hello, I add go-proxyproto as a dependency in the server side of a VPN project. When the number of connections is high, it tends to crash. Here is the error message:

May 11 13:57:35 xxxhostname xxxappname: goroutine 1520070 [runnable]:
May 11 13:57:35 xxxhostname xxxappname: internal/poll.runtime_pollWait(0x7fd92f37bf40, 0x72)
May 11 13:57:35 xxxhostname xxxappname: runtime/netpoll.go:305 +0x89
May 11 13:57:35 xxxhostname xxxappname: internal/poll.(*pollDesc).wait(0xc009a02100?, 0xc0034db000?, 0x0)
May 11 13:57:35 xxxhostname xxxappname: internal/poll/fd_poll_runtime.go:84 +0x32
May 11 13:57:35 xxxhostname xxxappname: internal/poll.(*pollDesc).waitRead(...)
May 11 13:57:35 xxxhostname xxxappname: internal/poll/fd_poll_runtime.go:89
May 11 13:57:35 xxxhostname xxxappname: internal/poll.(*FD).Read(0xc009a02100, {0xc0034db000, 0x1000, 0x1000})
May 11 13:57:35 xxxhostname xxxappname: internal/poll/fd_unix.go:167 +0x25a
May 11 13:57:35 xxxhostname xxxappname: net.(*netFD).Read(0xc009a02100, {0xc0034db000?, 0xc00a66f3a0?, 0x40d75d?})
May 11 13:57:35 xxxhostname xxxappname: net/fd_posix.go:55 +0x29
May 11 13:57:35 xxxhostname xxxappname: net.(*conn).Read(0xc002f11e48, {0xc0034db000?, 0x7fd956a815b8?, 0x1000?})
May 11 13:57:35 xxxhostname xxxappname: net/net.go:183 +0x45
May 11 13:57:35 xxxhostname xxxappname: bufio.(*Reader).Read(0xc004ed8cc0, {0xc0034db000, 0x1000, 0x1000?})
May 11 13:57:35 xxxhostname xxxappname: bufio/bufio.go:223 +0x106
May 11 13:57:35 xxxhostname xxxappname: github.com/pires/go-proxyproto.(*Conn).Read(0xc0001229a0?, {0xc0034db000?, 0xbe14bf?, 0x7ddf8402d9f34adb?})
May 11 13:57:35 xxxhostname xxxappname: github.com/pires/go-proxyproto@v0.6.2/protocol.go:132 +0xa5
...stack trace in xxxappname...
athenakia commented 1 year ago

The version I used is github.com/pires/go-proxyproto@v0.6.2. Is this problem solved now? I have upgraded to the new version of dependency, but this problem is difficult to repeat, so it is difficult to test.

pires commented 1 year ago

This is not enough information to understand why your app crashes but I don't think it's because of go-proxyproto. For instance, in this goroutine, *Conn.Read(...) called poll.runtime_pollWait(...) and seems to be waiting for data to be received. Maybe your app is crashing elsewhere? You need to debug your stacktrace.