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

Deadlock when using 'System.exit(1)' #28899

Closed
mschorsch opened this issue Oct 28, 2022 · 8 comments
Closed

Deadlock when using 'System.exit(1)' #28899

mschorsch opened this issue Oct 28, 2022 · 8 comments
Labels
area/core kind/bug Something isn't working triage/invalid This doesn't seem right

Comments

@mschorsch
Copy link

mschorsch commented Oct 28, 2022

Describe the bug

If System.exit is used on the quarkus-main-thread the complete application deadlocks. If i execute System.exit on a different thread then the application terminates as expected.

Maybe this is an expected behaviour as stated in Quarkus#blockingExit but it feels odd.

The behavior should at least be explicitly described in the documentation. What do you think?

Expected behavior

No response

Actual behavior

No response

How to Reproduce?

  1. deadlock_reproducer.zip
  2. ./mvnw quarkus:dev

Output of uname -a or ver

Linux

Output of java -version

Java 17

GraalVM version (if different from Java)

No response

Quarkus version or git rev

Quarkus 2.13.3.Final

Build tool (ie. output of mvnw --version or gradlew --version)

Maven

Additional information

No response

@mschorsch mschorsch added the kind/bug Something isn't working label Oct 28, 2022
@quarkus-bot
Copy link

quarkus-bot bot commented Oct 31, 2022

@geoand
Copy link
Contributor

geoand commented Oct 31, 2022

This is expected as per the Javadoc you linked:

Starts the shutdown process, then waits for the application to shut down. Must not be called by the main thread, or a deadlock will result.

@geoand geoand closed this as not planned Won't fix, can't repro, duplicate, stale Oct 31, 2022
@geoand geoand added the triage/invalid This doesn't seem right label Oct 31, 2022
@geoand
Copy link
Contributor

geoand commented Oct 31, 2022

The behavior should at least be explicitly described in the documentation. What do you think?

Which documentation do you mean here? I don't see Quarkus.blockingExit being explicitly mentioned in any docs.

@mschorsch
Copy link
Author

The behavior should at least be explicitly described in the documentation. What do you think?

Which documentation do you mean here? I don't see Quarkus.blockingExit being explicitly mentioned in any docs.

Thats the problem, the Quarkus documentation does not mention this behaviour.

@geoand
Copy link
Contributor

geoand commented Oct 31, 2022

The Javadoc does however.

I am interested in hearing where you would expect to see this behavior mentioned. Asking because if we just add it to some random place, there is little chance people will actually see it.

@geoand
Copy link
Contributor

geoand commented Oct 31, 2022

Actually, I have another idea... We can detect if this being called on the main thread and print an error

@mschorsch
Copy link
Author

mschorsch commented Oct 31, 2022

Actually, I have another idea... We can detect if this being called on the main thread and print an error

👍 . This is way better than the documentation.

@geoand
Copy link
Contributor

geoand commented Oct 31, 2022

#28939

geoand added a commit to geoand/quarkus that referenced this issue Oct 31, 2022
geoand added a commit that referenced this issue Nov 1, 2022
Warn about usage of Quarkus#blockingExit on the main thread
gsmet pushed a commit to gsmet/quarkus that referenced this issue Nov 1, 2022
gsmet pushed a commit to gsmet/quarkus that referenced this issue Nov 2, 2022
zakkak pushed a commit to zakkak/quarkus that referenced this issue Nov 15, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core kind/bug Something isn't working triage/invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

3 participants