dolthub / go-mysql-server

A MySQL-compatible relational database with a storage agnostic query engine. Implemented in pure Go.
Apache License 2.0
2.37k stars 211 forks source link

internal/sockstate: Restore connection checking on Linux. #2722

Closed reltuk closed 1 month ago

reltuk commented 1 month ago

GMS server handler is supposed to cancel running queries if the connection which issued them goes away. It does this by checking the connection state out-of-band anytime the query is running and canceling theh query if the connection goes away. The connection checking code is platform-specific and currently only works on Linux.

In commit 538696b2c943ac7f3cacf1b67a3a5ff40ae64a00 I introduced a bug where the connection checking code tries to inspect the socket state of an already closed file descriptor. This change fixes the behavior so that the file descriptor is left open until the necessary socket state is extracted.