-
Notifications
You must be signed in to change notification settings - Fork 926
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
Fatal error in gRPC coroutines stack caused by "An error occurred while pushing a context" #3945
Comments
The exception is raised when a thread tries to push a |
I wish I could, but I have no idea how that happened. The service was running in production for a while before this :(. I can only guess that there's a race condition somewhere, maybe related with operation/coroutines cancellation - some requests running at the same time could be timing out - not sure if that caused something wrong. |
Then, I probably need to take a look at your code. Let's have a private chat in Slack. Could you send me DM in Slack? |
sure! |
I am also encountering a similar error recently. How can I solve? |
@onsah Could you provide a reproducible example? |
If it is difficult to reproduce, #4232 feature will help us find a clue to the error. |
I also encountering this issue i have a kind of spring service with suspend function that looks like this suspend fun createGoods(input: Input) = withContext(Dispatchers.IO){ val aAsync = async { insert to db } aAsync.await() return@withContext Something() and i call this from Grpc api many time at once. sometimes the same error happend. but sometimes not i think when server get too much request, this happens i just saw related commit for detect context leak and i will try that! |
Thanks for the reporting! I have been looking forward to more information on the bug. I’m not an expert on the internal of Kotlin coroutine. I need to debug the code to find out the cause. |
finally i reproduce this. if anyone not available i want to explain how to reproduce. (ilttle bit hard to do in english, i'm not good to explain) |
What langugage do you prefer? We have Korean, Japanese and English channels in the Slack. https://armeria.dev/s/slack |
i'm korean!! |
I see. Let’s continute to have conversation in Korean at the Slack. |
after trying to reproduce this issue with @ikhoon in my case, my project use spring version 2.6.3 and gradle plugin for managing dependency kotlin 1.6.1 release note contain fix of this issue Rollback of time-related functions dispatching on Dispatchers.Main. maybe leak is related with one of above issues |
Thanks, @kwazii1231 for the thorough analysis. |
Today we had a very strange fatal crash in one of our server instances (hosted in ECS/Fargate).
We had to restart the instance, otherwise it kept crashing...
Our stack is Armeria 1.13.1 / kotlin 1.5.31; kotlin coroutines 1.5.2; gRPC kotlin 1.2.0; gRPC java 1.41.0;.
The gRPC service is based on kotlin coroutines with armeria blocking task executor.
Seems that the initial exception that was recorded in logs, was "An error occurred while pushing a context":
After that, we had hundreds of coroutine-related exceptions - all caused by the same wrong context (sreqId=5f01fe01):
The text was updated successfully, but these errors were encountered: