I have a problem with a data race in the GoSNMPServer during shutdown. This happens pretty reproducible in my test code.
Ideally the Shutdown method would interrupt the ServeNextRequest method before closing the udp connection.
Alternatively adding a context to ServeForever and/or ServeNextRequest to stop them via context close would enable me to work around this issue.
Relevant data race output:
==================
WARNING: DATA RACE
Read at 0x00c000012258 by goroutine 13:
github.com/slayercat/GoSNMPServer.(*UDPListener).NextSnmp()
/path/github.com/slayercat/!go!s!n!m!p!server@v0.5.0/interfaceListener.go:47 +0x6d
github.com/slayercat/GoSNMPServer.(*SNMPServer).ServeNextRequest()
/path/github.com/slayercat/!go!s!n!m!p!server@v0.5.0/snmpserver.go:81 +0xc1
github.com/slayercat/GoSNMPServer.(*SNMPServer).ServeForever()
/path/github.com/slayercat/!go!s!n!m!p!server@v0.5.0/snmpserver.go:54 +0x118
[REDACTED]
Previous write at 0x00c000012258 by goroutine 9:
github.com/slayercat/GoSNMPServer.(*UDPListener).Shutdown()
/path/github.com/slayercat/!go!s!n!m!p!server@v0.5.0/interfaceListener.go:61 +0x51
github.com/slayercat/GoSNMPServer.(*SNMPServer).Shutdown()
/path/github.com/slayercat/!go!s!n!m!p!server@v0.5.0/snmpserver.go:44 +0x96
[REDACTED]
I have a problem with a data race in the
GoSNMPServerduring shutdown. This happens pretty reproducible in my test code.Ideally the Shutdown method would interrupt the
ServeNextRequestmethod before closing the udp connection.Alternatively adding a context to
ServeForeverand/orServeNextRequestto stop them via context close would enable me to work around this issue.Relevant data race output: