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

Garbage collected without being shut down! ~*~*~* Make sure to call shutdown()/shutdownNow() #2375

Open
amit-4-kumar opened this issue Mar 3, 2025 · 0 comments

Comments

@amit-4-kumar
Copy link

amit-4-kumar commented Mar 3, 2025

Please do a quick search on GitHub issues first, there might be already a duplicate issue for the one you are about to create.
If the bug is trivial, just go ahead and create the issue. Otherwise, please take a few moments and fill in the following sections:

Bug description
Facing frequent issue of garbage collected . Although each call using - vertexApi.close()
ERROR i.g.i.ManagedChannelOrphanWrapper - ~* Previous channel ManagedChannelImpl{logId=1, target=us-central1-aiplatform.googleapis.com:443} was garbage collected without being shut down! *~
Make sure to call shutdown()/shutdownNow()
java.lang.RuntimeException: ManagedChannel allocation site
Environment
Please provide as many details as possible: Spring AI version, Java version, which vector store you use if any, etc
Spring AI version - 0.8.1-SNAPSHOT and Java - 17
Steps to reproduce

Minimal Complete Reproducible example
Please provide a failing test or a minimal complete verifiable example that reproduces the issue.
Bug reports that are reproducible will take priority in resolution over reports that are not reproducible.
sample code -
VertexAI vertexApi ;
String gcpAccessToken = getGCPAccessTokenByServiceAccount();
GoogleCredentials googleCredentials = new GoogleCredentials(new
AccessToken(
gcpAccessToken,
null));
vertexApi = new VertexAI(genAIConfig.getGcpProjectId(), genAIConfig.getGcpLocation(), googleCredentials);

ChatClient chatClient = new VertexAiGeminiChatClient(vertexApi,
VertexAiGeminiChatOptions.builder()

                    .withTemperature((Float) variables.get(Constants.TEMPERATURE_KEY))
                    .withModel(modelName)
                    .withMaxOutputTokens(8000)
                    .withTopP(1F)
                    .build());

ChatResponse chatResponse = chatClient.call(prompt);;// Error throwing at this line
if(vertexApi != null) {
vertexApi.close();
} .

Please share sample code that can fix or handle above issue in . Also application handles multiple request per minutes.

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