Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Await ReadyForQuery before emitting errors from transactional control methods #541

Closed
mp911de opened this issue Aug 25, 2022 · 0 comments
Closed
Labels
type: bug A general bug

Comments

@mp911de
Copy link
Collaborator

mp911de commented Aug 25, 2022

Bug Report

commitTransaction() emits an error signal upon processing ErrorResponse. A subsequent call to rollbackTransaction fails with "no transaction in progress" because the driver hasn't processed the final ReadyForQuery frame.

The driver should await the entire completion before throwing the error signal.

Reproducer

Input Code
CREATE TABLE tst(x int CONSTRAINT test_me UNIQUE DEFERRABLE INITIALLY DEFERRED);

Steps to reproduce

Input Code
ConnectionFactory connectionFactory = ConnectionFactories.get("r2dbc:postgresql://postgres:postgres@localhost/postgres");

Connection block = Mono.from(connectionFactory.create()).block();

Mono.from(block.beginTransaction()).block();

Flux.from(block.createStatement("insert into tst values(1)").execute())
		.flatMap(it -> it.getRowsUpdated()).blockLast();

Flux.from(block.createStatement("insert into tst values(1)").execute())
		.flatMap(it -> it.getRowsUpdated()).blockLast();

Mono.from(block.commitTransaction()).block();
@mp911de mp911de added the type: bug A general bug label Aug 25, 2022
@mp911de mp911de added this to the 0.8.13.RELEASE milestone Aug 25, 2022
mp911de added a commit that referenced this issue Aug 25, 2022
…ol methods.

commitTransaction, rollbackTransaction and other methods now await completion of the exchange before emitting error signals to properly synchronize completion.

Previously, error signals were emitted before updating the transaction state which could lead to invalid cleanup states if e.g. the commit failed.

[resolves #541]

Signed-off-by: Mark Paluch <[email protected]>
mp911de added a commit that referenced this issue Aug 25, 2022
…ol methods.

commitTransaction, rollbackTransaction and other methods now await completion of the exchange before emitting error signals to properly synchronize completion.

Previously, error signals were emitted before updating the transaction state which could lead to invalid cleanup states if e.g. the commit failed.

[resolves #541]

Signed-off-by: Mark Paluch <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

1 participant