Open helloeyesimple opened 1 year ago
Hi,
My code is
for ($i = 1; $i < 20; $i++) { Async::run(function () use ($i) { sleep(1); return $i; }, [ 'error' => function(\Exception $e) { dump($e); } ]); } var_dump(implode(', ', Async::wait()));
But it is showing the following error:
`Spatie\Async\Output\ParallelError {#2221 ▼
trace: {▼ /var/www/public/omnichannel/vendor/spatie/async/src/Output/ParallelError.php:11 {▼ Spatie\Async\Output\ParallelError::fromException($exception): self … › { › return new self($exception); › } } /var/www/public/omnichannel/vendor/spatie/async/src/Process/ParallelProcess.php:125 {▼ Spatie\Async\Process\ParallelProcess->resolveErrorOutput(): Throwable … › if (! $exception instanceof Throwable) { › $exception = ParallelError::fromException($exception); › } arguments: {▶} } /var/www/public/omnichannel/vendor/spatie/async/src/Process/ProcessCallbacks.php:54 {▼ Spatie\Async\Process\ParallelProcess->triggerError() … › { › $exception = $this->resolveErrorOutput(); › } /var/www/public/omnichannel/vendor/spatie/async/src/Pool.php:232 {▶} /var/www/public/omnichannel/vendor/spatie/async/src/Pool.php:328 {▶} /var/www/public/omnichannel/vendor/spatie/async/src/Pool.php:154 {▶} /var/www/public/omnichannel/vendor/vxm/laravel-async/src/Async.php:106 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:239 {▶} /var/www/public/omnichannel/app/Http/Controllers/Omnichannel/NavisionController.php:179 {▼ App\Http\Controllers\Omnichannel\NavisionController->download_products() … › › var_dump(implode(', ', Async::wait())); › die; arguments: {▶} } App\Http\Controllers\Omnichannel\NavisionController->download_products() {} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Routing/Controller.php:54 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php:45 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Routing/Route.php:219 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Routing/Route.php:176 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Routing/Router.php:680 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:30 {▶} /var/www/public/omnichannel/app/Http/Middleware/IsInstalled.php:51 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php:41 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php:75 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php:49 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php:56 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php:37 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php:66 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:104 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Routing/Router.php:682 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Routing/Router.php:657 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Routing/Router.php:623 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Routing/Router.php:612 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:176 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:30 {▶} /var/www/public/omnichannel/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php:58 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53 {▶} /var/www/public/omnichannel/vendor/fideloper/proxy/src/TrustProxies.php:57 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php:21 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php:21 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php:27 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php:62 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:104 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:151 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:116 {▶} /var/www/public/omnichannel/public/index.php:53 {▼ › $response = $kernel->handle( › $request = Illuminate\Http\Request::capture() › ); arguments: {▶} } } }`
I am using nginx, PHP 7.4, and laravel-async version 2.2. (Cannot use 3.0.0 lib because it needs PHP 8) I have enabled POSIX and PCNTL too.
Please help.
Same issue any one found solution for it
Do you have php extensions (pcntl and posix) active in the php.ini?
Hi,
My code is
for ($i = 1; $i < 20; $i++) { Async::run(function () use ($i) { sleep(1); return $i; }, [ 'error' => function(\Exception $e) { dump($e); } ]); } var_dump(implode(', ', Async::wait()));
But it is showing the following error:
`Spatie\Async\Output\ParallelError {#2221 ▼
message: ""
code: 0
file: "/var/www/public/omnichannel/vendor/spatie/async/src/Output/ParallelError.php"
line: 11
trace: {▼ /var/www/public/omnichannel/vendor/spatie/async/src/Output/ParallelError.php:11 {▼ Spatie\Async\Output\ParallelError::fromException($exception): self … › { › return new self($exception); › } } /var/www/public/omnichannel/vendor/spatie/async/src/Process/ParallelProcess.php:125 {▼ Spatie\Async\Process\ParallelProcess->resolveErrorOutput(): Throwable … › if (! $exception instanceof Throwable) { › $exception = ParallelError::fromException($exception); › } arguments: {▶} } /var/www/public/omnichannel/vendor/spatie/async/src/Process/ProcessCallbacks.php:54 {▼ Spatie\Async\Process\ParallelProcess->triggerError() … › { › $exception = $this->resolveErrorOutput(); › } /var/www/public/omnichannel/vendor/spatie/async/src/Pool.php:232 {▶} /var/www/public/omnichannel/vendor/spatie/async/src/Pool.php:328 {▶} /var/www/public/omnichannel/vendor/spatie/async/src/Pool.php:154 {▶} /var/www/public/omnichannel/vendor/vxm/laravel-async/src/Async.php:106 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:239 {▶} /var/www/public/omnichannel/app/Http/Controllers/Omnichannel/NavisionController.php:179 {▼ App\Http\Controllers\Omnichannel\NavisionController->download_products() … › › var_dump(implode(', ', Async::wait())); › die; arguments: {▶} } App\Http\Controllers\Omnichannel\NavisionController->download_products() {} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Routing/Controller.php:54 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php:45 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Routing/Route.php:219 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Routing/Route.php:176 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Routing/Router.php:680 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:30 {▶} /var/www/public/omnichannel/app/Http/Middleware/IsInstalled.php:51 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php:41 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php:75 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php:49 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php:56 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php:37 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php:66 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:104 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Routing/Router.php:682 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Routing/Router.php:657 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Routing/Router.php:623 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Routing/Router.php:612 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:176 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:30 {▶} /var/www/public/omnichannel/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php:58 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53 {▶} /var/www/public/omnichannel/vendor/fideloper/proxy/src/TrustProxies.php:57 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php:21 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php:21 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php:27 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php:62 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:104 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:151 {▶} /var/www/public/omnichannel/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:116 {▶} /var/www/public/omnichannel/public/index.php:53 {▼ › $response = $kernel->handle( › $request = Illuminate\Http\Request::capture() › ); arguments: {▶} } } }`
I am using nginx, PHP 7.4, and laravel-async version 2.2. (Cannot use 3.0.0 lib because it needs PHP 8) I have enabled POSIX and PCNTL too.
Please help.