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

Hang-up on application close #4

Closed
evgeny-pasynkov opened this issue Jul 16, 2014 · 11 comments
Closed

Hang-up on application close #4

evgeny-pasynkov opened this issue Jul 16, 2014 · 11 comments

Comments

@evgeny-pasynkov
Copy link

Hi!

I have a problem with app termination. The trace of hang thread is:

pool-4-thread-1@1497, prio=5, in group 'main', status: 'RUNNING'
at java.net.SocketInputStream.socketRead0(SocketInputStream.java:-1)
at java.net.SocketInputStream.read(SocketInputStream.java:150)
at java.net.SocketInputStream.read(SocketInputStream.java:121)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:275)
at java.io.BufferedInputStream.read(BufferedInputStream.java:334)
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:633)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:579)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1322)
at sun.net.www.protocol.http.HttpURLConnection.getHeaderFields(HttpURLConnection.java:2700)
at com.github.nkzawa.engineio.client.transports.PollingXHR$Request$1.run(PollingXHR.java:204)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)

@nkzawa
Copy link
Contributor

nkzawa commented Jul 16, 2014

Let me know the details of your problem.
What kind of exception is thrown?

@evgeny-pasynkov
Copy link
Author

Actually, I have no exceptions.
I have console app, which connects to server with Socket.IO-client/Engine.IO-client.
After the app logic is done, I close the socket, but app doesn't exit, because non-daemon thread is stuck on the stack trace above.

@nkzawa
Copy link
Contributor

nkzawa commented Jul 17, 2014

Did you close all the sockets you used?

@evgeny-pasynkov
Copy link
Author

Exactly, I open the single socket, and then close it.
My opts are:

  final IO.Options opts = new IO.Options();
  opts.forceNew = true;
  opts.multiplex = false;
  opts.reconnection = false;
  opts.sslContext = mySslContext;

This hang is 100% stable, so I can re-run it with any extra logging

@nkzawa
Copy link
Contributor

nkzawa commented Jul 19, 2014

Is it correct that polling get stopped and no logs are shown anymore, but your application hangs after that too?
Can you run another process after socket is closed (which means that deadlock is not the cause IMO)?

@nkzawa
Copy link
Contributor

nkzawa commented Jul 19, 2014

Maybe I found the cause of the hang :(
It looks like that ExecutorService which this library uses internally must be shut down to release.

I'm going to fix the problem.
I think you can call System.exit(0) to terminate your app for now.

@evgeny-pasynkov
Copy link
Author

Just ping :)

@nkzawa nkzawa closed this as completed in f3057dd Aug 16, 2014
@nkzawa
Copy link
Contributor

nkzawa commented Aug 16, 2014

@evgeny-pasynkov Fixed. thank you for reporting!

@nkzawa nkzawa reopened this Aug 16, 2014
@nkzawa
Copy link
Contributor

nkzawa commented Aug 16, 2014

Wait. It's broken.

@nkzawa
Copy link
Contributor

nkzawa commented Aug 16, 2014

fixed 21fb11f

@nkzawa nkzawa closed this as completed Aug 16, 2014
@evgeny-pasynkov
Copy link
Author

Thank you, this fixes my scenario

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

2 participants