Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segfault with latest php8.1-xdebug in ARM64 docker build #2058

Closed
3 tasks done
cmcfadden opened this issue Dec 1, 2023 · 3 comments
Closed
3 tasks done

Segfault with latest php8.1-xdebug in ARM64 docker build #2058

cmcfadden opened this issue Dec 1, 2023 · 3 comments

Comments

@cmcfadden
Copy link

cmcfadden commented Dec 1, 2023

Frequently asked questions

  • I have read Frequently Asked Questions
  • I have looked at the list of the existing issues (including closed issues) and searched if my issue has been already reported
  • I have tried to resolve the issue myself and will describe what I did in clear and consise manner

Describe the bug
Initially encountered this today using Laravel Sail with PHP 8.1, building on an M2 MacBook Air (ARM64). The docker build would fail with a segfault when running any php commands in the docker build. Reduced it down to the Dockerfile below, which will segfault on the php -i (or any other php commands, like installing composer).

I believe this is being caused by the php8.1-Xdebug update that was pushed in the PPA earlier today.

Dockerfile:

FROM ubuntu:22.04
ENV TZ=UTC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update \
    && mkdir -p /etc/apt/keyrings \
    && apt-get install -y gnupg gosu curl ca-certificates zip unzip git 
RUN curl -sS 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x14aa40ec0831756756d7f66c4f4ea0aae5267a6c' | gpg --dearmor | tee /usr/share/keyrings/ppa_ondrej_php.gpg > /dev/null \
    && echo "deb [signed-by=/usr/share/keyrings/ppa_ondrej_php.gpg] https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \
    && apt-get update
RUN apt-get install -y php8.1-cli php8.1-swoole php8.1-xdebug
RUN php -i

Example output:

➜  dockerTest git:(main) ✗ docker build . 
[+] Building 28.4s (9/9) FINISHED                                                                                                      docker:desktop-linux
 => [internal] load .dockerignore                                                                                                                      0.0s
 => => transferring context: 2B                                                                                                                        0.0s
 => [internal] load build definition from Dockerfile                                                                                                   0.0s
 => => transferring dockerfile: 739B                                                                                                                   0.0s
 => [internal] load metadata for docker.io/library/ubuntu:22.04                                                                                        0.2s
 => [1/6] FROM docker.io/library/ubuntu:22.04@sha256:2b7412e6465c3c7fc5bb21d3e6f1917c167358449fecac8176c6e496e5c1f05f                                  0.0s
 => CACHED [2/6] RUN ln -snf /usr/share/zoneinfo/UTC /etc/localtime && echo UTC > /etc/timezone                                                        0.0s
 => [3/6] RUN apt-get update     && mkdir -p /etc/apt/keyrings     && apt-get install -y gnupg gosu curl ca-certificates zip unzip git                19.5s
 => [4/6] RUN curl -sS 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x14aa40ec0831756756d7f66c4f4ea0aae5267a6c' | gpg --dearmor | tee /usr/  1.9s
 => [5/6] RUN apt-get install -y php8.1-cli php8.1-swoole php8.1-xdebug                                                                                6.4s 
 => ERROR [6/6] RUN php -i                                                                                                                             0.3s 
------                                                                                                                                                      
 > [6/6] RUN php -i:                                                                                                                                        
0.260 Segmentation fault 

The segfault does not occur if either swoole or xdebug are removed.

Your understanding of what is happening

What steps did you take to resolve issue yourself before reporting it here
In my case, I can workaround the issue by removing xdebug in my dockerfiles, since we don't need it in our environment.

Expected behavior
Container should build and execute and php commands successfully.

Distribution (please complete the following information):

Package(s) (please complete the following information):
See dockerfile

Additional context
Add any other context about the problem here.

@GoByeBye
Copy link

GoByeBye commented Dec 1, 2023

Hi! Been looking at this issue along with laravel/sail#641. Issue is caused by Swoole v5.1.0 it's fixed in Swoole v5.1.1

Issue happens only when both Xdebug and Swoole are installed.
Swoole is the culprit :) A quick release of Swoole 5.1.1 should fix the issue

@cmcfadden
Copy link
Author

oh great thanks!

@oerdnj
Copy link
Owner

oerdnj commented Dec 1, 2023

In any case. It is important to report upstream issues directly to upstream.

In other words, this because a real issue only when it was reported this could be fixed by packaging and uploading new version of swoole.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants