Repository navigation
fix(core): inconsistency connection state - #137
Merged
Merged
Conversation
nickkkccc
force-pushed
the
connection-inconsistency-bug
branch
from
October 22, 2026 18:39
7dd092e to
9d75c4d
Compare
bitgorbovsky
requested changes
Oct 23, 2026
Comment on lines
+403
to
+409
| boolean errorOccurred = false; | ||
| try { | ||
| connection.connect(address, -1L).join(); | ||
| } catch (IllegalStateException e) { | ||
| errorOccurred = true; | ||
| } | ||
| Assertions.assertTrue(errorOccurred, "Error must be occurred!"); |
Contributor
There was a problem hiding this comment.
А почему не через Assertions.assertThrows?
Comment on lines
+12
to
+13
| later call to the method returned `null` instead of a `CompletableFuture`. Now the method always | ||
| returns a future that either completes with a greeting or fails with an error. |
Contributor
There was a problem hiding this comment.
Небольшое противоречие с реальной правкой: метод либо возвращает Future, либо бросает ошибку. Это отличается от заявленного здесь - возвращает Future, которая завершается либо успешно, либо с ошибкой
nickkkccc
force-pushed
the
connection-inconsistency-bug
branch
from
October 23, 2026 08:36
9d75c4d to
15591ad
Compare
nickkkccc
force-pushed
the
connection-inconsistency-bug
branch
from
October 23, 2026 08:36
15591ad to
22e7c50
Compare
In the current version of the code, if a timeout value less than or equal to 0 is passed, an exception is thrown, but the connection remains stuck in the CONNECTING state. Subsequent calls to the Connection#connect(...) method on the same object return null instead of a proper CompletableFuture<Greeting>. In other words, failures or errors during the execution of Connection#connect(...) should not leave the Connection object in an inconsistent state. Subsequent calls should be handled correctly; the method must return a CompletableFuture<Greeting>—either one that completes successfully or one that contains an error, as per the contract of the CompletionStage<T> interface. Providing not positive timeout value throws an exception.
nickkkccc
force-pushed
the
connection-inconsistency-bug
branch
from
October 23, 2026 08:37
22e7c50 to
df9233e
Compare
bitgorbovsky
approved these changes
Oct 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In the current version of the code, if a timeout value
less than or equal to 0 is passed, an exception is thrown,
but the connection remains stuck in the
CONNECTINGstate.Subsequent calls to the
Connection#connect(...)method onthe same object return
nullinstead of a properCompletableFuture<Greeting>.In other words, failures or errors during the execution of
Connection#connect(...)should not leave theConnectionobject in an inconsistent state. Subsequent calls should be
handled correctly; the method must return a
CompletableFuture<Greeting>—either one that completessuccessfully or one that contains an error, as per the
contract of the
CompletionStage<T>interface.I haven't forgotten about:
Related issues: