Skip to content

Cursor .close() not finishes in case of multiple close attempts #1410

@FDoKE

Description

@FDoKE

Version

4.5.3

Context

CursorImpl.close never finishes promise in case of it's already closed, all logic in !closed branch.

  private synchronized void close(Promise<Void> promise) {
    if (!closed) {
....

Steps to reproduce

sqlConnection.prepare("select * from test")
        .compose(preparedStatement ->
        {
            Cursor cursor = preparedStatement.cursor();
            return cursor.read(1)
                    .compose(rowSet -> {
                        Future<Void> close1 = cursor.close();
                        Future<Void> close2 = cursor.close();
                        return Future.join(close1, close2)
                                .onComplete(ar -> {
                                    // never gets called
                                });
                    });
        });

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions