This is an automated email from the ASF dual-hosted git repository.

payang pushed a commit to branch 4.2
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/4.2 by this push:
     new 77415b592c3 KAFKA-20063 Fix Docker build hang by reordering tar 
extraction before… (#21296)
77415b592c3 is described below

commit 77415b592c365ebf197a214456f9fce2b25b27e1
Author: Chia-Ping Tsai <[email protected]>
AuthorDate: Tue Jan 13 09:27:09 2026 +0800

    KAFKA-20063 Fix Docker build hang by reordering tar extraction before… 
(#21296)
    
    The Docker build for Alpine images intermittently hangs during the tar
    extraction phase. This is caused by gcompat being loaded into the
    process space during the preceding gpg verification step, which
    interferes with Alpine's tar implementation and causes a deadlock.
    
    see
    
    https://blog.tsunanet.net/2022/09/tar-hanging-when-extracting-archive.html
    
    Reviewers: Christo Lolov <[email protected]>, TengYao Chi
     <[email protected]>, Ken Huang <[email protected]>, PoAn Yang
     <[email protected]>
    (cherry picked from commit 41b33d82c9e10eb19144a0a3cfbb897187df1b5b)
---
 docker/jvm/Dockerfile | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/docker/jvm/Dockerfile b/docker/jvm/Dockerfile
index 1c7c95d4869..8d758ba50f1 100644
--- a/docker/jvm/Dockerfile
+++ b/docker/jvm/Dockerfile
@@ -34,16 +34,18 @@ RUN set -eux ; \
     apk update ; \
     apk upgrade ; \
     apk add --no-cache bash; \
+    mkdir opt/kafka; \
     if [ -n "$KAFKA_URL" ]; then \
         apk add --no-cache wget gcompat gpg gpg-agent procps; \
         wget -nv -O kafka.tgz "$KAFKA_URL"; \
         wget -nv -O kafka.tgz.asc "$KAFKA_URL.asc"; \
         wget -nv -O KEYS https://downloads.apache.org/kafka/KEYS; \
+        tar xfz kafka.tgz -C opt/kafka --strip-components 1; \
         gpg --import KEYS; \
         gpg --batch --verify kafka.tgz.asc kafka.tgz; \
-    fi; \
-    mkdir opt/kafka; \
-    tar xfz kafka.tgz -C opt/kafka --strip-components 1;
+    else \
+        tar xfz kafka.tgz -C opt/kafka --strip-components 1; \
+    fi;
 
 # Generate jsa files using dynamic CDS for kafka server start command and 
kafka storage format command
 RUN /etc/kafka/docker/jsa_launch

Reply via email to