|
2026-11-27
| ||
| 07:59 | • Closed ticket [1802895fff]: AfterDelay overflow plus 7 other changes artifact: ed08d851c0 user: jan.nijtmans | |
|
2026-11-26
| ||
| 19:46 | Fix [180289]: AfterDelay overflow leaf check-in: 8cc849b52a user: jan.nijtmans tags: core-8-6-branch | |
| 19:44 | Fix [180289]: AfterDelay overflow leaf check-in: c03164a4ab user: jan.nijtmans tags: core-9-0-branch | |
| 17:34 | • Ticket [1802895fff] AfterDelay overflow status still Open with 3 other chang... artifact: 272c443b4e user: serhiy.storchaka | |
|
2026-10-19
| ||
| 18:00 | • Ticket [1802895fff]: 4 changes artifact: 5c9ed9a033 user: serhiy.storchaka | |
| 17:55 | Fix [96c3f3b47d] and [1802895fff]: [after] with a delay over about 12 years overflowed the seconds w... closed check-in: d7e3050ca6 user: serhiy.storchaka tags: after-overflow-8-6 | |
| 17:55 | Fix [1802895fff]: [after] with a delay close to 2**63 ms could overflow the time arithmetic, so a bl... closed check-in: 42f3de85fb user: serhiy.storchaka tags: after-overflow-9-0 | |
|
2022-08-18
| ||
| 16:22 | • Ticket [1802895fff] AfterDelay overflow status still Open with 4 other chang... artifact: fb435b3693 user: oehhar | |
| 16:13 | • Ticket [1802895fff]: 3 changes artifact: b511655eaa user: sebres | |
| 14:18 | • Ticket [1802895fff]: 4 changes artifact: 810623ccdd user: oehhar | |
| 13:27 | • Ticket [1802895fff]: 3 changes artifact: 3ba9e47b17 user: sebres | |
| 12:32 | • Ticket [1802895fff]: 9 changes artifact: f7de59c695 user: oehhar | |
| 12:13 | • Ticket [a11678b759] documentation improvement: "after 0 cmd" statu... artifact: 1e6e90fe1e user: oehhar | |
|
2008-04-01
| ||
| 05:20 | • Ticket [1802895fff] AfterDelay overflow status still Open with 4 other chang... artifact: 08380f4819 user: ferrieux | |
|
2007-11-28
| ||
| 01:03 | • Ticket [1802895fff]: 4 changes artifact: d47bb1fefa user: dgp | |
|
2007-10-23
| ||
| 00:29 | • Ticket [1802895fff]: 4 changes artifact: 56703159b3 user: dgp | |
|
2007-09-28
| ||
| 02:41 | • Ticket [1802895fff]: 5 changes artifact: b66fa1c1ce user: dgp | |
|
2007-09-26
| ||
| 16:02 | • New ticket [1802895fff]. artifact: f5681750a5 user: dgp | |
AfterDelay overflow
On 32-bit Linux (Centos 5): % after [expr 0b1101111010111101100000000000000000000000] % Returns immediately. Seems to be something amiss in AfterDelay() perhaps some long vs. Tcl_WideInt calculations?
d7e3050ca6Fix [96c3f3b47d] and [1802895fff]: [after] with a delay over about 12 years overflowed the seconds where long is 32 bits (Windows, 32-bit systems), so later timers never fired and a blocking [after] returned at once. Add the delay with a saturating TimeAddMs(). check-in2026-10-19 17:55:3242f3de85fbFix [1802895fff]: [after] with a delay close to 2**63 ms could overflow the time arithmetic, so a blocking [after] returned at once. Add the delay with a saturating TimeAddMs(). check-in2026-10-19 17:55:31
Logged In: YES user_id=80530 Originator: YES the trouble is that the Tcl_Time .sec field is a long, limited to the long range, and when sizeof(Tcl_WideInt) > sizeof(long) the endTime can overflow that limit. after [expr 1000<30]
Logged In: YES user_id=80530 Originator: YES any chance to address this for 8.5b2 ?
Logged In: YES user_id=80530 Originator: YES status?
Logged In: YES user_id=496139 Originator: NO To allow for delays larger than the internal syscall's limit, what about a self-reposting large timer ? This would allow for alternative syscalls (like in TIP 302) even though they may reduce the span of one-shot timers.
Still present in TCL 8.6.12 and TCL 8.7b5.
So, updating the version field from 8.5a7 to 8.6.
This is not severe, as we don't crash or block. To say, it could be worse ;-).
Take care, Harald
Fixed in RFE [fdfbd5e10].
Just to point to possible fix - take a look for TclpGetUTimeFromObj (that used in Tcl_AfterObjCmd now) in diff.
Basically it falls back to 0x7FFFFFFFFFFFFFFFL µs when double representing time offset is larger than 0x7FFFFFFFFFFFFFFFL µs.
(The branch has better timer granularity and timers are microseconds precise, so even floating point values are possible).
And 0x7FFFFFFFFFFFFFFFL µs corresponds to 292277024 years.
Thanks, Sergey !
That is your magic wizard stuff nobody can take, as nobody understands it, but you. We all would love to have it in, at least 9.0.
I would really say, that "after" with more than 1 year does not make any sense and should run into an error.
Thanks and take care, Harald
I would really say, that "after" with more than 1 year does not make any sense and should run into an error.
No. Not if your tcl's internal clock (which can be virtualized) runs a year in a second.
The time is scalable in Tcl - tclGetTimeProcPtr,tclScaleTimeProcPtr are mostly NativeGetTime,NativeScaleTime, but some things may expect different speed of time (very very fast clock even).
Ok, thank you ;-). That is really weared stuff. Harald
Fixed on main by TIP 723 (too large delays give "time too far away"). Still present in 9.0 and 8.6: a blocking after 0x7fffffffffffffff returns at once on 64-bit systems (the millisecond arithmetic overflows), and where long is 32 bits any delay over about 11 years does. Proposed fix in branches after-overflow-9-0 and after-overflow-8-6: both forms of [after] add the delay with a saturating TimeAddMs(). Tests timer-11.3 (fails without the fix on 9.0; its script returns at once on 8.6.18 too) and 11.4.
Jan, could you please merge after-overflow-9-0 into core-9-0-branch and after-overflow-8-6 into core-8-6-branch? Both still merge cleanly; timer.test passes, and timer-11.3 fails without the fix on current 9.0 and 8.6.
Now merged to core-9-0-branch and core-8-6-branch too
Thanks for reminding me!