Skip to content

Conversation

@jonahgraham
Copy link
Contributor

At the moment the code silently fails on calling timerExec if there are no handles left or it fails for other reasons.

Relates to #2806 where we can see that we are running out of handles, but the timerExec does not report a failure.

@jonahgraham
Copy link
Contributor Author

This is a draft for now because it needs consideration for other platforms and whether after 25 years there is a reason that this case was allowed to fail silently on Windows.

On macOS there is a pointless null check in the same place because an NPE would have already been raised. On GTK I need to investigate more because the functions are not documented as being able to fail.

macOS:

NSTimer timer = NSTimer.scheduledTimerWithTimeInterval(milliseconds / 1000.0, timerDelegate, OS.sel_timerProc_, userInfo, false);
NSRunLoop runLoop = NSRunLoop.currentRunLoop();
runLoop.addTimer(timer, OS.NSModalPanelRunLoopMode);
runLoop.addTimer(timer, OS.NSEventTrackingRunLoopMode);
timer.retain();
if (timer != null) {
nsTimers [index] = timer;
timerList [index] = runnable;
}
}

GTK:

if (GTK.GTK4) {
timerId = OS.g_timeout_add (milliseconds, timerProc, index);
} else {
timerId = GDK.gdk_threads_add_timeout (milliseconds, timerProc, index);
}
if (timerId != 0) {
timerIds [index] = timerId;
timerList [index] = runnable;
}
}

@github-actions
Copy link
Contributor

github-actions bot commented Nov 22, 2025

Test Results

  176 files  ±0    176 suites  ±0   29m 29s ⏱️ + 1m 32s
4 680 tests ±0  4 658 ✅ ±0  22 💤 ±0  0 ❌ ±0 
  485 runs  ±0    479 ✅ ±0   6 💤 ±0  0 ❌ ±0 

Results for commit 34e35bb. ± Comparison against base commit c6ec34e.

♻️ This comment has been updated with latest results.

@jonahgraham jonahgraham self-assigned this Dec 6, 2025
@jonahgraham jonahgraham marked this pull request as ready for review January 20, 2026 18:55
@jonahgraham
Copy link
Contributor Author

This is a draft for now because it needs consideration for other platforms and whether after 25 years there is a reason that this case was allowed to fail silently on Windows.

On macOS there is a pointless null check in the same place because an NPE would have already been raised. On GTK I need to investigate more because the functions are not documented as being able to fail.

My latest commit adds throwing no more handles on macos and gtk if the timer creation routines return 0/null so they also don't silently fail anymore.

I plan to submit this soon if there are no objections.

At the moment the code silently fails on calling timerExec if there
are no handles left or it fails for other reasons.

Relates to eclipse-platform#2806
where we can see that we are running out of handles, but the timerExec
does not report a failure.

On Windows timer handles are related to user objects and are relatively
limited (10,000). For Linux and macOS the timers seem only to fail in
out of memory situations.
@jonahgraham jonahgraham merged commit 8da42cd into eclipse-platform:master Jan 26, 2026
23 checks passed
@jonahgraham jonahgraham deleted the timers branch January 26, 2026 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant