Skip to content

Exception thrown from "executor.disconnect()" leads to CommunicationProtocol remaining open #399

Closed
@wajda

Description

@wajda
@Override
    public void shutdown() throws ArangoDBException {
        try {
            executor.disconnect();
            cp.close(); // <---- This is not called when the previous method throws an exception !!!
        } catch (final IOException e) {
            throw new ArangoDBException(e);
        }
    }

When an exception is thrown from the executor.disconnect() (for instance 401 - unauthorized) the CommunicationProtocol.close() isn't called and thus all the associated with it resources (apparently including thread pools or such) remain unclosed. This leads to the client app being unable to exit normally.

AN easy workaround is to call shutdown() in a try-catch block and repeat the call on ArangoDBException like this:

    try {
      arango.shutdown()
    } catch {
      case _: ArangoDBException =>
        arango.shutdown()
    }

It would be good however, to handle exceptions internally in the driver and do a proper cleanup.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions