From 90e7dffb1349fdaa1cc883bc8d97e2067f21a3be Mon Sep 17 00:00:00 2001 From: Shulhan Date: Mon, 10 Oct 2022 16:02:15 +0700 Subject: Release share v0.41.2 (2022-10-10) === Bug fixes * lib/websocket: check for EAGAIN and EINTR when reading raw socket * lib/websocket: fix possible data race on Client === Enhancements * lib/websocket: cleanup the channel gracefulClose during Close === Chores * lib/websocket: replace handleInvalidData and BadRequest with sendClose * lib/websocket: rewords some comment and package documentation --- CHANGELOG.adoc | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ share.go | 2 +- 2 files changed, 64 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index dc762791..e686cc41 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -17,6 +17,69 @@ link:CHANGELOG_2018-2019.html[Changelog from 2018 to 2019^]. This is changelog for share module since v0.1.0 until v0.11.0. +[#v0_41_2] +== share v0.41.2 (2022-10-10) + +[#v0_41_2_bug_fixes] +=== Bug fixes + +lib/websocket: check for EAGAIN and EINTR when reading raw socket:: ++ +-- +This fix tests that sometimes fail when running with -count=X, where +X > 1, + + $ go test -race -count=30 -timeout=30s ./lib/websocket + +Upon inspecting, when client sending larger payload, for example +65536 bytes, server sometimes only read half of them and return an +error "resource temporarily unavailable" or +"interrupted system call". +-- + +lib/websocket: fix possible data race on Client:: ++ +-- +The Client have method send that check if the underlying connection (conn) +has been closed or not. +Since the conn can be closed anytime, for example server send to the +control CLOSE frame: + + recv -> handleFrame -> handleClose -> Quit + +we need to guard the conn with Mutex before calling send to prevent +data race. +-- + +[#v0_41_2_enhancements] +=== Enhancements + +lib/websocket: cleanup the channel gracefulClose during Close:: ++ +-- +When calling Close, we initialize the internal channel gracefulClose +so the client can check the close response from server on another +goroutine serve() and signal back to Close to continue the closing +process. + +This channel is never closed and nil-ed again after Close which +may cause resource leaks. + +While at it, use sendClose to minimize duplicate code. +-- + +[#v0_41_2_chores] +=== Chores + +lib/websocket: replace handleInvalidData and BadRequest with sendClose:: ++ +Both of those functions actually call send control CLOSE frame and not +exported. +So, instead of duplicating it, we replace it with sendClose. + +lib/websocket: rewords some comment and package documentation:: + + [#v0_41_1] == share v0.41.1 (2022-10-07) diff --git a/share.go b/share.go index 8b8a8ea1..a8372652 100644 --- a/share.go +++ b/share.go @@ -8,5 +8,5 @@ package share var ( // Version of this module. - Version = `0.41.1` + Version = `0.41.2` ) -- cgit v1.3