Skip to content

Commit c794cb8

Browse files
committed
CI: run timeout inside sudo, per apt command, so the kill reaches apt-get
Addresses Copilot review on QuantEcon/lecture-intro.zh-cn#301: with timeout wrapping sudo, a timed-out attempt terminated sudo and the bash -c shell but could orphan apt-get holding the dpkg lock, making the retry block instead of retry. timeout is now the direct parent of each apt-get (inside sudo, -k 30s escalation): update 1m/2m, install 3m/12m for graphviz/texlive. Step budgets unchanged.
1 parent 20a5568 commit c794cb8

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,12 @@ jobs:
3838
- name: Install latex dependencies
3939
timeout-minutes: 30
4040
run: |
41-
# Retried with a per-attempt timeout: a stalled Ubuntu mirror otherwise
41+
# Retried with per-command timeouts (timeout inside sudo, so the kill reaches
42+
# apt-get and the dpkg lock is released): a stalled Ubuntu mirror otherwise
4243
# hangs this step for hours (two 358-minute hangs on 2026-08-18).
4344
pkgs="texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended texlive-fonts-extra texlive-xetex latexmk xindy dvipng cm-super"
4445
for attempt in 1 2; do
45-
timeout 14m sudo bash -c "apt-get -qq update && apt-get install -y $pkgs" && break
46+
sudo timeout -k 30s 2m apt-get -qq update && sudo timeout -k 30s 12m apt-get install -y $pkgs && break
4647
if [ "$attempt" = 2 ]; then echo "apt-get failed after 2 attempts"; exit 1; fi
4748
echo "apt-get attempt $attempt failed; retrying in 30s"; sleep 30
4849
done

.github/workflows/publish.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,12 @@ jobs:
5454
- name: Install latex dependencies
5555
timeout-minutes: 30
5656
run: |
57-
# Retried with a per-attempt timeout: a stalled Ubuntu mirror otherwise
57+
# Retried with per-command timeouts (timeout inside sudo, so the kill reaches
58+
# apt-get and the dpkg lock is released): a stalled Ubuntu mirror otherwise
5859
# hangs this step for hours (two 358-minute hangs on 2026-08-18).
5960
pkgs="texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended texlive-fonts-extra texlive-xetex latexmk xindy dvipng cm-super"
6061
for attempt in 1 2; do
61-
timeout 14m sudo bash -c "apt-get -qq update && apt-get install -y $pkgs" && break
62+
sudo timeout -k 30s 2m apt-get -qq update && sudo timeout -k 30s 12m apt-get install -y $pkgs && break
6263
if [ "$attempt" = 2 ]; then echo "apt-get failed after 2 attempts"; exit 1; fi
6364
echo "apt-get attempt $attempt failed; retrying in 30s"; sleep 30
6465
done

0 commit comments

Comments
 (0)