Skip to content

Fixed connection manager logic - #158

Merged
icmp0x8 merged 4 commits into
masterfrom
fix/current-connections
Dec 24, 2021
Merged

Fixed connection manager logic#158
icmp0x8 merged 4 commits into
masterfrom
fix/current-connections

Conversation

@icmp0x8

@icmp0x8 icmp0x8 commented Dec 2, 2021

Copy link
Copy Markdown
Contributor

Fixed concurrent access to the creation of a connection manager and its internal logic for establishing connections in the event of a partial or complete failure.
Fixes #149

…ts internal logic for establishing connections in the event of a partial or complete failure.
Comment thread src/main/java/io/tarantool/driver/core/connection/ConnectionMode.java Outdated
@akudiyar

akudiyar commented Dec 5, 2021

Copy link
Copy Markdown
Collaborator

I'd like to add a more detailed description of what's changed:

Previously, when a connection to a host is being failed for some time under constant load, several of the request threads which tried to acquire a connection may turn on the connection mode simultaneously (how many -- depends on the request rate and the timeout to wait until a connection fails). This was happening because there were only two connection states -- "ON" (represented by FULL/PARTIAL) and "OFF", and this led to a situation when one thread finished connecting, a second is waiting until the connection process finishes, and a third starts connecting immediately as it catches the NoAvailableConnectionsException and sees the connection state as "OFF".

In this patch, a new connection state is added -- IN_PROGRESS, and such race condition is not more possible since only one thread actually can set the state IN_PROGRESS, and only it can switch it back to OFF when the connection process is finished (succeed or failed).

vrogach2020
vrogach2020 previously approved these changes Dec 23, 2021
@icmp0x8
icmp0x8 merged commit 79c36ee into master Dec 24, 2021
@icmp0x8
icmp0x8 deleted the fix/current-connections branch December 24, 2021 13:10
icmp0x8 added a commit that referenced this pull request Feb 10, 2022
* Fixed concurrent access to the creation of a connection manager and its internal logic for establishing connections in the event of a partial or complete failure.

* Add log and bump netty version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Check that cartridge-java does not create connections above limit

3 participants