[AC-3141] Android - sending message to a Handler on a dead thread
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Needs more info |
Resolution Date | 2011-09-07T07:22:15.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Appcelerator Modules |
Labels | 1.6.2, android, httpclient |
Reporter | Emrah Mehmedov |
Assignee | Paul Dowsett |
Created | 2011-08-10T14:43:02.000+0000 |
Updated | 2016-03-08T07:48:12.000+0000 |
Description
When trying to reuse same httpclient (in function for sync server).
first time work, after first time i got this error.
Console:
E/TiBaseActivity( 299): (main) [1089,69978] Layout cleanup.
D/dalvikvm( 299): GC_FOR_MALLOC freed 15445 objects / 734008 bytes in 175ms
I/TiAPI ( 299): (kroll$5: app://combobox.js) [4560,74538] Sync - uid: 36 date: 2011-5-2
D/dalvikvm( 299): GC_FOR_MALLOC freed 7275 objects / 298704 bytes in 175ms
D/TiHttpClient( 299): (TiHttpClient-2) [1133,75671] Setting ready state to 2
D/TiHttpClient( 299): (TiHttpClient-2) [2,75673] Setting ready state to 3
D/TiHttpClient( 299): (TiHttpClient-2) [6,75679] Setting ready state to 4
W/MessageQueue( 299): Handler{43f203a0} sending message to a Handler on a dead thread
W/MessageQueue( 299): java.lang.RuntimeException: Handler{43f203a0} sending message to a Handler on a dead thread
W/MessageQueue( 299): at android.os.MessageQueue.enqueueMessage(MessageQueue.java:179)
W/MessageQueue( 299): at android.os.Handler.sendMessageAtTime(Handler.java:457)
W/MessageQueue( 299): at android.os.Handler.sendMessageDelayed(Handler.java:430)
W/MessageQueue( 299): at android.os.Handler.post(Handler.java:248)
W/MessageQueue( 299): at org.appcelerator.titanium.kroll.KrollCallback.callAsync(KrollCallback.java:162)
W/MessageQueue( 299): at org.appcelerator.titanium.kroll.KrollCallback.callAsync(KrollCallback.java:96)
W/MessageQueue( 299): at org.appcelerator.titanium.kroll.KrollCallback.callAsync(KrollCallback.java:91)
W/MessageQueue( 299): at ti.modules.titanium.network.TiHTTPClient.fireCallback(TiHTTPClient.java:489)
W/MessageQueue( 299): at ti.modules.titanium.network.TiHTTPClient.fireCallback(TiHTTPClient.java:480)
W/MessageQueue( 299): at ti.modules.titanium.network.TiHTTPClient.setReadyState(TiHTTPClient.java:512)
W/MessageQueue( 299): at ti.modules.titanium.network.TiHTTPClient$ClientRunnable.run(TiHTTPClient.java:1006)
W/MessageQueue( 299): at java.lang.Thread.run(Thread.java:1096)
When i try to send again same request to server on android device..
Thank you for raising this ticket. In order to progress it, please add the missing information *in the format and places* requested in the guidelines at [Jira Ticket Checklist](http://wiki.appcelerator.org/display/guides/Contributing+to+Titanium#ContributingtoTitanium-Summary%3AJiraTicketChecklist). For instance, in the environment field: * *Titanium SDK version:* number, build date and build hash, copied and pasted from the console at application launch * *Platform & version:* iOS x.x, Android x.x, Blackberry x.x, OSX x.x, Windows x, Ubuntu x.x * *Device Details:* iOS simulator, Android emulator or physical device model * *Host Operating System:* OSX x.x, Windows x, Ubuntu x.x * *Titanium Studio version:* copied and pasted from Help / About In the description: * *a link to the Q&A question*, where you asked the community to verify the observed behavior * *a* *[simple usecase](http://wiki.appcelerator.org/display/guides/Contributing+to+Titanium#ContributingtoTitanium-CreatingGoodUsecases)**:* working code that demonstrates issue, placed within a \{code\} wiki markup block * *logs:* the console output of any exceptions, placed within a \{code\} wiki markup block Many thanks in advance
I did notice this kind of error messages number of times, not related to the HTTPclient. I didn't figure out what exactly is happening there (and didn't manage to create simple use-case), but I think that in some cases Titanium doesn't clear all event handlers, so when some thread finishes, Titanium tries to publish event that was left on that thread. I wrote my own event system in which I register and unregister events when window closes by myself. These kind of exceptions disappeared with that approach. I think that Titanium framework should check is event published to the dead thread (if that is possible) and if it is raise a warning in console (some kind of link with JS file would be great). That way, these kind of exceptions would disappear. This is just my theory, I hope I didn't miss much. :)
Sorry, Ivan, as there has been no response from the owner, I must start the closing process. If you are able to reproduce/prove the issue using simple code, you are welcome to raise a new ticket, and then we can get it in front of the core team. Many thanks
Ticket resolved and not updated since last curator action.