Skip to content

[Bug]: bad global time_zone locks out all new connections persistently #31714

Description

@Ariznawlll

Description

SET GLOBAL time_zone accepts any string without validation, persists it cluster-wide, and the stored garbage then breaks the authentication of every new connection on every CN — including after a full cluster restart. One typo in an admin command bricks new logins to the entire deployment; existing sessions continue, so the damage surfaces gradually and the only recovery is offline catalog surgery or wiping the data directory.

Full event chain, verified on main c6683bd2f5 (2026-10-29, dual-CN launch-with-proxy):

  1. No validation at SET time:
SET GLOBAL time_zone = 'Mars/Phobos';   -- OK (accepted, persisted)
SELECT @@global.time_zone;              -- 'Mars/Phobos'

MySQL rejects an unknown zone at SET time with ERROR 1298 (HY000): Unknown or incorrect time zone.

  1. The bogus value poisons new-connection authentication: every fresh connect — including admin — fails during session-variable initialization:
ERROR 1815 (HY000): unknown time zone Mars/Phobos

Reproduced on both CNs (16001 and 16002) and through the proxy (6001). The already-connected session that performed the SET continues working, so the operator who made the typo often sees no immediate failure on their own connection.

  1. The value is PERSISTED across restart: after killing every mo-service process and relaunching the whole cluster (log+tn+cn), new connections still fail with the same ERROR 1815 unknown time zone Mars/Phobos — the bad value is committed to catalog storage (found physically inside mo-data/shared2/* objects), so the standard admin reflex "restart the cluster" cannot recover. Recovery options shrink to: an existing session (if any survived — often none after a restart), offline data surgery, or wiping mo-data.

By contrast, session-scope SET time_zone='bad' correctly errors at statement time (1815 on the SET itself) — only the GLOBAL path skips validation.

Impact

  • Single-statement cluster self-lockout: any admin (or any compromise of an admin connection) can set a nonsense global time zone and permanently lock out new connections with no in-band recovery. Equivalent to an accidental denial-of-service on the whole deployment, persisted.
  • Real-world trigger is mundane: a typo'd IANA name, a stale tool writing time_zone='CST'-style abbreviations, or a config-management push of an unsupported zone under the MySQL assumption that it would error at SET time.

Expected behavior

  • Validate the value at SET GLOBAL time_zone (offset form [+-]HH:MM, SYSTEM, or a known IANA name — mirroring session-scope behavior, which already rejects bad values) and reject unknown zones with the MySQL-compatible 1298.
  • Defense in depth: session initialization should tolerate an invalid persisted global by falling back to the default zone rather than failing authentication.

Reproduction

SET GLOBAL time_zone='Mars/Phobos';  -- OK
-- disconnect, then reconnect anywhere (any CN/proxy):
-- ERROR 1815 unknown time zone Mars/Phobos
-- restart the entire cluster: still ERROR 1815 on connect

main @ c6683bd (2026-10-29), dual-CN launch-with-proxy, pymysql. Local lab was recovered by wiping the data directory (experimental cluster; full evidence chain captured in this report).

Activity

  1. added
    kind/bug
    on Oct 29, 2026
  2. added this to the MO-202610 milestone on Oct 29, 2026
  3. added theissue type on Oct 29, 2026
  4. added a commit that references this issue on Nov 14, 2026
    625865c
  5. XuPeng-SH commented on Nov 14, 2026

    @XuPeng-SH
    Contributor

    已合并范围与剩余研发项

    PR #32456 已合入 main,merge SHA 625865c470631f33da52793a2e2766d63e5a316e,最终 head 86d6fbf32cfb96ed8e0155d6124cec3e568ae4cb。

    证据边界:最终 head 的评审 #32456 (review) 复用 shared build、Ubuntu/x86 UT、arm64 SCA、coverage、PROXY/PESSIMISTIC BVT 成功结论;合并记录 CI Required 成功,队列未重跑 CI。评审只新做 diff check,未新跑 Go/集群,原始 CI/作者日志未供其复核。作者报告定向 BVT 57/57、system_variable 636/636、branch/diff 1976/1976;snapshot 18389/18454,65 项资源准入失败,不能称全目录通过。上述为远端记录和作者报告,本轮没有本地构建或实测。

    已交付:在持久化前复用会话时区解析,拒绝新的非法 GLOBAL time_zone,避免新设置污染后续登录。

    本 issue 原文还明确要求:对已经持久化的非法值进行会话初始化兜底,以及 MySQL 1298 错误码。PR 正文与最终评审明确没有修复旧非法值,也保留既有 unknown-zone 错误码。当前无评论收敛或撤回这两项,因此保留研发负责人,不将部分预防修复写成整个 issue 已完成。此判断依据明确范围,不是未运行测试或旧版本反例永久阻塞;也未执行破坏登录的复现。

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

Metadata

Metadata

Assignees

Labels

kind/bugneeds-triage

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions