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

Octane + FrankenPHP + Sail, stuck in "Application change detected. Restarting workers" #884

Closed
jhm-ciberman opened this issue May 8, 2024 · 11 comments · Fixed by #890
Closed

Comments

@jhm-ciberman
Copy link

Octane Version

v2.3.10

Laravel Version

v11.6.0

PHP Version

v8.3.6

What server type are you using?

FrankenPHP

Server Version

v1.1.4 PHP 8.3.6 Caddy v2.7.6

Database Driver & Version

Postgress

Description

Laravel Sail v1.29.1, running on WSL.

When installing Laravel Octane + FrankenPHP in my local dev environment I followed the documentation steps and added this to my docker-compose.yml:

SUPERVISOR_PHP_COMMAND: "/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan octane:start --server=frankenphp --host=0.0.0.0 --admin-port=2019 --port=80" 
XDG_CONFIG_HOME:  /var/www/html/config 
XDG_DATA_HOME:  /var/www/html/data 

The problem is that if I sail up -d, then the code is cached and it doesn't reload the server when files changes.

So I added the --watch option to the SUPERVISOR_PHP_COMMAND:

SUPERVISOR_PHP_COMMAND: "/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan octane:start --server=frankenphp --host=0.0.0.0 --admin-port=2019 --port=80 --watch"

Now the server starts and is stuck in a loop saying Application change detected. Restarting workers….
The server does not respond to requests and it does not work properly.

Here is the full Docker container log for the Laravel Sail container:

2024-05-08 19:34:40 usermod: no changes
2024-05-08 19:34:41 2024-05-08 22:34:41,139 INFO Set uid to user 0 succeeded
2024-05-08 19:34:41 2024-05-08 22:34:41,141 INFO supervisord started with pid 1
2024-05-08 19:34:42 2024-05-08 22:34:42,144 INFO spawned: 'php' with pid 9
2024-05-08 19:34:42 
2024-05-08 19:34:42    INFO  Server running…
2024-05-08 19:34:42 
2024-05-08 19:34:42   Local: http://0.0.0.0:80 
2024-05-08 19:34:42 
2024-05-08 19:34:42   Press Ctrl+C to stop the server
2024-05-08 19:34:42 
2024-05-08 19:34:43 2024-05-08 22:34:43,899 INFO success: php entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2024-05-08 19:34:43 
2024-05-08 19:34:43    WARN  server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server
2024-05-08 19:34:43 
2024-05-08 19:34:43    INFO  Application change detected. Restarting workers…
2024-05-08 19:34:44 
2024-05-08 19:34:44    WARN  server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server
2024-05-08 19:34:44 
2024-05-08 19:34:44    INFO  Application change detected. Restarting workers…
2024-05-08 19:34:45 
2024-05-08 19:34:45    WARN  server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server
2024-05-08 19:34:45 
2024-05-08 19:34:45    INFO  Application change detected. Restarting workers…
2024-05-08 19:34:45 
2024-05-08 19:34:45    WARN  server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server
2024-05-08 19:34:45 
2024-05-08 19:34:45    INFO  Application change detected. Restarting workers…
2024-05-08 19:34:46 
2024-05-08 19:34:46    WARN  server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server
2024-05-08 19:34:46 2024-05-08 22:34:46,487 INFO exited: php (exit status 139; not expected)
2024-05-08 19:34:47 2024-05-08 22:34:47,489 INFO spawned: 'php' with pid 183
2024-05-08 19:34:48 
2024-05-08 19:34:48    INFO  Server running…
2024-05-08 19:34:48 
2024-05-08 19:34:48   Local: http://0.0.0.0:80 
2024-05-08 19:34:48 
2024-05-08 19:34:48   Press Ctrl+C to stop the server
2024-05-08 19:34:48 
2024-05-08 19:34:49 2024-05-08 22:34:49,253 INFO success: php entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2024-05-08 19:34:49 
2024-05-08 19:34:49    WARN  server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server
2024-05-08 19:34:49 2024-05-08 22:34:49,357 INFO exited: php (exit status 139; not expected)
2024-05-08 19:34:50 2024-05-08 22:34:50,360 INFO spawned: 'php' with pid 252
2024-05-08 19:34:51 
2024-05-08 19:34:51    INFO  Server running…
2024-05-08 19:34:51 
2024-05-08 19:34:51   Local: http://0.0.0.0:80 
2024-05-08 19:34:51 
2024-05-08 19:34:51   Press Ctrl+C to stop the server
2024-05-08 19:34:51 
2024-05-08 19:34:52 2024-05-08 22:34:52,095 INFO success: php entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2024-05-08 19:34:52 
2024-05-08 19:34:52    WARN  server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server
2024-05-08 19:34:52 
2024-05-08 19:34:52    INFO  Application change detected. Restarting workers…
2024-05-08 19:34:52 
2024-05-08 19:34:52    WARN  server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server
2024-05-08 19:34:52 
2024-05-08 19:34:52    INFO  Application change detected. Restarting workers…
2024-05-08 19:34:53 
2024-05-08 19:34:53    WARN  server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server
2024-05-08 19:34:53 
2024-05-08 19:34:53    INFO  Application change detected. Restarting workers…
2024-05-08 19:34:54 
2024-05-08 19:34:54    WARN  server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server
2024-05-08 19:34:54 2024-05-08 22:34:54,097 INFO exited: php (exit status 139; not expected)
2024-05-08 19:34:55 2024-05-08 22:34:55,100 INFO spawned: 'php' with pid 399
2024-05-08 19:34:55 
2024-05-08 19:34:55    INFO  Server running…
2024-05-08 19:34:55 
2024-05-08 19:34:55   Local: http://0.0.0.0:80 
2024-05-08 19:34:55 
2024-05-08 19:34:55   Press Ctrl+C to stop the server
2024-05-08 19:34:55 
2024-05-08 19:34:56 2024-05-08 22:34:56,842 INFO success: php entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2024-05-08 19:34:56 
2024-05-08 19:34:56    WARN  server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server
2024-05-08 19:34:56 
2024-05-08 19:34:56    INFO  Application change detected. Restarting workers…
2024-05-08 19:34:57 
2024-05-08 19:34:57    WARN  server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server
2024-05-08 19:34:57 
2024-05-08 19:34:57    INFO  Application change detected. Restarting workers…
2024-05-08 19:34:58 
2024-05-08 19:34:58    WARN  server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server
2024-05-08 19:34:58 
2024-05-08 19:34:58    INFO  Application change detected. Restarting workers…
2024-05-08 19:34:58 
2024-05-08 19:34:58    WARN  server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server
2024-05-08 19:34:58 
2024-05-08 19:34:58    INFO  Application change detected. Restarting workers…
2024-05-08 19:34:59 
2024-05-08 19:34:59    WARN  server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server
2024-05-08 19:34:59 
2024-05-08 19:34:59    INFO  Application change detected. Restarting workers…
2024-05-08 19:34:59 
2024-05-08 19:34:59    WARN  server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server
2024-05-08 19:34:59 
2024-05-08 19:34:59    INFO  Application change detected. Restarting workers…
2024-05-08 19:35:00 
2024-05-08 19:35:00    WARN  server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server
2024-05-08 19:35:00 
2024-05-08 19:35:00    INFO  Application change detected. Restarting workers…
2024-05-08 19:35:01 
2024-05-08 19:35:01    WARN  server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server
2024-05-08 19:35:01 
2024-05-08 19:35:01    INFO  Application change detected. Restarting workers…
2024-05-08 19:35:01 
2024-05-08 19:35:01    WARN  server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server
2024-05-08 19:35:01 
2024-05-08 19:35:01    INFO  Application change detected. Restarting workers…
2024-05-08 19:35:02 
2024-05-08 19:35:02    WARN  server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server
2024-05-08 19:35:02 
2024-05-08 19:35:02    INFO  Application change detected. Restarting workers…
2024-05-08 19:35:03 
2024-05-08 19:35:03    WARN  server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server
2024-05-08 19:35:03 
2024-05-08 19:35:03    INFO  Application change detected. Restarting workers…
2024-05-08 19:35:03 
2024-05-08 19:35:03    WARN  server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server
2024-05-08 19:35:03 
2024-05-08 19:35:03    INFO  Application change detected. Restarting workers…
2024-05-08 19:35:04 
2024-05-08 19:35:04    WARN  server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server
2024-05-08 19:35:04 
2024-05-08 19:35:04    INFO  Application change detected. Restarting workers…
2024-05-08 19:35:04 
2024-05-08 19:35:04    WARN  server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server
2024-05-08 19:35:04 
2024-05-08 19:35:04    INFO  Application change detected. Restarting workers…

Steps To Reproduce

  • Install Laravel Sail running on WSL
  • Install Octane with FrankenPHP (I don't know if the problem persist with other server type)
  • Add the following snippet to the docker-compose.yml env variables:
SUPERVISOR_PHP_COMMAND: "/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan octane:start --server=frankenphp --host=0.0.0.0 --admin-port=2019 --port=80 --watch" 
XDG_CONFIG_HOME:  /var/www/html/config 
XDG_DATA_HOME:  /var/www/html/data 
  • Restart Sail: sail up -d
  • Open the container log in Docker Desktop and the log should show the loop. Also, the file storage/logs/octane-server-state.json is recreated every few seconds.
@AlliBalliBaba
Copy link
Contributor

Which folders are defined in the watch block of your config/octane.php file? Looks like the watcher is watching some kind of log file. I suggest removing the folders one by one and see if it changes anything

@jhm-ciberman
Copy link
Author

The default ones. Also, the Laravel is a standard Laravel installation:

    /*
    |--------------------------------------------------------------------------
    | File Watching
    |--------------------------------------------------------------------------
    |
    | The following list of files and directories will be watched when using
    | the --watch option offered by Octane. If any of the directories and
    | files are changed, Octane will automatically reload your workers.
    |
    */

    'watch' => [
        'app',
        'bootstrap',
        'config',
        'database/**/*.php',
        'public/**/*.php',
        'resources/**/*.php',
        'routes',
        'composer.lock',
        '.env',
    ],

@driesvints
Copy link
Member

Hey there,

Can you first please try one of the support channels below? If you can actually identify this as a bug, feel free to open up a new issue with a link to the original one and we'll gladly help you out.

Thanks!

@gazzoy
Copy link
Contributor

gazzoy commented May 14, 2024

@jhm-ciberman

I faced the same issue, and could fixed by changing octane.php as follows:

    'watch' => [
        'app',
        'bootstrap',
        'config/**/*.php', // change this line
        'database/**/*.php',
        'public/**/*.php',
        'resources/**/*.php',
        'routes',
        'composer.lock',
        '.env',
    ],

@jhm-ciberman
Copy link
Author

@driesvints maybe fixing the default config as @gazzoy is pointing?

@gazzoy
Copy link
Contributor

gazzoy commented May 14, 2024

@driesvints maybe fixing the default config as @gazzoy is pointing?

@driesvints @jhm-ciberman if that's the case, I can make PR for it, so please let me know.

@driesvints
Copy link
Member

I see, so you're using sub directories for config files? I'm not sure we support those. What happens with dot notation if you use config files like that?

@gazzoy
Copy link
Contributor

gazzoy commented May 14, 2024

@driesvints

Correct me if I'm wrong, but I believe FrankenPHP generates and updates config/caddy/autosave.json automatically in case we define XDG_CONFIG_HOME as /var/www/html/config (which is instructed to do so in doc).

That's why we see continuous Application change detected. Restarting workers….

@driesvints
Copy link
Member

@gazzoy aah gotcha. That's a good find. Yes we'd love a PR for this, thanks!

@gazzoy
Copy link
Contributor

gazzoy commented May 14, 2024

Cool, will do!

@gazzoy
Copy link
Contributor

gazzoy commented May 14, 2024

@driesvints Created PR #890. Feel free to edit the title or message in PR. Thanks!

taylorotwell pushed a commit that referenced this issue May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants