Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-1203] setTimeout Android Issue

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2012-07-26T19:57:10.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAndroid
Labelslook1
ReporterBiztactix
AssigneeNeeraj Gupta
Created2011-04-15T02:46:33.000+0000
Updated2017-03-16T22:05:27.000+0000

Description

The following usecase demonstrates that setTimeout() periods of 1000ms complete successfully for this specific code, whereas those with 3000ms periods do not run.

http://pastebin.com/raw.php?i=4Fzdx1qG">http://pastebin.com/raw.php?i=4Fzdx1qG

I speculate that the reason for this is the script has completed execution within the 3000ms timeout period, causing the timeout to be disregarded. Conversely, 1000ms is long enough for the command/function inside setTimeout() to fire before the script finishes.

Please do not rely on my previous assumptions of tabGroups being the cause of the issue. Also, opening a window is not a reliable workaround - it may have seemed to resolve the issue in some cases, but I think this was simply due to the fact that doing so extended the script execution time long enough for setTimeout to complete.

Please note that investigation into the true cause of this issue is required - the script execution idea I stated above is just a theory.

Please also note Bill Dawson's ticket #3083 regarding setTimeout, which may possibly be relevant.

Original poster noted that the setTimeout timer keeps on ticking away, as evident from the trace.

Comments

  1. Stephen Tramer 2011-04-15

    Assigning to Don for triage.

  2. Marshall Culpepper 2011-05-06

    The reason these timeouts don't work is because you're opening a new activity (TabGroup) on top of the one from app.js. In 3 seconds, the TabGroup has opened, and the Activity that the timeouts exist on is now suspended.
  3. Mark Aalderink 2011-10-28

    sorry, made a mistake: it does work!
  4. Josh Roesslein 2012-07-26

    This should no longer be an issue post 1.8.0 since we removed this suspending behavior.
  5. Lee Morris 2017-03-16

    Closing ticket as fixed.

JSON Source