Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

frapto's avatar

Queue timeout: Symfony process keeps timing out at 60s ignoring my settings

why is my queue job timing out? I am using database as a driver I tried the following:

class PdfGenerator implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    protected $userData;
    protected $filename;
    protected $path;
    public $timeout = 1200;
    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct($userData, $filename)
    {
        //
        $this->userData = $userData;
        $this->filename = $filename;
        $this->path = \public_path('\pdfs\'.$this->filename.'.pdf');
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        $pdf = App::make('snappy.pdf.wrapper');
        $footer = \view('supporting.footer')->render();
        $header = \view('supporting.header')->render();
        //$userData = \collect([$this->userData[1]]);
        $pdf->loadView('order_clean', ['users' => $this->userData])
        ->setOption('margin-top', '20mm')
        ->setOption('margin-bottom', '20mm')
        ->setOption('minimum-font-size', 25)
        ->setOption('header-html', $header)
        ->setOption('footer-html', $footer);
        $pdf->save($this->path);
    }
}
php artisan queue:work --timeout=1200
php artisan queue:listen --timeout=0

yet my queue job still fails due to timeout of 60s according to the logs because the symfony process timed out. I am not using supervisor yet, just trying out how the queue works from the console

0 likes
4 replies
rodrigo.pedra's avatar

Do you call the Symfony's Process class inside your job's handle method?

If so, it has its default timeout (60 seconds) and will throw an exception when the process it is running exceeds that timeout.

The job's timeout is about how long the whole job runs. Imagine in your job you have 3 different Process running one after the other. Each process can have its own timeout, and the job timeout should account for the sum of these 3.

In case you are using it you can set a timeout value for the process like this:

// use Symfony\Component\Process\Process;

$command = new Process(/* your shell command as an array */);

// or using the alternative form
// $command = Process::fromShellCommandline(/* your shell command as a string*/);

// sets the command timeout
$command->setTimeout(1200);

$command->run();

Note: don't remove the Job's timeout property, you need to increase both the job's timeout and the Symfony Process's timeout

1 like
frapto's avatar

Hi, no i dont use it. In my handle method i use a call to laravel snappy to generate a large pdf. I updated the question with my job class

rodrigo.pedra's avatar
Level 56

You can export Laravel Snappy configuration and set a timeout to it.

First run:

php artisan vendor:publish --provider="Barryvdh\Snappy\ServiceProvider"

To export Laravel Snappy's config file.

Then in your new ./config/snappy.php file change:

'timeout' => false,

to

'timeout' => 1200,

Under both the pdf and image keys.

frapto's avatar

it also turned out that i needed to switch to linux (i was on windows using xampp before) so symfony could make use of the pcntl library

Please or to participate in this conversation.