neo-go/pkg
Pavel Karpy d6eaf6efc2 rpcclient/WS: fix data race on concurrent (un)subscription
Every client's (Un)Subscription call does two things: an RPC call and a
subscription map lock (two of maps currently). If we imagine that there is
one routine that tries to subscribe (A) and one routine that tries to
unsubscribe (B), the following sequence can happen:

0. Current number of subscriptions is X
1. B does an RPC and makes number of subscriptions X-1
2. A does an RPC and makes number of subscriptions X again
3. A holds subscription locks and rewrites client's subscription state
   (subscription with ID X now points to a different channel; channel that
   was registered by B is lost and is not related to any real subscription
   but is still included in the `receivers` map)
4. B holds subscription locks and drops subscription X (first, it is an
   error and we have just lost a subscription that we think was made
   successfully second, we have lost a channel in the `receivers` map, and
   no corresponding subscription points to it)
5. X subscription is received by the WS client (in practice it is a new
   block, 100ms, quite often to be sure this issue happens every hour), we
   range through the receivers, see no corresponding subscription, and
   panic.

Closes #3093.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2024-07-26 18:19:50 +03:00
..
compiler native: autogenerate nativehashes package 2024-05-14 09:39:53 +03:00
config docs: add a note about System.Runtime.GetNotifications refcounting 2024-06-11 19:26:11 +03:00
consensus consensus: use better dbFT 2024-03-25 19:21:51 +03:00
core Merge pull request #3473 from nspcc-dev/fix-call-check 2024-06-11 19:21:44 +03:00
crypto crypto: export GetSignedData function 2024-05-13 09:33:42 +03:00
encoding *: drop go 1.18 support in doc and build targets 2023-10-12 17:59:42 +03:00
interop core: move P2PNotary node role out of P2PSigExtensions 2024-05-21 12:10:47 +03:00
io *: replace interface{} with any keyword 2023-04-04 13:22:42 +03:00
neorpc rpcsrv: add SessionEnabled, MaxIteratorResultItems to getversion 2024-04-03 22:42:14 +03:00
neotest crypto: add StringCompressed() for PublicKey 2024-04-11 15:24:46 +03:00
network network: extend errInvalidInvType error 2024-06-05 15:32:43 +03:00
rpcclient rpcclient/WS: fix data race on concurrent (un)subscription 2024-07-26 18:19:50 +03:00
services oracle: add length check o.MainCfg.NeoFS.Nodes 2024-06-05 11:53:52 +03:00
smartcontract smartcontract: ensure nil ParameterContext Item's script is marshallable 2024-04-18 13:55:05 +03:00
util *: replace slice.Copy with bytes.Clone 2024-03-05 13:54:10 +03:00
vm vm: improve stack size related errors 2024-06-11 18:34:22 +03:00
wallet wallet: do not store deployed contract script inside Contract account 2024-06-05 15:27:20 +03:00