Skip to content

Await ReadyForQuery before emitting errors from transactional control methods #541

@mp911de

Description

@mp911de

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();

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions