Issue with Contao Manager 1.10.4 - Background Task Failure on Extension Update/Install
Description
Hello everyone,
when I try to update or install contao or an extension using Contao Manager 1.10.4, I get this error:
Background Task The Contao Manager failed to start a background task!
Something went wrong while trying to execute operations in the background. If this happens again, your server might not be supported.
Is this a known issue? Also, are there any recommended configuration tweaks or optimizations for Wamp on Windows to make Contao Manager run smoother and faster?
Thanks in advance.
Just to add more detail: The initial loading of Contao Manager is extremely slow on my setup (Wamp / Windows 11).
Each of these steps takes around 5 to 10 minutes to complete:
- Preparing Composer Environment
- Checking Contao Installation
- Loading the Contao Manager interface
It happens every time I launch the Manager, making the whole experience painfully slow. Would love to know if this is expected behavior or if there's a way to improve this.
However, when I copy the Composer commands from the Contao Manager (when I manage to access them) and run them manually in the terminal, everything works fine and runs much faster.
So it seems the issue is specifically with how the Contao Manager handles these operations, not Composer itself.
This sounds like an issue with your setup. I had similar experiences with MAMP (on Mac) a long time ago, where every run of the PHP process on the command line would take several seconds to start. Can you try to run the PHP CLI (make sure its the same as the Contao Manager finds) and see if it has any delay?
Yes, it's the same PHP binary as the one used by Contao Manager: D:\wamp64\bin\php\php8.2.13\php.exe
I’ve tested running PHP commands via CLI, and there's no delay at all. Everything starts instantly in powershell.
I'm sorry I have no idea then. I'm not using Windows at all, not sure if e.g. @fritzmg has some hints or ever tried WAMP.
You could also try to run PHP from a PHP script (e.g. using shell_exec or proc_open) to see if you experience the same issues there.
Hi aschempp,
Thanks for your input. I ran some tests on my Windows setup (WAMP 64) to check PHP CLI performance as you suggested.
Running php -v directly in the terminal shows no delay.
Using a PHP script with shell_exec to call php.exe -v also executes instantly.
Testing execution time of a simple PHP CLI command (php -r "echo 'Hello from CLI';") via proc_open shows around 280 ms delay.
When running the same test inside a web page (via Apache), the execution time is roughly the same (~270 ms), so the delay seems inherent to spawning PHP processes on Windows under WAMP.
Xdebug is disabled in CLI to avoid additional overhead.
So far, the delay only appears when invoking PHP from PHP (like Contao Manager does), which matches the behavior I observe. Running PHP commands directly in the console is instant.
Hope this helps clarify the situation!
It clarifies that I have no idea whats going on or why this is happening to you then 😕
Testing execution time of a simple PHP CLI command (php -r "echo 'Hello from CLI';") via proc_open shows around 280 ms delay.
Did you test if passing the options ['bypass_shell' => true] speeds it up?
Using bypass_shell => true, the execution time drops to ~6.3 ms. I'm a bit new to this but trying to follow along with my limited knowledge :) What does this imply for Contao Manager in terms of implementation and compatibility?
My guess would be that the slowdown is either a problem with cmd on your system or a performance issue in the Symfony process handling for windows: https://github.com/symfony/symfony/blob/da8bc22646a8a1fbd5a283e7670aeb55dfb120f7/src/Symfony/Component/Process/Process.php#L1489
Thanks! So I suppose Contao doesn’t use bypass_shell, which would explain the slowdown I’m seeing on Windows. Do you think this could be tweaked in Contao Manager to use bypass_shell on Windows, or is there a reason it's avoided?
it might work for tasks that do not need background forking (like the CLI API usage). @ausi any idea what bypass_shell actually does? Or why it would be enabled by default? I guess you cannot run shell commands with bypass_shell?
This is default: https://github.com/symfony/process/blob/7.3/Process.php#L79
This is default: symfony/process@
7.3/Process.php#L79
Yes, but Symfony itself prepends the command with cmd.exe in https://github.com/symfony/process/blob/40c295f2deb408d5e9d2d32b8ba1dd61e36f05af/Process.php#L1585-L1590 which probably causes the same slowdown as bypass_shell: false would.
Well, even if bypass_shell were enabled, it wouldn't make a difference because the actual issue is not the difference between a few miliseconds or a few hundred miliseconds.
The actual issue is
Each of these steps takes around 5 to 10 minutes to complete
And I don't think all of them execute hundreds of commands that would add up to 5 minutes 😉 Imho, there's no way for us to know/investigate without having access to that system.
Hello, thanks for all the insights so far.
I realize Windows + WAMP might be less common than Linux or macOS in web CMS development. However, since it’s a relatively simple environment to set up, wouldn’t it be worthwhile for the Contao team to at least have a Windows + WAMP setup for testing?
Or maybe this is already the case, please forgive my ignorance, I mean no offense.