make jemalloc: download failure is silently swallowed and never retried, surfacing as a misleading tar error

オープン 初心者向け
#9,810 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 10 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
84/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
静か
技術スタック
docker, shell

調査の方向性

dgraph/Makefile の jemalloc ターゲットから始め、そのダウンロードフローを Dockerfile に示されている retry の慣例と比較します。jemalloc ターゲットまたは Docker build を実行して、現在の失敗経路を確認します。ダウンロードエラーが表示されたままになり、一時的な retry が 1 回行われ、前提条件が失敗した場合に展開と後続の手順が停止すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Stale
Summary

The jemalloc target in dgraph/Makefile chains its download and extraction with ; rather than &&, so a failed curl does not stop the recipe. The build then fails several steps later with a misleading error, and the real cause — the download — is discarded.

There is also no retry on what is a network fetch from a GitHub release, so a single transient blip fails the build.

The code

dgraph/Makefile, jemalloc target:

mkdir -p /tmp/jemalloc-temp && cd /tmp/jemalloc-temp ; \
echo "Downloading jemalloc" ; \
curl -f -s -L ${JEMALLOC_URL} -o jemalloc.tar.bz2 ; \
tar xjf ./jemalloc.tar.bz2 ; \
cd jemalloc-5.3.1 ; \
...

Two problems:

  1. ; instead of &&. When curl -f exits non-zero, the recipe continues into tar xjf on a file that does not exist. curl -s also suppresses the reason it failed, so nothing about the actual failure is ever printed.
  2. No retry. The Dockerfile already treats this class of failure as expected and retries — apk add --no-cache ... || (sleep 5 && apk add --no-cache ...), commented "Retry once on transient apk-proxy errors". The jemalloc fetch gets no equivalent.
Observed failure

What a maintainer actually sees, with the genuine cause absent:

Downloading jemalloc
tar (child): ./jemalloc.tar.bz2: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
/bin/sh: 6: cd: can't cd to jemalloc-5.3.1
sed: can't read src/jemalloc_cpp.cpp: No such file or directory
/bin/sh: 8: ./configure: not found
make[2]: *** No targets specified and no makefile found.  Stop.
==== Need sudo access to install jemalloc
make: *** No rule to make target 'install'.  Stop.
make[1]: *** [Makefile:111: jemalloc] Error 2

The tar: Cannot open line reads like a missing-file bug, which sends you looking in the wrong place. Every line after it is downstream noise.

We hit this four times across two PRs in a fork of this repo, in both the host-native build and the RUN make -C dgraph jemalloc layer of the Docker build. Because the target is a prerequisite of make dgraph, it takes out every CI job that builds a binary — for us that was unit, systest-baseline, and any suite depending on them.

Suggested fix
curl -fSL ${JEMALLOC_URL} -o jemalloc.tar.bz2 \
  || (sleep 5 && curl -fSL ${JEMALLOC_URL} -o jemalloc.tar.bz2) ; \
tar xjf ./jemalloc.tar.bz2 && \
cd jemalloc-5.3.1 && \
...
  • && between the steps that depend on each other, so the first real failure is the one reported.
  • -S (keeping -f) so curl prints why it failed; dropping -s entirely also works.
  • One retry with a short sleep, matching the convention the Dockerfile already uses.

Caching the tarball would remove the network dependency altogether, but the retry plus honest error reporting is the small fix.

I'm happy to open a PR for this if it's welcome.

主要言語
Go
スター
21.8k
フォーク
1.6k
平均マージ
11日 7時間
マージ済み PR(30日)
5

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

dgraph-io/dgraph のほかの issue

dgraph-io/dgraph の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。