• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

tarantool / tarantool-java
69%
master: 78%

Build:
Build:
LAST BUILD BRANCH: Totktonada/remove-gitter-badge
DEFAULT BRANCH: master
Repo Added 31 Oct 2018 02:54AM UTC
Files 71
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

LAST BUILD ON BRANCH nicktorwald/gh-142-race-condition
branch: nicktorwald/gh-142-race-condition
CHANGE BRANCH
x
Reset
  • nicktorwald/gh-142-race-condition
  • Totktonada/add-a-link-to-releases-page
  • Totktonada/add-tarantool-2.3-into-ci
  • Totktonada/fix-api-docs
  • Totktonada/gh-139-fix-coverall-io
  • Totktonada/gh-142-race-condition-proposal
  • Totktonada/gh-27-fix-biginteger-pack-unpack
  • Totktonada/prepared-statements-ci
  • Totktonada/remove-gitter-badge
  • Totktonada/travis-ci-dont-fail-on-example-stop
  • Totktonada/travis-ci-update-rules
  • Totktonada/update-connector-version-in-readme
  • connector-1.9.2
  • connector-1.9.3
  • connector-1.9.4
  • master
  • nicktorwald/gh-119-sql-state-exceptions
  • nicktorwald/gh-120-nulls-are-sorted-support
  • nicktorwald/gh-127-msgpacklite-tests
  • nicktorwald/gh-141-wrong-response-code-comparison
  • nicktorwald/gh-149-brokenAbstractJdbcIT
  • nicktorwald/gh-158-checkstyle
  • nicktorwald/gh-163-remove-tnt-connection
  • nicktorwald/gh-163-start-stop-stuck
  • nicktorwald/gh-164-start-stop-stuck
  • nicktorwald/gh-167-socket-provider-timeout
  • nicktorwald/gh-175-datasource
  • nicktorwald/gh-179-resultset-was-null
  • nicktorwald/gh-180-close-on-completion
  • nicktorwald/gh-181-pooled-statements
  • nicktorwald/gh-182-get-more-results
  • nicktorwald/gh-186-client-config-docs
  • nicktorwald/gh-188-test-locality
  • nicktorwald/gh-189-max-field-size
  • nicktorwald/gh-194-logging
  • nicktorwald/gh-195-discard-discovery-addr
  • nicktorwald/gh-198-libre-office-npe
  • nicktorwald/gh-198-server-prepared-statement
  • nicktorwald/gh-199-cluster-connection
  • nicktorwald/gh-211-resultset-api
  • nicktorwald/gh-212-request-dsl
  • nicktorwald/gh-220-update-by-field-name
  • nicktorwald/gh-30-socket-provider-error
  • nicktorwald/gh-34-cluster-support
  • nicktorwald/gh-52-sql-tests
  • nicktorwald/gh-60-jdbc-docs
  • nicktorwald/gh-62-batch-updates
  • nicktorwald/gh-7-soft-schema-reload
  • nicktorwald/gh-71-connection-abort
  • nicktorwald/gh-72-closed-connection
  • nicktorwald/gh-73-wrapper-support
  • nicktorwald/gh-74-connection-client-info
  • nicktorwald/gh-75-connection-is-valid
  • nicktorwald/gh-77-generated-keys
  • nicktorwald/gh-78-no-generated-keys
  • nicktorwald/gh-79-escape-syntax
  • nicktorwald/gh-85-resultSet-type
  • nicktorwald/gh-92-tarantool-types-v22

pending completion
350

Pull #145

travis-ci

web-flow
Race condition in TarantoolClientImpl

A state of a client is a set of the following flags: {READING, WRITING,
RECONNECT, CLOSED}. Let's name a state when no flags are set
UNINITIALIZED.

A reader thread sets READING, performs reading until an error or an
interruption, drops READING and tries to trigger reconnection (if a
state allows, see below). A writer do quite same things, but with the
WRITING flag. The key point here is that a reconnection is triggered
from a reader/writer thread and only when certain conditions are met.

The prerequisite to set RECONNECT and signal (unpark) a connector thread
is that a client has UNINITIALIZED state.

There are several problems here:

- Say, a reader stalls a bit after dropping READING, then a writer drops
WRITING and trigger reconnection. Then reader wokes up and set RECONNECT
again.

- Calling unpark() N times for a connector thread when it is alive
doesn't lead to skipping next N park() calls, so the problem above is
not just about extra reconnection, but lead the connector thread to be
stuck.

- Say, a reader stalls just before setting READING. A writer is hit by
an IO error and triggers reconnection (set RECONNECT, unpark connector).
Then the reader wakes up and set READING+RECONNECT state that disallows
a connector thread to proceed further (it expects pure RECONNECT). Even
when the reader drops READING it will not wake up (unpark) the connector
thread, because RECONNECT was already set (state is not UNINITIALIZED).

This commit introduces several changes that eliminate the problems
above:

- Use ReentrantLock + Condition instead of park() / unpark() to never
miss signals to reconnect, does not matter whether a connector is
parked.

- Ensure a reader and a writer threads from one generation (that are
created on the same reconnection iteration) triggers reconnection once.

- Hold RECONNECT state most of time a connector works (while acquiring
a new socket, connecting and reading Tarantool greeting) and pre... (continued)
Pull Request #145: Race condition in TarantoolClientImpl

62 of 62 new or added lines in 1 file covered. (100.0%)

1669 of 2402 relevant lines covered (69.48%)

0.69 hits per line

Relevant lines Covered
Build:
Build:
2402 RELEVANT LINES 1669 COVERED LINES
0.69 HITS PER LINE
Source Files on nicktorwald/gh-142-race-condition
  • List 0
  • Changed 2
  • Source Changed 1
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line

Recent builds

Builds Branch Commit Type Ran Committer Via Coverage
350 nicktorwald/gh-142-race-condition Race condition in TarantoolClientImpl A state of a client is a set of the following flags: {READING, WRITING, RECONNECT, CLOSED}. Let's name a state when no flags are set UNINITIALIZED. A reader thread sets READING, performs reading until an err... Pull #145 18 Apr 2019 07:04AM UTC web-flow travis-ci pending completion  
316 nicktorwald/gh-142-race-condition Race condition in TarantoolClientImpl A state of a client is a set of the following flags: {READING, WRITING, RECONNECT, CLOSED}. Let's name a state when no flags are set UNINITIALIZED. A reader thread sets READING, performs reading until an err... Pull #145 15 Apr 2019 07:18PM UTC web-flow travis-ci pending completion  
315 nicktorwald/gh-142-race-condition Race condition in TarantoolClientImpl A state of a client is a set of the following flags: {READING, WRITING, RECONNECT, CLOSED}. Let's name a state when no flags are set UNINITIALIZED. A reader thread sets READING, performs reading until an err... push 15 Apr 2019 07:16PM UTC nicktorwald travis-ci pending completion  
313 nicktorwald/gh-142-race-condition debug commit Pull #145 15 Apr 2019 07:37AM UTC web-flow travis-ci pending completion  
312 nicktorwald/gh-142-race-condition debug commit push 15 Apr 2019 07:35AM UTC nicktorwald travis-ci pending completion  
311 nicktorwald/gh-142-race-condition debug commit Pull #161 15 Apr 2019 07:05AM UTC web-flow travis-ci pending completion  
310 nicktorwald/gh-142-race-condition Race condition in TarantoolClientImpl A state of a client is a set of the following flags: {READING, WRITING, RECONNECT, CLOSED}. Let's name a state when no flags are set UNINITIALIZED. A reader thread sets READING, performs reading until an err... Pull #145 15 Apr 2019 04:29AM UTC web-flow travis-ci pending completion  
273 nicktorwald/gh-142-race-condition Race condition in TarantoolClientImpl - Avoid a possible race between reading, writing and reconnecting threads when a reconnection process is started. It might have happened that the lagged thread (reading or writing) could reset the state to RE... Pull #145 04 Apr 2019 01:16PM UTC web-flow travis-ci pending completion  
272 nicktorwald/gh-142-race-condition Race condition in TarantoolClientImpl - Avoid a possible race between reading, writing and reconnecting threads when a reconnection process is started. It might have happened that the lagged thread (reading or writing) could reset the state to RE... push 04 Apr 2019 01:13PM UTC nicktorwald travis-ci pending completion  
271 nicktorwald/gh-142-race-condition Race condition in TarantoolClientImpl - Avoid a possible race between reading, writing and reconnecting threads when a reconnection process is started. It might have happened that the lagged thread (reading or writing) could reset the state to RE... Pull #145 04 Apr 2019 09:25AM UTC web-flow travis-ci pending completion  
See All Builds (426)
  • Repo on GitHub
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc