Skip to content

Pdf export with local chromium did not terminate #86

@OoYo0uto

Description

@OoYo0uto

Thanks for providing this module!

Describe the bug

When creating a PDF report, the PDF download kept loading.

To Reproduce

Steps to reproduce the behavior:

  1. I tried to download a PDF of my Icinga Report under Reporting > Reports > [The Report] > Download > PDF
  2. A new browser tab opened, but the PDF kept loading and never finished.

Expected behavior

I expected that the PDF is shown.

Your Environment

  • Module version: v.0.12.0
  • Dependent module versions:
  • Icinga Web 2 version and modules (System - About):
Icinga Web 2 Version 	2.12.6
Git commit 	a9e04752c5be0c015d6b2a3c5b2f752fece16487
PHP Version 	8.4.16
Git commit date 	2025-11-18

Loaded Libraries
icinga/icinga-php-library 	0.18.1
icinga/icinga-php-thirdparty 	0.14.0

Loaded Modules
director 		1.11.5
icingadb 		1.3.0
incubator 		0.23.0
pdfexport 		0.12.0
reporting 		1.0.5
  • Chrome/Chromium version (google-chrome --version):
    I used the debian chromium, which is probably unspported, but it would be nice if it worked: chromium-headless-shell 144.0.7559.109-2~deb13u1. I used the local command line version, not the remote config.

  • Web browser and version: 140.7.0esr (64-bit)

  • PHP version used (php --version):

PHP 8.4.16 (cli) (built: Dec 18 2025 21:19:25) (NTS)
Copyright (c) The PHP Group
Built by Debian
Zend Engine v4.4.16, Copyright (c) Zend Technologies
    with Zend OPcache v8.4.16, Copyright (c), by Zend Technologies
  • Server operating system and version: Debian 13

Additional context

I performed a bit printf-Debugging and the cause was that the Loop::run in HeadlessChrome.php did never terminate. I am not really proficient in async PHP programming and the code base, but I was able to fix it by adding the following before $chrome->terminate() (Line 349 in HeadlessChrome.php):

foreach($chrome->pipes as $pipe) {
        $pipe->close();
}

This is also what ReactPHP recommends (https://reactphp.org/child-process/#termination) when dealing with processes which spawn sub-processes (like Chrome/Chromium does):

Keep the above section in mind if you want to forcefully terminate a process.
If your process spawn sub-processes or implicitly uses the
[wrapping shell mentioned above](https://reactphp.org/child-process/#command),
its file descriptors may be inherited to child processes and terminating the
main process may not necessarily terminate the whole process tree.
It is highly suggested that you explicitly close() all process pipes accordingly
when terminating a process:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions