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

IllegalStateException scheduling transport activity timer #418

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

IllegalStateException scheduling transport activity timer #418

paddybyers opened this issue Aug 16, 2018 · 2 comments

Comments

@paddybyers
Copy link
Member

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
Copy link
Member Author

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
Copy link
Member Author

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
Labels
None yet
Development

No branches or pull requests

1 participant