Skip to content

fix: implement trampoline pattern for GLib callbacks to prevent purego slot exhaustion#170

Merged
bnema merged 2 commits intomainfrom
fix/update-puregotk-go1-26
Feb 13, 2026
Merged

fix: implement trampoline pattern for GLib callbacks to prevent purego slot exhaustion#170
bnema merged 2 commits intomainfrom
fix/update-puregotk-go1-26

Conversation

@bnema
Copy link
Owner

@bnema bnema commented Feb 13, 2026

Problem

GLib source functions previously allocated a new purego callback slot for every invocation. purego has a hard limit of 2000 slots, so long-running programs that schedule many one-shot idle/timeout callbacks would exhaust the pool and panic.

Solution

The trampoline uses a single purego callback that dispatches through a Go-side map keyed by an opaque ID passed as GLib's user_data pointer. All IdleAdd/TimeoutAdd calls share ONE purego slot regardless of how many are outstanding.

Changes

  • Added trampoline infrastructure in templates/glib
  • Updated templates/go to use trampoline for IdleAdd/TimeoutAdd family
  • Generated code updates in v4/glib/*.go
  • Bumped puregotk to Go 1.26 compatible version

Impact

This fixes the issue where dumber would close unexpectedly after running for extended periods due to callback slot exhaustion.

Summary by CodeRabbit

  • Chores
    • Updated Go toolchain to 1.26 for build consistency.
    • Bumped an internal dependency to a newer compatible release.
    • Upgraded CI lint tool to a newer version to align linting with current standards.

@coderabbitai
Copy link

coderabbitai bot commented Feb 13, 2026

📝 Walkthrough

Walkthrough

Go toolchain in go.mod is updated from 1.25.3 to 1.26; the replace directive for github.com/jwijenbergh/puregotk is changed from a commit pseudo-version to v0.1.0. CI workflow updates the installed golangci-lint version from v2.6.2 to v2.9.0.

Changes

Cohort / File(s) Summary
Dependency Management
go.mod
Bump go directive from 1.25.3 to 1.26; change replace github.com/jwijenbergh/puregotk from pseudo-version v0.0.0-20260212181341-fb13c245f9f0 to v0.1.0.
CI Workflow
.github/workflows/ci.yml
Update golangci-lint installation version from v2.6.2 to v2.9.0.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 I hopped through modules, light and spry,

Go 1.26 beneath the sky,
PureGOTK donned a brand-new coat,
Linters tuned to brighter note,
A rabbit's cheer — commit and fly!

🚥 Pre-merge checks | ✅ 3 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title describes implementing a trampoline pattern for GLib callbacks, but the actual changes shown are only Go toolchain version bumps and golangci-lint updates with no visible implementation of the trampoline pattern itself. The title claims to implement a significant architectural pattern but the changeset only contains dependency/toolchain updates. Verify if the core implementation changes are missing from this PR, or update the title to accurately reflect that this is a preparatory dependency update.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/update-puregotk-go1-26

No actionable comments were generated in the recent review. 🎉


Comment @coderabbitai help to get the list of available commands and usage tips.

@bnema bnema merged commit f71271c into main Feb 13, 2026
3 of 4 checks passed
@bnema bnema deleted the fix/update-puregotk-go1-26 branch February 13, 2026 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant