Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"RESOURCE_EXHAUSTED: gRPC message exceeds maximum size" on too many consecutive requests with Spring #68

Open
Equiphract opened this issue Sep 11, 2024 · 1 comment

Comments

@Equiphract
Copy link

Equiphract commented Sep 11, 2024

I have a simple Spring application that sends SQL statements to an ImmuDB instance running inside a Docker container.

Up to five such statements can be sent successfully, the sixth however causes the following exception:

io.grpc.StatusRuntimeException: RESOURCE_EXHAUSTED: gRPC message exceeds maximum size 4194304: 9502720

This is caused by a call to ImmuClient::commitTransaction. It seems like those multiple calls add up somehow. When I, instead of an SQL statement, just send a key-value pair I am able to send a few more requests but it ultimately crashes anyways at a certain point.

To make sure that this is not coding issue on my side, here is the method body that handles the request and makes use of the ImmuClient instance:

client.openSession("defaultdb", "immudb", "immudb");
try {
    client.beginTransaction();
    client.sqlExec(
        "insert into demo_table (message) values (?);",
        new SQLValue("some message")
    );
    client.commitTransaction();
} finally {
    client.closeSession();
}

Here is the instantiation of the ImmuClient object that is used in the above code extract as client:

@Bean
ImmuClient immuClient() {
    return ImmuClient.newBuilder()
        .withServerUrl("localhost")
        .withServerPort(3322)
        .build();
}

Do you have a clue what is happening here? Might this be a bug with immudb4j or is it a layer 8 problem?

I now did some more testing and tested the same piece of code as above in a plain Java project (no Spring) and I could not reproduce the exception.

Also, when writing key-value values instead of SQL statements to ImmuDB it sometimes crashes with a different exception:
io.netty.handler.codec.http2.Http2Exception: Incomplete header block fragment.

Another thing: When I shut down the ImmuClient and reinitialise it with every request to ImmuDB the exceptions do not happen.

So as it seems these exceptions only appear when Spring is in use and the ImmuClient is the same instance inbetween multiple requests.

@Equiphract
Copy link
Author

After some further testing, it might be that this issue arises due to some shared dependency of Spring Boot and immudb4j. The crash does not happen when using Spring Boot version 3.3.0, only with the versions 3.3.1, 3.3.2 and 3.3.3.

@Equiphract Equiphract changed the title "RESOURCE_EXHAUSTED: gRPC message exceeds maximum size" on too many consecutive requests "RESOURCE_EXHAUSTED: gRPC message exceeds maximum size" on too many consecutive requests with Spring Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant