Skip to content

Agent.queryRaw - requests sometimes hang on without any result #3

@chinaryov

Description

@chinaryov

Hello,

We sometimes have a strange problem. Once in a few days query request to IC hang on and there are no any result, even exception. Bad thing is that I cannot reproduce it in a test.

Here is the information that I have found so far.

Example code:

    private byte[] query(String canisterId, Request<byte[]> request) {
        final Principal canisterPrincipal = Principal.fromString(canisterId);
        final CompletableFuture<Response<byte[]>> responseCompletableFuture = agent.queryRaw(
                canisterPrincipal, canisterPrincipal, methodName, request, Optional.empty());
        final Response<byte[]> response;
        try {
            response = responseCompletableFuture.get();
        } catch (Throwable e) {
            throw new RuntimeException(e);
        }
        return response.getPayload();
    }

Calling method 'responseCompletableFuture.get();' hangs on forever.

Source code - ReplicaApacheHttpTransport

Line 198

client.execute(httpRequest, new FutureCallback<SimpleHttpResponse>() {
    @Override
    public void completed(SimpleHttpResponse httpResponse) {
        ...
    }

    @Override
    public void failed(Exception ex) {
        ...
    }

    @Override
    public void cancelled() {
        ...
    }
});        

After calling method 'client.execute' methods of interface FutureCallback (complete, failed and cancelled) not called.

Source code - InternalAbstractHttpAsyncClient (httpclient5-5.1.3.jar)

Line 223

...
            executeImmediate(...)
...

    void executeImmediate(
            final HttpRequest request,
            final AsyncEntityProducer entityProducer,
            final AsyncExecChain.Scope scope,
            final AsyncExecCallback asyncExecCallback) throws HttpException, IOException {
        execChain.execute(request, entityProducer, scope, asyncExecCallback);
    }

After method execution 'executeImmediate' no any method was called of 'AsyncExecCallback'.

Best regards,
Alexander

Metadata

Metadata

Assignees

No one assigned

    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