Skip to content

Conversation

@scottinet
Copy link
Contributor

1.0.4 (2020-09-25)

Bug fixes


Luca Marchesini and others added 6 commits September 21, 2020 14:52
# Description

Fix a number of problems when handling disconnections, and with asynchronous tasks in general.


## Network disconnection

When `AbstractProtocol.AutoRecover` is set to true:

* requests sent through the network would never be resolved when the connection is lost before they receive a response. This means that clients awaiting for a response would freeze forever. With this PR, those tasks are correctly rejected with a `ConnectionLost` exception (we cannot queue them: as far as the SDK is concerned, it cannot know if these requests were received and processed by Kuzzle or not)
* there was a race condition when triggering the threaded recovering process where, in rare cases, 2 reconnection attempts would run in parallel, doubling the number of opened sockets

## Asynchronous tasks

* Race conditions could occur and corrupt the requests cache, or freeze the SDK because of an unhandled exception, because of an incorrect use of `lock` (this keyword has no impact when multiple accesses are made to the same "locked" object within the same thread) => semaphores are now used to circumvent the problem
* Requests tasks were incorrectly configured, making their resolution synchronous. This means that resolving tasks in the SDK event handlers (which manage network state changes) could prevent them to finish in a timely fashion (or... ever) because they would synchronously trigger awaiting code

# Boyscout

* Save our standard code style directly in the solution to share it to whomever works on the project
@codecov
Copy link

codecov bot commented Sep 25, 2020

Codecov Report

Merging #63 into 1-stable will increase coverage by 0.06%.
The diff coverage is 83.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##           1-stable      #63      +/-   ##
============================================
+ Coverage     82.60%   82.67%   +0.06%     
============================================
  Files            34       34              
  Lines          1696     1743      +47     
  Branches        201      205       +4     
============================================
+ Hits           1401     1441      +40     
- Misses          272      278       +6     
- Partials         23       24       +1     
Impacted Files Coverage Δ
Kuzzle/Offline/OfflineManager.cs 70.73% <ø> (ø)
Kuzzle/Protocol/WebSocket.cs 66.44% <0.00%> (-0.23%) ⬇️
...zzle/Offline/Subscription/SubscriptionRecoverer.cs 47.54% <70.58%> (+1.38%) ⬆️
Kuzzle/Kuzzle.cs 82.94% <87.87%> (+0.66%) ⬆️
Kuzzle/Offline/Query/QueryReplayer.cs 80.53% <91.30%> (+2.66%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a027799...281cbcf. Read the comment docs.

@scottinet scottinet merged commit 37848a5 into 1-stable Sep 25, 2020
@scottinet scottinet deleted the 1.0.4-proposal branch September 25, 2020 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants