Skip to content

[Bug]: Severe Event Loop Blocking / Freezing due to Synchronous I/O (execSync, readFileSync) #78805

Closed as not planned

Description

@darklilyhand

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

Hello, I am experiencing severe performance degradation and freezing issues with the Openclaw gateway. The main Node.js thread frequently blocks for up to 4 seconds, which causes connected channels (e.g., Telegram) to timeout, resulting in infinite pending states and duplicated message sends.

Steps to reproduce

Error Logs:
The logs show massive event loop delays:
[diagnostic] liveness warning: reasons=event_loop_delay interval=30s eventLoopDelayMaxMs=3936.4 eventLoopUtilization=0.341

Root Cause Analysis:
Upon inspecting the compiled source code, I found that the gateway heavily relies on synchronous operations on the main thread:

  1. Keychain Access Blocking: The most critical issue is the use of execSync for macOS keychain access (security find-generic-password) in store-DL6VwwSr.js. This operation is notoriously slow and completely halts the event loop until it returns.
  2. Synchronous File Reading: Numerous instances of fs.readFileSync (e.g., parsing DeviceAuthStoreSchema, checking credentials, storage metadata) instead of asynchronous fs.promises.readFile.

Expected behavior

Expected Behavior:
Could you please refactor these critical path operations to be asynchronous (exec / spawn / fs.promises)? The current synchronous architecture makes it impossible to use heavier models or maintain stable WebSocket/Telegram connections without the gateway completely stalling.

Thank you!

Actual behavior

Expected Behavior:
Could you please refactor these critical path operations to be asynchronous (exec / spawn / fs.promises)? The current synchronous architecture makes it impossible to use heavier models or maintain stable WebSocket/Telegram connections without the gateway completely stalling.

Thank you!

OpenClaw version

2026.5.6

Operating system

macOS

Install method

npm global

Model

Gemini 3.1 pro preview

Provider / routing chain

google

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

Activity

  1. clawsweeper commented on May 7, 2026

    @clawsweeper
    Contributor

    Codex review: this still needs some work.

    Summary
    Keep this issue open because an open repair explicitly references it for closure, and current evidence does not establish that the reported freezes are fixed.

    Reproducibility: no. high-confidence current-main reproduction is established: historical logs show stalls, but current caller guards and worker-backed storage prevent attributing them to the cited operations without a timing trace.

    Next step
    Establish the blocking operation and measured Gateway responsiveness through the existing linked repair before claiming this issue is resolved.

    Review details

    Best possible solution:

    Remove measured blocking work at its owning production boundary while preserving credential selection and channel responsiveness.

    Do we have a high-confidence way to reproduce the issue?

    No high-confidence current-main reproduction is established: historical logs show stalls, but current caller guards and worker-backed storage prevent attributing them to the cited operations without a timing trace.

    Is this the best way to solve the issue?

    A measured repair of the blocking production path is appropriate; replacing synchronous operations wholesale would change unrelated behavior without establishing which operation causes these freezes.

    AGENTS.md: found and applied where relevant.

    Remaining risk / open question:

    • No current-main timing trace isolates the reported Google/Telegram freezes, and the proposed credential repair may cover only part of the cross-platform symptoms.

    Codex review notes: model internal, reasoning medium; reviewed against c3b63ff4c0ec.

    Label changes

    Label changes:

    No label changes.

    Label justifications:

    • P1: Reported multi-second Gateway freezes disrupt active channel and agent workflows on official releases.
    • impact:crash-loop: Repeated event-loop stalls make the Gateway temporarily unresponsive.
    • impact:message-loss: The report describes channel timeouts, indefinitely pending messages, and duplicate sends.
    Evidence reviewed

    What I checked:

    How this review workflow works
    • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
    • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
    • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
    • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
    • Maintainers can also comment @clawsweeper review to request a fresh review only.
    • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge; those execution lanes are retired.
    • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

    Reviewed October 15, 2026, 7:40 PM ET / 23:40 UTC.

  2. davidjoshua7692-code commented on May 15, 2026

    @davidjoshua7692-code

    👍 Also seeing this on Linux (WSL2) with Telegram channel.

    Verbose log shows the same pattern:

    liveness warning: reasons=event_loop_delay
    eventLoopDelayMaxMs=7579~8124
    phase=channels.telegram.start-account
    eventLoopUtilization=0.3~0.53
    
    • OpenClaw version: latest (2026.5.x)
    • OS: Ubuntu on WSL2 (Windows 11, x64)
    • Channel: Telegram
    • CPU: 28 cores / 32GB RAM (resources are not the bottleneck)
    • Block duration: ~8s every 30s during startup phase
    • The warning persists after startup stabilizes

    The channels.telegram.start-account phase consistently blocks the event loop for 7-8 seconds, which also causes fetch-timeout warnings for other concurrent operations.

    Hope the async refactor can cover all channel types, not just WhatsApp. Happy to provide more verbose logs if needed!

  3. htqx2022-art commented on May 17, 2026

    @htqx2022-art

    Still experiencing this on v2026.5.12 (Windows, Telegram channel). Liveness warnings show event loop delays up to 16 seconds:

    liveness warning: eventLoopDelayMaxMs=16005.5 eventLoopUtilization=0.441
    

    This is particularly painful during startup and model-resolution phases. Combined with Moonshot API's occasional 429 rate limits, a single user message can take 3-4 minutes to get a response.

    PR #78818 has been open for a while with no maintainer review. Is there a timeline for addressing the synchronous I/O hotspots? This is a fundamental architecture issue that degrades the experience for all users, especially those running OpenClaw as a persistent service (e.g., Telegram bot).

  4. openclaw-barnacle commented on Jun 1, 2026

    @openclaw-barnacle

    This issue has been automatically marked as stale due to inactivity.
    Please add updates or it will be closed.

  5. added
    P1High-priority user-facing bug, regression, or broken workflow.
    impact:crash-loopCrash, hang, restart loop, or process-level availability failure.
    impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.
    impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.
    issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.
    on Jun 14, 2026
  6. 51 remaining items

  7. added
    impact:crash-loopCrash, hang, restart loop, or process-level availability failure.
    issue-rating: 🦪 silver shellfishThin issue quality; more reproduction proof or environment detail is needed.
    and removed
    clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.
    issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.
    on Sep 5, 2026
  8. openclaw-barnacle commented on Sep 20, 2026

    @openclaw-barnacle

    This bug report has been automatically marked as stale due to inactivity.
    ClawSweeper is checking whether current main already fixes the reported behavior.
    Inactivity alone will not close a bug report.

  9. added
    staleMarked as stale due to inactivity
    and removed
    staleMarked as stale due to inactivity
    on Sep 20, 2026
  10. added
    clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.
    issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.
    and removed
    issue-rating: 🦪 silver shellfishThin issue quality; more reproduction proof or environment detail is needed.
    on Sep 20, 2026
  11. added
    issue-rating: 🦪 silver shellfishThin issue quality; more reproduction proof or environment detail is needed.
    and removed
    clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.
    issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.
    on Oct 9, 2026
  12. steipete commented on Oct 24, 2026

    @steipete
    Contributor

    Thanks for filing this. We're closing older issues that no longer look actionable on current main.

    The cited sync I/O paths are now guarded or worker-backed, and we couldn't confirm these freezes on current main. If you still see long event-loop stalls on a current release, please open a fresh issue with a timing trace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority user-facing bug, regression, or broken workflow.bugSomething isn't workingclawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:crash-loopCrash, hang, restart loop, or process-level availability failure.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.issue-rating: 🦪 silver shellfishThin issue quality; more reproduction proof or environment detail is needed.regressionBehavior that previously worked and now fails

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions