krakjoe / parallel

A succinct parallel concurrency API for PHP8
Other
1.46k stars 95 forks source link

parallel makes FrankenPHP freeze and crash #308

Open dunglas opened 3 months ago

dunglas commented 3 months ago

parallel is buggy when used with FrankenPHP, which requires a ZTS build.

Let me know if we can help fix these issues in any way.

Best regards,

skmirajbn commented 3 months ago

Great news. My company's Standalone Self Executable binary Laravel application is in production, having the freezing issue on docker. Hopefully, in the next update, it will be solved. Thanks a lot for your contribution. Excited to see :)

realFlowControl commented 3 months ago

Hey @dunglas 👋

I am not sure https://github.com/dunglas/frankenphp/issues/858 has anything todo with ext-parallel at all. @skmirajbn can you check on my comment at https://github.com/dunglas/frankenphp/issues/858#issuecomment-2210823647?

Kind regards Florian

skmirajbn commented 3 months ago

Hey @dunglas 👋

I am not sure dunglas/frankenphp#858 has anything todo with ext-parallel at all. @skmirajbn can you check on my comment at dunglas/frankenphp#858 (comment)?

Kind regards Florian

I was about to say that. But after trying version 1.2, the freeze problem seems fixed. I don't know why even after selecting the extensions removing parallel solves the issue. Maybe, the binary builder still including all the extensions.

dunglas commented 3 months ago

This is definitely related to parallel. I reproduced the issue locally and the simple fact of removing ext-parallel fixed the issue (adding back the extension recreates the problem).

dunglas commented 3 months ago

The latest version of FrankenPHP doesn't include parallel anymore, because of this issue. That's why you don't have the problem.

skmirajbn commented 3 months ago

image Here in the dockerfile, I didn't include the parallel, But that time got the freezing problem. When Dunglas said that the extension parallel created the freezing issue, I was a bit confused that even I didn't include the extension in this list why it is causing the issue. At the time 1.2.1 version is released without parallel. I tried that and I can see that the freezing problem is gone. As the problem is gone that's why I didn't ask this question. @realFlowControl may be talking about it.

dunglas commented 2 months ago

@realFlowControl I wonder if you don't have the same issue as https://github.com/xdebug/xdebug/pull/958

CG(function_table) should be used instead of EG(function_table).

skmirajbn commented 2 months ago

Off Topic: Do anyone know how to increase PHP max_execution_time for Self Contained Binary. By default I can see it only 30 sec. I can't find way to set it.

image

dunglas commented 2 months ago

Change the value in php.ini or by using set_time_limit()

skmirajbn commented 2 months ago

I used this Dockerfile to build the binary.

FROM --platform=linux/amd64 dunglas/frankenphp:static-builder as builder

# Copy your app
WORKDIR /go/src/app/dist/app
COPY ./src/. .

WORKDIR /go/src/app/
RUN EMBED=dist/app/ \
    FRANKENPHP_VERSION=1.2.1 \
    PHP_EXTENSIONS=mbstring,intl,pdo_mysql,gd \
    PHP_VERSION=8.1 \
    ./build-static.sh

FROM alpine:3.19.0

WORKDIR /app

COPY --from=builder /go/src/app/dist/frankenphp-linux-x86_64 dat

EXPOSE 80

CMD ["./dat", "php-server", "--root=public/"];

I don't have php.ini file. Is there any option here? Like as I selected PHP_VERSION etc...