Skip to content

cmd/cdc/server: exits with code 1 on graceful SIGTERM shutdown #4563

@pingyu

Description

@pingyu

What did you do?

I ran TiCDC in new architecture mode in a local integration scene with
replication worker. During normal teardown, the parent process sent SIGTERM
to TiCDC for graceful shutdown.

The scene is not specific to one test case. The important part is:

  1. start cdc server --newarch ...
  2. let TiCDC run normally
  3. send SIGTERM
  4. observe TiCDC logs and the process exit status from the parent supervisor

What did you expect to see?

TiCDC should exit with status 0 after a graceful SIGTERM shutdown.

What did you see instead?

TiCDC appeared to shut down normally in its own logs, but the process exited
with status 1 instead of 0.

This is problematic for supervisors and orchestration logic, because an
intentional graceful shutdown is reported as a failure.

Relevant TiCDC log excerpt:

[2026/03/20 16:28:38.464 +00:00] [INFO] [util.go:117] ["got signal, prepare to shutdown"] [signal=terminated]
[2026/03/20 16:28:38.552 +00:00] [INFO] [util.go:121] ["shutdown complete"]
[2026/03/20 16:28:38.634 +00:00] [INFO] [server.go:153] ["cdc server exits normally"]
[2026/03/20 16:28:38.634 +00:00] [INFO] [server.go:422] ["server closing"] [ServerInfo="ID: cb803d3c-e30d-4173-a806-49aedf672766, AdvertiseAddr: 127.0.0.1:8001, Version: v8.5.6-release.1-62-gedc009d6, GitHash: edc009d6c1d81ffd535096798e865682afd291d5, DeployPath: /cdc, StartTimestamp: 1774023664, Epoch: 0"]
[2026/03/20 16:28:38.941 +00:00] [INFO] [server.go:480] ["server closed"] [ServerInfo="ID: cb803d3c-e30d-4173-a806-49aedf672766, AdvertiseAddr: 127.0.0.1:8001, Version: v8.5.6-release.1-62-gedc009d6, GitHash: edc009d6c1d81ffd535096798e865682afd291d5, DeployPath: /cdc, StartTimestamp: 1774023664, Epoch: 0"]

From the parent supervisor side, the observed result was that TiCDC exited with
code 1 on this graceful shutdown path.

Versions of the cluster

Upstream TiDB cluster version (execute SELECT tidb_version(); in a MySQL client):

tidb-cse 8.5

Upstream TiKV version (execute tikv-server --version):

CSE 8.5

Upstream PD version:

pd-cse 8.5

TiCDC version (execute cdc version):

v8.5.6-release.1-62-gedc009d6
GitHash: edc009d6c1d81ffd535096798e865682afd291d5

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions