Skip to content
This repository has been archived by the owner on Apr 6, 2021. It is now read-only.

ArrayIndexOutOfBounds on RPC time out #106

Open
jamesalexscott opened this issue Sep 2, 2017 · 2 comments
Open

ArrayIndexOutOfBounds on RPC time out #106

jamesalexscott opened this issue Sep 2, 2017 · 2 comments

Comments

@jamesalexscott
Copy link

This is occurring in Android when a RPC request to the app times out (easy to simulate with a breakpoint)

java.lang.ArrayIndexOutOfBoundsException: length=2; index=2
at io.deepstream.RpcHandler.handle(RpcHandler.java:159)
at io.deepstream.Connection$3.run(Connection.java:223)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)

The handler receives this message:
P¬E¬INVALID_RPC_CORRELATION_ID¬ unexpected state for rpc..

This causes an app crash which can't be caught.

@AlexBHarley
Copy link
Contributor

Hi @jamesalexscott, I tried to recreate this issue with the following code.

public static void main(String[] args) throws URISyntaxException {
    DeepstreamClient client2 = new DeepstreamClient("localhost:6020");
    client2.login();

    client2.rpc.provide("timeout", new RpcRequestedListener() {
        @Override
        public void onRPCRequested(String rpcName, Object data, RpcResponse response) {
            System.out.println("onRpcRequested");
        }
    });


    DeepstreamClient client = new DeepstreamClient("localhost:6020");
    client.login();
    RpcResult res = client.rpc.make("timeout", "test");
    System.out.println(res.getData());
}

The output of which is:

onRpcRequested
RESPONSE_TIMEOUT

This is correct. Is there any more info you can provide to reproduce this?

@jamesalexscott
Copy link
Author

Hi @AlexBHarley, apologies for the slow response. I've been away

I'm not sure if it's limited to Android, but it's quite easy to reproduce in Android.

In the onRPCRequested, if you put a Thread.sleep(5000) and then try and send a response it will cause an App crash. Even with try/catch

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants