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

IllegalStateException scheduling transport activity timer #418

Closed
paddybyers opened this Issue Aug 16, 2018 · 2 comments

Comments

1 participant
@paddybyers
Copy link
Member

paddybyers commented Aug 16, 2018

I'm seeing a crash in AblyRealtime on Android. It looks like in WebSocketTransport, a timer is set that checks to see if the connection should be automatically closed. When the timer is canceled, the active implementation throws an IllegalStateException (Timer was canceled), which isn't handled and causes the app to crash. I'd like either support to help identifying how we can avoid canceling this task when closing the app, or updating the SDK so that it doesn't crash when this timer is canceled.

@paddybyers

This comment has been minimized.

Copy link
Member

paddybyers commented Aug 16, 2018

Stack trace:

Fatal Exception: java.lang.IllegalStateException

Timer already cancelled.

Raw Text

java.util.Timer.sched (Timer.java:397)
java.util.Timer.schedule (Timer.java:193)
io.ably.lib.transport.WebSocketTransport$WsClient.checkActivity (WebSocketTransport.java:294)
io.ably.lib.transport.WebSocketTransport$WsClient.access$500 (WebSocketTransport.java:146)
io.ably.lib.transport.WebSocketTransport$WsClient$WsClientTimerTask.run (WebSocketTransport.java:313)
java.util.TimerThread.mainLoop (Timer.java:555)
java.util.TimerThread.run (Timer.java:505) 
@paddybyers

This comment has been minimized.

Copy link
Member

paddybyers commented Aug 16, 2018

I'm looking at this:

https://docs.oracle.com/javase/7/docs/api/java/util/Timer.html

If the timer's task execution thread terminates unexpectedly, for example, because its stop method is invoked, any further attempt to schedule a task on the timer will result in an IllegalStateException

@paddybyers paddybyers changed the title IllegalStateException cancelling transport activity timer IllegalStateException scheduling transport activity timer Aug 16, 2018

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