-
Notifications
You must be signed in to change notification settings - Fork 478
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
Segmentation fault with last docker version #641
Comments
Same here, using github actions ubuntu-latest image and Docker version 24.0.7, build afdd53b |
Same issue on Ubuntu 23.10 (kernel 6.5.0-13-generic) Docker version 24.0.5, build ced0996 |
Same issue, Windows 11 wsl2 |
I had the same issue, a workaround is to switch to 8.3 in your
|
Is this indeed specific to PHP 8.2? Does 8.1 and 8.3 work? |
Same with 8.1 here ! |
The issue stems from this line of code Line 31 in 688a820
curl fails when it's passing piping it out to PHP |
@driesvints I can confirm, that the issue exists with PHP 8.1 and 8.2 (not tested with PHP 8.0) PHP 8.3 seems to work fine. |
I tried setting up the sail image to |
Right. I don't really know what to do here sorry. Would appreciate any ideas... |
Thank you for reporting this issue! As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub. If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team. Thank you! |
@Theprim0 has reported it to composer: composer/composer#11740 |
Nice thanks @Theprim0. I tried several things to mitigate this issue, but setting up the image to use PHP 8.3 seems currently the only working option, although it launched like 2-3 days ago as a stable release. |
Commenting out the php8.2-xdebug gets the build working. File: Perhaps the compiling of php8.2-xdebug is making the container run out of memory (throwing ideas out there)?
becomes
|
Just updated the original reply, but its |
Sure this can be another workaround. It also implies that you accept to drop the php debugging experience. For me specifically I don't mind because it's for a university project, but for companies it can be bothersome. Actually, the problem might not be from the Sail package itself, but from composer or docker-composer (as some of you reported). I don't really know what to do next aside of trying stuff out, switching to 8.3 and waiting other package replies 🤔. |
The Dockerfile of 8.3 has xdebug commented out too. See here. I'm trying to resolve this at the minute as I need debugging today. |
Commenting out |
EDIT: Does not work as mentioned #641 (comment) my apologies As mentioned here composer/composer#11740 (comment) all fingers point to the xdebug package breaking
Made a temporary workaround for those interested by installing xdebug with pecl instead, just comment out/remove xdebug and add the xdebug fix at the bottom like this RUN apt-get update \
&& mkdir -p /etc/apt/keyrings \
&& apt-get install -y gnupg gosu curl ca-certificates zip unzip git supervisor sqlite3 libcap2-bin libpng-dev python2 dnsutils librsvg2-bin fswatch \
&& curl -sS 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x14aa40ec0831756756d7f66c4f4ea0aae5267a6c' | gpg --dearmor | tee /etc/apt/keyrings/ppa_ondrej_php.gpg > /dev/null \
&& echo "deb [signed-by=/etc/apt/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 \
&& apt-get install -y php8.2-cli php8.2-dev \
php8.2-pgsql php8.2-sqlite3 php8.2-gd php8.2-imagick \
php8.2-curl \
php8.2-imap php8.2-mysql php8.2-mbstring \
php8.2-xml php8.2-zip php8.2-bcmath php8.2-soap \
php8.2-intl php8.2-readline \
php8.2-ldap \
php8.2-msgpack php8.2-igbinary php8.2-redis php8.2-swoole \
php8.2-memcached php8.2-pcov \
# XDEBUG fix
&& pecl install xdebug |
@GoByeBye do you know the reason behind this workaround ? Like why does it work by installing it via pecl and not as a php extension ? |
EDIT: This doesn't work, it correctly installs the xdebug and then PHP always gives a segfault due to the xdebug plugin (broken official package?)I think I've found the problem here.
Is expecting a completely clean buffer to be piped in to This sets the next command line up to fail when piping the output from curl into php (no idea why). @GoByeBye we were both going down the same path, I tried using pecl too but it doesn't setup the extension to be loaded via PHP and that's when I discovered this piping issue. Here's the full fix to get this to build properly, just move the install of the package past the composer install. File: docker/8.2/Dockerfile
becomes
|
What docker version does it works on? Don't want to try all 10 or something. |
I think maybe the docker compose version 2.23.0 is fine but not sure. It was updated several times this month and the bug might have been introduced then. I really don't know where is the source of the problem, it's just a guess. |
@cjj25 I just have a question about the file itself. While trying to find out where this bug could come from, I only have the |
I just had to run |
@cjj25 my apologies for being misleading there. It was a fix I rushed out to the devs @ the company I work for before lunch It seems like it's the official package that's broken yeah... New question for you @cjj25 have you tried specifying the pecl version to an older known good one? So RUN apt-get update \
&& mkdir -p /etc/apt/keyrings \
&& apt-get install -y gnupg gosu curl ca-certificates zip unzip git supervisor sqlite3 libcap2-bin libpng-dev python2 dnsutils librsvg2-bin fswatch \
&& curl -sS 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x14aa40ec0831756756d7f66c4f4ea0aae5267a6c' | gpg --dearmor | tee /etc/apt/keyrings/ppa_ondrej_php.gpg > /dev/null \
&& echo "deb [signed-by=/etc/apt/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 \
&& apt-get install -y php8.2-cli php8.2-dev \
php8.2-pgsql php8.2-sqlite3 php8.2-gd php8.2-imagick \
php8.2-curl \
php8.2-imap php8.2-mysql php8.2-mbstring \
php8.2-xml php8.2-zip php8.2-bcmath php8.2-soap \
php8.2-intl php8.2-readline \
php8.2-ldap \
php8.2-msgpack php8.2-igbinary php8.2-redis php8.2-swoole \
php8.2-memcached php8.2-pcov \
# XDEBUG fix
&& pecl install xdebug-3.2.2 We also need to specify a xdebug.ini file zend_extension=REPLACE_WITH_XDEBUG_PATH
xdebug.remote_enable=1
; Disable this and comment in the below code if you need to debug something from another device/ip, such
; as via the online mode, connecting from a phone. Rebuild the docker image and enjoy!
xdebug.discover_client_host=true
;xdebug.idekey="gobyebye-ide-key"
;xdebug.client_host="172.17.0.1"
; If the device does not have support for bookmarklets, or you just want the debugger to always connect (even
; without the XDEBUG_SESSION cookie), change this to yes. Will also start profiling.
xdebug.start_with_request=trigger
xdebug.client_port=9000
xdebug.file_link_format=xdebug://%f@%l
xdebug.output_dir=/xdebug
xdebug.profiler_output_name="cachegrind.out.%s.%u"
xdebug.trace_output_name="trace.%u.%R"
xdebug.trace_format=1
xdebug.var_display_max_depth = 10
xdebug.var_display_max_children = 256
xdebug.var_display_max_data = 1024
xdebug.mode=develop,trace,debug,profile
;https://xdebug.org/docs/all_settings#log_level
xdebug.log_level=3;
; Show all local variablas in error situations.
;xdebug.show_local_vars=true
; break upon error.
;xdebug.start_upon_error=yes then copy it in COPY xdebug.ini /etc/php-conf/99-xdebug
RUN sed -i "s#REPLACE_WITH_XDEBUG_PATH#$(ls /usr/lib/php/*/xdebug.so)#" /etc/php-conf/99-xdebug.ini Hope this helps ^^ |
Changelog confirms my suspicion. Seems like it was a bug that was then fixed in Swoole 5.1.1 If you look at the change log you can see
|
@GoByeBye Looks like we've pretty much identified the issue and some quick fixes. I'm not really sure where the responsibility goes from here as realistically these packages in the Dockerfile should all work together. |
I am currently trying to apply the fix on a fresh install of a Laravel project to confirm the process. I'll tell you if anything goes wrong. |
@cjj25 Only option I see if we want a "permanent" fix is to rewrite the Dockerfiles to use pecl and be version specific. But this brings the issue with being reliant on pecl, as their uptime isn't the most stable... So honestly just wait until the fix gets pushed to the Ubuntu repos and keep it as is.
It's up to @driesvints and what he wants to do. I guess? I'd be happy to rewrite the Dockerfile(s) to base them on pecl with pinned versions, I'd recommend against it though |
Problem persists with the following processes (2 ways tried):
First way
Second way
Both ways keep crashing the same way as before. Did I missed a step somewhere ? If not, can one of you try a clean install of a project to confirm ? |
@ToguyC Unfortunately you'll need to modify the actual Dockerfile you originally found in the vendor directly as you can't run the sail:publish without having a working built docker image. |
Oh okay, fixing it now. Will edit this comment with the results. |
Heya, thank you all for investigating. We're not going to be rewriting to Pecl. So I guess the only other option is to wait for a fix from swoole? Did I get that right? |
Correct ^^ |
@NathanFreeman just want to fill you in on the above ^ |
@driesvints I believe the issue is actually with the php8.2-swoole package being outdated.
The fix appears to be in 5.1.1 so the package php8.2-swoole on https://ppa.launchpadcontent.net needs be updated. @GoByeBye thoughts? |
I am happy that the issue I submitted got so much attention. I helped in a small form but still, happy ^^ If you want, I can make a comment explaining the current fix with steps to apply it ? |
You're right on! Mentioned it above here #641 (comment). An issue has already been reported oerdnj/deb.sury.org#2058. Now we wait ^^ |
Steps to apply the fix with Swoole prior to 5.1.1 installed along with xdebug 3.3On a new Laravel project
On an already existing projectIf you just pulled the project and did not create a docker image, go from step 3 of the first example.
Hope it works for you ! |
Only run |
The extension swoole is here the problem. The only fix for now is commenting it out and wait for a fixed version. |
I had the same issue on a freshly built docker image in our CI. The project has NO swoole at all, it's a pure Symfony project. Downgrading worked to fix it. Weirdly i could not reproduce it locally with the same image. So it might be Docker version / Kernel dependant? |
It now builds the docker images again for me. Maybe somebody else can also try it too?
|
There were 2 extensions that were making problems with PHP 8.3. Swoole was causing "segmentation faults" even without xdebug and imagick would cause an abortion with "Unterminated preprocessor conditions" in the build process. The imagick problem seems to be a tricky one, because it sometimes can build without a problem, but other times it will just throw an error. I had this problems building the production ready docker images for my projects and it enough to say this could also be a problem in sail, because it utilizes the exact same extensions I mentioned. After commenting out these 2 extensions my image would build perfectly fine and my apps run in the new docker images without any problem. If you are dependant on this extensions you will have to wait for a fix. |
It looks like a null pointer issue. Give me some time to fix it |
A patch is waiting to be tested: xdebug/xdebug#934 |
Yesterday and today, I could build the PHP 8.2 image without any problem. Very weird, because I've had the same issue as many others are reporting. |
I am trying to get a new project started and keep running into the
I have done the fix to |
A segmentation fault during an (For what its worth, the commands listed worked fine for me, doing |
Gonna close this as it's unlikely a Sail issue as regularly mentioned here. Thanks all |
Hey guys, in my case the install of xdebug-3.2.2 specific version, instead of the latest one, was the solution for the segmentation error. |
Sail Version
1.26
Laravel Version
10.10
PHP Version
8.2
Operating System
Linux
OS Version
Debian 12 (kernel 6.1.0-13-amd64)
Description
With the latest version of docker and docker-desktop, when running
./vendor/bin/sail up
, the mysql image is pulled successfully, but when Laravel is building, it crashes (segfault) atProcessing triggers for php8.2-cli (8.2.13-1+ubuntu22.04.1+deb.sury.org+1)
.I tried purging docker from my computer (along with docker-desktop) but nothing worked.
Maybe as the previous Issue #639 it comes from the docker compose version because I use the version
Docker Compose version v2.23.0-desktop.1
.Here is the ouput of the command:
Steps To Reproduce
./vendor/bin/sail up
The text was updated successfully, but these errors were encountered: