Skip to content

chore: remove tidb slowlog container#2426

Open
cjc7373 wants to merge 1 commit intomainfrom
support/remove-tidb-slowlog-container
Open

chore: remove tidb slowlog container#2426
cjc7373 wants to merge 1 commit intomainfrom
support/remove-tidb-slowlog-container

Conversation

@cjc7373
Copy link
Contributor

@cjc7373 cjc7373 commented Feb 4, 2026

Slowlog is stored in file. This container merely displays it. Due to some signal handling problems, this container blocks the pod grace shutdown process. So I think the easiest way is to delete it.

@cjc7373 cjc7373 requested review from a team as code owners February 4, 2026 11:49
@cjc7373 cjc7373 added the pick-1.1 Auto cherry-pick to release-1.1 when PR merged label Feb 4, 2026
@shanshanying
Copy link
Contributor

can we TRAP the TERM signal ?

@cjc7373
Copy link
Contributor Author

cjc7373 commented Feb 9, 2026

I have tested two ways.

The first is to trap sigterm. However, it seems busybox's sh won't handle signal until the runnning command ends. Tested with:

      command:
        - bin/sh
        - -c
        - |
          trap "echo 'received SIGTERM, sleeping 10s...'; sleep 10; echo 'exiting now'; exit 0" SIGTERM
          echo "starting..."
          sleep 20

PS. bash also has similar behavior, excerpt from bash manual:

If Bash is waiting for a command to complete and receives a signal for which a trap has been set, it will not execute the trap until the command completes.

The second is to use exec to replace current shell process:

      command:
        - bin/sh
        - -c
        - |
          echo "starting..."
          touch /tmp/log.txt
          exec tail -n0 -F /tmp/log.txt

It doesn't work either. Looks like busybox's tail won't handle sigterm.

@shanshanying
Copy link
Contributor

It seems sleep blocks TERM. can we for example, kill the TAIL task by PID on receiving the signal
e.g

# trap TERM
trap graceful_exit TERM INT

# get tail pid and wait for it
tail -n0 -F /tmp/log.txt &
TAIL_PID=$!
wait $TAIL_PID

and this graceful_exit function kill the TAIL_PID, for example:

    graceful_exit() {
      kill -TERM $TAIL_PID 2>/dev/null
      exit 0
    }

@cjc7373
Copy link
Contributor Author

cjc7373 commented Feb 10, 2026

Yes, this can work!

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

Labels

pick-1.1 Auto cherry-pick to release-1.1 when PR merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants