| Ticket UUID: | 1802895 | ||
| Title: | AfterDelay overflow | ||
| Type: | Bug | Created on: | 2007-09-26 16:02:18 |
| Submitter: | dgp | Assigned to: | aku |
| Subsystem: | 03. Timer Events | Severity: | Minor |
| Priority: | 5 Medium | Last modified: | 2026-10-19 18:00:22 |
| Status: | Open | Closed by: | nobody |
| Resolution: | None | Closed on: | |
| Version: | 8.6.18, 9.0.5 | ||
| Description: | ||||
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? | ||||
| User Comments: | ||||
dgp added on 2007-09-28 02:41:54:
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] dgp added on 2007-10-23 00:29:19:
Logged In: YES user_id=80530 Originator: YES any chance to address this for 8.5b2 ? dgp added on 2007-11-28 01:03:09:
Logged In: YES user_id=80530 Originator: YES status? ferrieux added on 2008-04-01 05:20:44:
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. oehhar added on 2022-08-18 12:32:32:
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 sebres added on 2022-08-18 13:27:58:
Fixed in RFE [fdfbd5e10]. oehhar added on 2022-08-18 14:18:51:
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 sebres added on 2022-08-18 16:13:04:
No. Not if your tcl's internal clock (which can be virtualized) runs a year in a second. oehhar added on 2022-08-18 16:22:35:
Ok, thank you ;-). That is really weared stuff. Harald serhiy.storchaka added on 2026-10-19 18:00:22:
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. | ||||
