diff options
author | Max Romanov <max.romanov@nginx.com> | 2020-11-18 22:33:53 +0300 |
---|---|---|
committer | Max Romanov <max.romanov@nginx.com> | 2020-11-18 22:33:53 +0300 |
commit | 0ec69aa46e3577ef44060b9dd8576faab4a863ce (patch) | |
tree | 05710eb57b916092d787706a25504b129ae7b8cb /go/nxt_cgo_lib.h | |
parent | 8340ca0b9c7ad4109033ccb028f87cc1b73396bc (diff) | |
download | unit-0ec69aa46e3577ef44060b9dd8576faab4a863ce.tar.gz unit-0ec69aa46e3577ef44060b9dd8576faab4a863ce.tar.bz2 |
Libunit: fixing racing condition for port add / state change.
The issue only occurred in Go applications because "port_send" is overloaded
only in Go. To reproduce it, send multiple concurrent requests to the
application after it has initialised. The warning message "[unit] [go] port
NNN:dd not found" is the first visible aspect of the issue; the second and more
valuable one is a closed connection, an error response, or a hanging response to
some requests.
When the application starts, it is unaware of the router's worker thread ports,
so it requests the ports from the router after receiving requests from the
corresponding router worker threads. When multiple requests are processed
simultaneously, the router port may be required by several requests, so request
processing starts only after the application receives the required port
information. The port should be added to the Go port repository after its
'ready' flag is updated. Otherwise, Unit may start processing some requests and
use the port before it is in the repository.
The issue was introduced in changeset 78836321a126.
Diffstat (limited to 'go/nxt_cgo_lib.h')
0 files changed, 0 insertions, 0 deletions