dunglas / frankenphp

🧟 The modern PHP app server
https://frankenphp.dev
MIT License
6.99k stars 243 forks source link

undefined symbol: core_globals_offset #566

Open smortexa opened 9 months ago

smortexa commented 9 months ago

What happened?

When dockerizing a Laravel Octane application, I found that using the FrankenPHP binary from GitHub releases works successfully:

https://github.com/exaco/laravel-octane-dockerfile/blob/0e6e218774c6a4166b91f461aa99098fd23e159b/FrankenPHP.Dockerfile#L191

However, when attempting to copy the binary from the FrankenPHP docker images to support various PHP versions, the server fails to start, displaying the following error logs:

https://github.com/exaco/laravel-octane-dockerfile/blob/99e9251d7505fe358c3bdadde2c51e2f21801190/FrankenPHP.Dockerfile#L195

WARN  Unable to determine the current FrankenPHP binary version. Please report this issue: https://github.com/laravel/octane/issues/new.
INFO  /usr/local/bin/frankenphp: symbol lookup error: /usr/local/bin/frankenphp: undefined symbol: core_globals_offset

Here is the complete log:

2024-02-10 11:12:53,761 INFO Set uid to user 1000 succeeded
2024-02-10 11:12:53,763 INFO supervisord started with pid 1
2024-02-10 11:12:54,765 INFO spawned: 'octane_00' with pid 28

   WARN  Unable to determine the current FrankenPHP binary version. Please report this issue: https://github.com/laravel/octane/issues/new.

   INFO  Server running…

  Local: http://0.0.0.0:80 

  Press Ctrl+C to stop the server

   INFO  /usr/local/bin/frankenphp: symbol lookup error: /usr/local/bin/frankenphp: undefined symbol: core_globals_offset
2024-02-10 11:12:55,599 WARN exited: octane_00 (exit status 127; not expected)
2024-02-10 11:12:56,603 INFO spawned: 'octane_00' with pid 35

Build Type

Docker (Debian Bookworm)

Worker Mode

Yes

Operating System

GNU/Linux

CPU Architecture

x86_64

dunglas commented 9 months ago

It's likely because you must use a ZTS version of the php-cli image.

smortexa commented 9 months ago

I switched to using php8.3-zts-bookworm instead of php8.3-cli-bookworm in Dockerfile, and although the GitHub Actions test passed successfully, I'm still facing issues as it fails to start on my machine (M1) with exit code 139:

2024-02-10 20:12:47,010 INFO Set uid to user 1000 succeeded
2024-02-10 20:12:47,012 INFO supervisord started with pid 1
2024-02-10 20:12:48,013 INFO spawned: 'octane_00' with pid 19

   INFO  Server running…

  Local: http://0.0.0.0:80 

  Press Ctrl+C to stop the server

   WARN  server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server

   WARN  unable to get instance ID; storage clean stamps will be incomplete
2024-02-10 20:12:48,754 WARN exited: octane_00 (exit status 139; not expected)
withinboredom commented 9 months ago

Set uid to user 1000 succeeded

Local: http://0.0.0.0:80

You cannot bind to a privileged port with an unprivileged user.

dunglas commented 9 months ago

Could you provide a reproducer?

smortexa commented 9 months ago

@dunglas https://github.com/smortexa/frankenphp-reproduce-566

dunglas commented 9 months ago

TBH there is a log of weird things in these images 🗡️:D

Couldn't you use the official FrankenPHP images instead of copying a binary in the ZTS images? This will ensure that everything is compiled as it should and the images are extending the official PHP ones.

smortexa commented 9 months ago

I used FrankenPHP official base image, but the problem still exists. see: https://github.com/smortexa/frankenphp-reproduce-566#steps-to-reproduce-exit-status-139

withinboredom commented 9 months ago

I'm not sure why all these things are in the container together. Why not have multiple containers/targets and simply share the resources you need to share (disk/network/shm/whatever) in a docker-compose file or pod?