barryvdh/laravel-snappy

The process has been signaled with signal "11".

vaibhavsingh31390 opened this issue · 2 comments

I have been successfully using the Snappy library to generate PDFs on my Windows machine. However, when attempting to generate the same PDF on a CentOS-based server, I encountered an error. This issue seems to occur specifically when dealing with large datasets, resulting in PDFs exceeding 3000 pages.

Steps Taken:

Installed CentOS 7 specific version of Snappy.
Attempted to utilize Snappy via Composer library directly.
Error Encountered:
Symfony\Component\Process\Exception\ProcessSignaledException
The process has been signaled with signal "11".

do {
$this->checkTimeout();
$running = $this->isRunning() && ('\' === \DIRECTORY_SEPARATOR || $this->processPipes->areOpen());
$this->readPipes($running, '\' !== \DIRECTORY_SEPARATOR || !$running);
} while ($running);
while ($this->isRunning()) {
$this->checkTimeout();
usleep(1000);
}

    if ($this->processInformation['signaled'] && $this->processInformation['termsig'] !== $this->latestSignal) {
        throw new ProcessSignaledException($this);
    }

Additional Information:

The error occurs consistently when processing large datasets.
The PDF generation process works without issue on a Windows environment.
This issue impedes the functionality of the application on the CentOS server.
I would appreciate any insights or suggestions on how to resolve this issue and successfully generate PDFs on the CentOS server using the Snappy library.
image

         $body = view('ENG.Reports.Bomrep.BomRepdtlallpdfBody', compact('fdatas', 'unit_detail', 'unit_code', 'unitname', 'pcode', 'userData'))->render();
            $snappy = app('snappypdf'); // Use the 'snappypdf' service
            $header = view('ENG.Reports.Header')->render();
            $pdf = $snappy->loadHTML($body, [], [
                'enable-local-file-access' => true,
                'orientation' => 'portrait',
                'encoding' => 'UTF-8',
                'dpi' => 72,
            ]);
            $pdf->setTimeout(100000000);
            $pdf->setOption('margin-top', 12);
            $pdf->setOption('header-html', $header);
            $pdf->setOption('header-spacing', 2);
            return $pdf->download('BOMdetail.pdf');

The code I am using to create the PDF, this works until 800 pages after that it gives the same error but only on centOS server environment.

The issue was my global header and the JS

<script> var date = new Date(); var time = date.toLocaleTimeString(); var formattedDate = date.toDateString().split(' ').slice(1).join('-'); document.write(formattedDate + ', ' + time); </script> <br> <script> var vars = {}; var x = document.location.search.substring(1).split('&'); for (var i in x) { var z = x[i].split('=', 2); vars[z[0]] = unescape(z[1]); } document.write('Page ' + vars['page'] + ' of ' + vars['topage']); </script>