arangodb / arangodb-java-driver

The official ArangoDB Java driver.
Apache License 2.0
200 stars 93 forks source link

Exception thrown by cursor when query results > batch size (v6.18.0+) #516

Closed ieuan-richards closed 10 months ago

ieuan-richards commented 11 months ago

In versions 6.18.0+ I see an exception is thrown whenever the cursors tries to return the second batch of results from a query.

We've downgraded to v6.17.0 of the driver in the meantime.

To replicate:

This is the exception:

Exception in thread "main" com.arangodb.ArangoDBException: Response: 400, Error: 400 - expecting POST /_api/cursor at com.arangodb.internal.util.ResponseUtils.checkError(ResponseUtils.java:55) at com.arangodb.internal.velocystream.VstCommunication.checkError(VstCommunication.java:157) at com.arangodb.internal.velocystream.VstCommunicationSync.execute(VstCommunicationSync.java:144) at com.arangodb.internal.velocystream.VstCommunicationSync.execute(VstCommunicationSync.java:45) at com.arangodb.internal.velocystream.VstCommunication.execute(VstCommunication.java:149) at com.arangodb.internal.velocystream.VstCommunication.execute(VstCommunication.java:144) at com.arangodb.internal.velocystream.VstProtocol.execute(VstProtocol.java:46) at com.arangodb.internal.ArangoExecutorSync.execute(ArangoExecutorSync.java:71) at com.arangodb.internal.ArangoExecutorSync.execute(ArangoExecutorSync.java:57) at com.arangodb.internal.ArangoDatabaseImpl$1.next(ArangoDatabaseImpl.java:211) at com.arangodb.internal.cursor.ArangoCursorIterator.next(ArangoCursorIterator.java:69) at com.arangodb.internal.cursor.ArangoCursorImpl.next(ArangoCursorImpl.java:111)

rashtao commented 11 months ago

@ieuan-richards Can you please provide a code snippet to reproduce the issue?

ieuan-richards commented 11 months ago
ArangoDB arangoDB = new ArangoDB.Builder()
                .host("localhost", 8529)
                .user("user")
                .password("pword")
                .build();

        ArangoDatabase db = arangoDB.db("db");

        // Should have more than 2 results to see issue
        try(ArangoCursor<BaseDocument> cursor = db.query("for doc in Collection return doc",
                new AqlQueryOptions().batchSize(2), BaseDocument.class)){
            while (cursor.hasNext()){
                BaseDocument next = cursor.next();
                System.out.println(next);
            }
        }
rashtao commented 11 months ago

I can execute the snippet above without getting any exception! Can you enable debug level logging for com.arangodb and report here the logs related to requests and responses?

ieuan-richards commented 11 months ago

I should have mentioned that we are on v3.6.13 of ArangoDB server. I will provide the debug logs shortly.

rashtao commented 10 months ago

Closing as not reproducible, please reopen if still relevant.