Open aathan opened 1 year ago
I have also been having issues with wsutil
functions blocking forever. I have yet to determine the cause.
There is a HTTPUpgrader.Timeout
field which sets timeout for the dial. Is this you're asking for?
No.
In some applications we wish to control the amount of time we wait for a message to be read or written. At the lowest level this means setting the read/write deadline on the read/write calls to the underlying socket.
Unfortunately, golang in general does not expose this stuff in a very useful way, but the current design of gobwas makes it painful to implement this stuff. E.g., you have to launch a new goroutine to do the gobwas read and write the result to a channel; then you have to select the channel along with a new timeout context.Done() and if the context completes before the gobwas read, you abort the operation.
It's a lot of extra processing just to have timeouts on the read/write calls.
On 5/24/23 6:58 AM, Oleg Kovalov wrote:
There is a |HTTPUpgrader.Timeout| field which sets timeout for the dial. Is this you're asking for?
— Reply to this email directly, view it on GitHub https://github.com/gobwas/ws/issues/156#issuecomment-1561213538, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFZHTCZK7SFHNFDURCNIILTXHYHXTANCNFSM6AAAAAASGFOW3I. You are receiving this because you authored the thread.Message ID: @.***>
The issue appears only when using SetReadTimeout
on a conn from ws.Dialer
, regardless whether it produced a tls.Conn
or a *net.TCPConn
. Nasty bug, without an error.
Using SetTimeout
work fine with Go 1.22 on Darwin/ARM64.
Setting the timer can only be done once. Any update silently disables/breaks the functionality, whether disabled with a zero time.Time
or a time in the past, or a time in the future.
The follow is not clear from the documentation and not immediately apparent in the code:
Does this ws library respect the HttpServer WriteTimeout & other timeouts set on the writer that is upgraded to a gobwas/ws ?
If not, can this be added as a feature? Implementing timeouts externally is possible but wordy.
E.g. Specifically if WriteServerMessage() is called, will it block forever if the underlying transport is blocked?