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

NonInjectionManager produce out of memory error #5805

Open
skafenko opened this issue Nov 19, 2024 · 0 comments
Open

NonInjectionManager produce out of memory error #5805

skafenko opened this issue Nov 19, 2024 · 0 comments

Comments

@skafenko
Copy link

Jersey client version = 2.45

Case: When invoke first request or by asynch way or by CompletableFuture jersey create instances of ClientRequest in NonInjectionManager$TypedInstances.threadPredestroyables and they never cleaned until clinet not closed, but i need to reuse client instance.

CODE:
` Client client = ClientBuilder.newClient();

    Response response = client.target("https://google.com").request().get();
    int status = response.getStatus();
    response.close();
    System.out.println(status);
    //Create instance in NonInjectionManager$TypedInstances.threadPredestroyables

    for (int i = 0; i <= 10; i++) {
         client.target("https://google.com").request()
                .async()
                .post(Entity.text("text"));
    }
    //Create 10 instance in NonInjectionManager$TypedInstances.threadPredestroyables

    for (int i = 0; i <= 10; i++) {
        CompletableFuture.supplyAsync(() -> {
            Response test = client.target("https://google.com").request()
                    .post(Entity.text("text"));
            int string = test.getStatus();
            test.close();
            System.out.println(string);

            return null;
        }).join();
    }
    //Create 10 instance in NonInjectionManager$TypedInstances.threadPredestroyables

    response = client.target("https://sm-dev.smiddle.lab/MessengerGateway/ping").request().get();
    status = response.getStatus();
    response.close();`

image

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