Skip to content

Kotlin await hangs in docker (alpine image) #276

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

Closed
picaso opened this issue Mar 11, 2018 · 6 comments
Closed

Kotlin await hangs in docker (alpine image) #276

picaso opened this issue Mar 11, 2018 · 6 comments

Comments

@picaso
Copy link

picaso commented Mar 11, 2018

I am not sure if this is a Kotlin coroutines problem or a docker problem.

On Mac when we run any function via IntelliJ or Command line that returns Deferred object and call await() on it, it works wonderfully.

On Docker, it just hangs indefinitely. This is more apparent if there are nested async calls. The team has tried so hard to figure out why and I am hoping the solution is something trivial.

@fvasco
Copy link
Contributor

fvasco commented Mar 11, 2018

Can you provide an example and the thread dump (kill -3 1 in the container)?

@elizarov
Copy link
Contributor

Can you reproduce this problem with some small self-contained test?

@svd27
Copy link

svd27 commented Apr 9, 2018

I have noted similar problems on Travis. Tests that run fine on my machine start hanging on Travis.
I think one problem is that CommonPool limits the thread count to no of CPUs - 1. This seems to make coroutine operations to hang on travis machines.
I would propose some property that can be set like: -Dkotlinx.coroutines.commonPool.minThreads = 2

@qwwdfsad
Copy link
Member

qwwdfsad commented Apr 9, 2018

Could you please show self-contained reproducer which hangs on Travis?

I think one problem is that CommonPool limits the thread count to no of CPUs - 1

This case is properly handled: (Runtime.getRuntime().availableProcessors() - 1).coerceAtLeast(1)

@svd27
Copy link

svd27 commented Apr 9, 2018

Actually I was taking about that piece of code. It means on a one or two CPU system it limits CommonPool to one thread.
This lead for me to deadlock problems on Travis.

@qwwdfsad
Copy link
Member

I'm closing this issue after fixing #343 and #432

Feel free to create a new one if a problem is reproducible with 0.24.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants