Buffered Socket#close
may not return if TCP send buffer is full
#15129
Labels
Socket#close
may not return if TCP send buffer is full
#15129
Bug Report
In LavinMQ it's possible to force close client connections from the broker via the HTTP API. Today I stumbled over a bug where the HTTP request timed out, and after digging my conclusion is that it's because
Socket#close
never returned.In this particular case it was a client that didn't process the messages LavinMQ sent to it, causing the TCP send buffer to fill up. The reason
Socket#close
doesn't return is because the write buffer inSocket
contains data that#close
wants to flush, which is impossible because the TCP buffer is full.My first attempt was to use
Buffered#unbuffered_close
which as a first glance sounded like a solution, butSocket
implement it as private. Instead i could useSocket#write_close
.PoC:
Dunno if this should be treated as a bug, or a missing feature?
Maybe a
#close(flush : Bool = true)
is needed?The text was updated successfully, but these errors were encountered: