-
Notifications
You must be signed in to change notification settings - Fork 2k
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
[BUG] Spring Boot application sometimes does not shutdown after closing client and Spring context #43345
Comments
@yiliuTo @saragluna could you please follow up? /cc @anuchandy as fyi |
@anuchandy, have you seen similar error logs before? |
Hi @saragluna, the first log from Also, in the usage code, there is no try-catch-ignore for |
hi @anuchandy, are you suggesting that the error is coming from the here are the rest of the logs between the abandon call and the different logs that chow up:
|
Hello @nateha1984, my main note was that we should ensure For a run where the container remains without exiting, could you share 15 minutes of debug logs before the app calls |
hi @anuchandy we're trying to duplicate the issue again in our environment but have had limited success (the one time it did happen, someone had turned off debug logging...). I can say that we won't have 15 minutes of run time before the app calls close. It's a very short-lived app and usually completes within a minute or less. Just wanted to touch base so you know we're working on getting this info for you |
We got a heap dump, here are the names of the threads: reactor-executor-1 |
Hello @nateha1984, thank you for the update. Was the heap dump taken from a container that didn't exit 10+ minutes after calling Also I just noticed that, spring team released If version 7.17.7 is loaded correctly (without any older versions affecting runtime), there should not be any logs from |
Hi @anuchandy we did the upgrade and I no longer see the The addition of the EH dependency seems to be causing the hanging pretty consistently. In this case, we have pods that are still running Monday morning from when they were instantiated Friday afternoon. We're using the Reactive Sinks method for sending the EH messages instead of the Azure EH client directly, so we're not managing the connection manually. Do we need to handle the EH connection a different way? Here are the active threads we see in the dump now: reactor-executor-2 |
Hi @nateha1984, good to hear that the IO thread is being cleaned up with new to answer your question - I believe that the Spring library |
Yes, the binder will close the processor clients (when consuming messages): Lines 138 to 140 in 00fccde
Lines 62 to 71 in 00fccde
Line 43 in 00fccde
Lines 58 to 63 in 968ec2e
But for the sending side, we don't register a stop method. |
Ok, so if we're only sending to an event hub and need to close to the client, we cannot use the binders/Sink api? We should use the event hub client directly, correct? Are there plans to shutdown the client sending side with the Sink API as well? I don't understand why only one way is shutdown in this manner to be honest |
I think we could fix this. |
Describe the bug
Occasionally the Service Bus connection is preventing a Spring Boot application from shutting down after closing the client. We have an application that is started with a KEDA event to consume one message from a service bus queue. Most of the time, the application/job starts in AKS, consumes the message, then we close the client and the Spring context, which shuts down the app and thus stops the container. At times, there looks to be some failure in the client close code that ends up preventing the Spring app and thus the container from stopping, so it continues to run the job until we manually kill the pod.
When this happens, we can see the messages below in the logs, but no exception is logged (just the Azure SDK json messages).
Exception or Stack Trace
When the application DOES shutdown successfully, we see these messages at the end:
To Reproduce
Steps to reproduce the behavior:
Use a Spring Boot CommandLineRunner application to receive a message from an Azure Service Bus Queue, then close the ServiceBusReceiverClient once the message has been received, then close the context. Error is NOT happening all the time.
Code Snippet
Expected behavior
Application shuts down cleanly
Screenshots
If applicable, add screenshots to help explain your problem.
Setup (please complete the following information):
Additional context
This looks to be the recommended way to shutdown a Spring Boot app in our situation, but open to other suggestions that might allow things to close more cleanly/consistently
Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report
The text was updated successfully, but these errors were encountered: