Skip to content

v2026.4.26: gateway restart can hang ~3-4 min before new process starts #73303

Closed

Description

@githubdulong

Summary

On macOS (LaunchAgent mode), restarting Gateway on v2026.4.26 can sometimes take ~3-4 minutes before the new process starts, even though normal startup is only a few seconds.

Environment

  • OpenClaw: 2026.4.26 (be8c246)
  • OS: macOS 15/26 (arm64)
  • LaunchAgent label: ai.openclaw.gateway
  • Active channel plugins include: openclaw-weixin, telegram

Observed behavior

A restart is requested (SIGTERM), but old process appears to linger for minutes before fresh startup begins.

Example timeline from logs:

  • 12:57:37 [gateway] received SIGTERM; restarting
  • 13:01:15 [gateway] loading configuration…
  • 13:01:38 [gateway] ready

So total restart wall time is ~4 min, while internal startup path is fast:

  • http server listening (...; 3.4s)

Additional signal

During startup there is also a silent gap before weixin provider init:

  • 13:01:18.780 hooks loaded
  • 13:01:38.209 weixin provider starting
    (~20s no logs)

Not sure if related, but the main pain is the pre-start delay between SIGTERM and fresh config load.

Also seen in same logs

Config warning for plugin manifest metadata:

  • channel plugin manifest declares openclaw-weixin without channelConfigs metadata

(We tested adding channelConfigs: {} locally, but restart latency behavior still reproduced.)

Impact

Operationally painful for frequent restarts/debugging; perceived as "restart is stuck".

Request

Could you help check:

  1. whether shutdown path in 2026.4.26 can block launchd supervisor restart;
  2. whether plugin/channel teardown has a long timeout path without intermediate logs;
  3. whether this is a known regression in 2026.4.26 and if a patch/workaround exists.

If useful, I can provide full redacted log slice around restart.

Activity

  1. githubdulong commented on Apr 28, 2026

    @githubdulong
    Author

    补充一个同环境现象(同一台 macOS,v2026.4.26):

    • 不只是 gateway restart 慢,切换模型后首轮响应也会卡很久(明显高于历史版本)。
    • 体感上像是模型切换触发了较重的内部重建/等待路径(可能与 channel/plugin sidecars 或上下文压缩/缓存状态有关)。

    如果需要我可以再提供:

    1. 切换模型时的完整时间线日志(从切换请求到首 token);
    2. 对比同会话下不同 provider(deepseek / antigravity)的延迟差异。
  2. sktbrd commented on Apr 28, 2026

    @sktbrd
    Contributor

    same thing here

  3. Vksh07 commented on Apr 28, 2026

    @Vksh07

    same issue

  4. raydoomed commented on Apr 28, 2026

    @raydoomed

    一样的问题,从24版本就开始了,一直没修好

  5. SecretGuestZ commented on Apr 28, 2026

    @SecretGuestZ

    越升级越不行 哎 江河日下
    现在启动慢 active memory也有问题 每次都要卡

  6. HakuyaSakuragi commented on Apr 28, 2026

    @HakuyaSakuragi

    same

  7. yourfei commented on Apr 28, 2026

    @yourfei

    一样的问题,从24版本就开始了,一直没修好

    目前2026.4.23用起来还不错,23后面的升级直接启动不了

  8. xifengxx commented on Apr 28, 2026

    @xifengxx

    一样的问题,gateway重启卡死要几分钟才正常,然后Web/Lark/TG Channel里聊天响应速度很慢,之前是秒级响应,现在是分钟级响应了,体验起来非常差

  9. joyous-coder commented on Apr 28, 2026

    @joyous-coder

    啊,不是我一个人感觉变得特别卡。原来的版本结合MiniMax,回答的就很快,现在就各种卡。

  10. jsompis commented on Apr 28, 2026

    @jsompis

    same here all .24-.26 didn't work, rolled back to .23

  11. harold-tsui commented on Apr 28, 2026

    @harold-tsui

    卡就算了,进程杀一个又出来一个,这功能太神奇了

  12. clawsweeper commented on Apr 30, 2026

    @clawsweeper
    Contributor

    Thanks for the context here. I did a careful shell check against current main, and this is already implemented.

    Current main has shipped the maintainer-approved restart drain controls that the earlier review said were missing: operators can now force an immediate managed restart, set a per-restart wait budget, use the safe coordinated restart path, and see active task blockers before the drain waits.

    So I’m closing this as already implemented rather than keeping a duplicate issue open.

    Review details

    Best possible solution:

    Keep the shipped restart controls and docs; if plain restart should change default semantics or Weixin/model startup remains slow, track that as a narrower follow-up with fresh logs on a current release.

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

    Yes for the historical mechanism: source and tests show managed restart can enter the active-work drain and wait up to the configured budget. I did not live-reproduce the exact macOS plus plugin timing from the report on current main.

    Is this the best way to solve the issue?

    Yes. The shipped solution preserves compatibility for plain service-manager restarts while adding explicit --force, --wait, --safe, and --safe --skip-deferral paths plus blocker logging, which is the maintainable policy split the earlier review requested.

    Security review:

    Security review: Non-PR issue triage; no patch security or supply-chain review applies.

    What I checked:

    • Issue discussion: The issue body gives a v2026.4.26 SIGTERM-to-next-config-load timeline of about four minutes, and multiple independent commenters reported similar .24-.26 restart or response-latency regressions with rollbacks to .23; the prior ClawSweeper comment identified the active-work restart drain as the likely mechanism.
    • CLI exposes immediate and bounded restart controls: gateway restart now accepts --force to restart without waiting for active Gateway work and --wait <duration> to override the drain budget for one restart. (src/cli/daemon-cli/register-service-commands.ts:130, bf16038b5c61)
    • Service-manager restart intent carries the operator choice: The daemon restart path parses --force into { force: true }, parses --wait into waitMs, and writes that intent before calling the service manager restart. (src/cli/daemon-cli/lifecycle.ts:129, bf16038b5c61)
    • Gateway run loop implements the escape hatch: On SIGTERM/SIGUSR1 restart, current main consumes the restart intent; a forced restart skips active task and embedded-run waiting, while waitMs overrides the drain timeout. (src/cli/gateway-cli/run-loop.ts:416, bf16038b5c61)
    • Regression coverage locks the behavior: Tests assert service-manager intents preserve wait options, SIGTERM restart wait overrides are honored, and forced restarts do not call the active-work wait helpers while logging the blocker and forced-restart message. (src/cli/gateway-cli/run-loop.test.ts:382, bf16038b5c61)
    • User docs describe the supported operator paths: The Gateway and daemon docs now document plain restart compatibility, --safe, --safe --skip-deferral, --wait 30s, and --force as the immediate override path when the operator wants the Gateway back now. Public docs: docs/cli/gateway.md. (docs/cli/gateway.md:117, bf16038b5c61)

    Likely related people:

    • vincentkoc: Authored the shipped fix(gateway): expose restart drain controls commit and also worked on the bounded default restart deferral shortly before this report. (role: implemented restart drain controls; confidence: high; commits: f6f8d74419a1, 1f41b8b44ba0; files: src/cli/gateway-cli/run-loop.ts, src/cli/daemon-cli/lifecycle.ts, src/infra/restart.ts)
    • NikolaFC: Merged the explicit safe restart coordinator that complements the force/wait controls and keeps default restart behavior unchanged while offering an OpenClaw-aware path. (role: safe restart follow-up contributor; confidence: medium; commits: 103cdd9d96f8; files: src/infra/restart-coordinator.ts, src/cli/daemon-cli/lifecycle.ts, docs/cli/gateway.md)
    • steipete: Recent commit history on src/daemon/launchd.ts and restart-related files shows repeated macOS LaunchAgent restart and release-stabilization work around this timeframe. (role: recent launchd and lifecycle contributor; confidence: medium; commits: 1ace6a0d6a0d, 1f88cb2ce5dd, fa79e9754ecc; files: src/daemon/launchd.ts, src/cli/gateway-cli/run-loop.ts, src/infra/restart.ts)
    • clawyouseeme: Earlier history shows the active-turn drain was added to prevent message loss on restart, which is the behavior that made slow restarts possible before the later force/wait controls. (role: introduced active-turn restart drain behavior; confidence: medium; commits: acb9cbb89834; files: src/cli/gateway-cli/run-loop.ts, src/process/command-queue.ts)
    • Bridgerz: Earlier history broadened restart deferral to wait for queued operations, pending replies, and embedded runs before restart, which is adjacent to the reported delay mechanism. (role: introduced broader reply restart deferral; confidence: medium; commits: ab4a08a82acc; files: src/infra/restart.ts, src/cli/gateway-cli/run-loop.ts, src/gateway/server-reload-handlers.ts)

    Codex review notes: model gpt-5.5, reasoning high; reviewed against bf16038b5c61; fix evidence: release v2026.5.3, commit f6f8d74419a1.

  13. locked as resolved and limited conversation to collaborators on May 15, 2026
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

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions