laravel / octane

Supercharge your Laravel application's performance.
https://laravel.com/docs/octane
MIT License
3.74k stars 291 forks source link

Missleading uncaught error when createSwooleServer fail in try-catch block #927

Closed mm-sol closed 1 month ago

mm-sol commented 1 month ago

Octane Version

2.5.2

Laravel Version

11.15.0

PHP Version

8.3.9

What server type are you using?

Swoole

Server Version

5.1.3

Database Driver & Version

No response

Description

When server throw error in /vendor/laravel/octane/bin/createSwooleServer.php in try-catch block it will not return thrown error, instead it will be this: `Fatal error: Uncaught Error: Class "Laravel\Octane\Octane" not found in /app/vendor/laravel/octane/src/Stream.php:56 Stack trace:

0 /app/vendor/laravel/octane/bin/createSwooleServer.php(19): Laravel\Octane\Stream::shutdown(Object(Swoole\Exception))

1 /app/vendor/laravel/octane/bin/swoole-server(35): require('/app/vendor/lar...')

2 {main}

thrown in /app/vendor/laravel/octane/src/Stream.php on line 56`

Environment: docker Root image for dockerfile: php:8.3-cli-bookworm

In our case it was too low port, but to get to this we had to put good old var_dump on exception, which shouldn't be necessary

Steps To Reproduce

  1. prepare environment in which swoole server with laravel octane will fail to start (i.e. low port on restricted system)
  2. run php artisan octane:start --server=swoole --host=0.0.0.0 --port {LOW_PORT}
driesvints commented 1 month ago

Thanks. We'd very much appreciate PR's that make this exception more clear.