execution of the debt script.

Good day to all!

Please tell me!
I searched the whole Internet, I didn’t find an answer.

When executing long scripts, the whole site hangs, waits for the script to finish, after which you can use the site.

it’s not even about the script, I
made an empty action, with sticking for 40 seconds:

public function actionFork()

when accessing this page of the site, the
script is run, and the “fork” page waits 40 seconds,

why can’t I use the site at the moment? other pages of the site? the
whole site is just waiting for the completion of this script.

at the same time, if I am at the root of the directory, I create a directory “dir”, and in this folder in .htaccess I specify that this folder, as if it had nothing to do with the engine, so that you can access its contents.

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php

I create two files:
" index.php " (site.ru/dir/index.php )


and " start.php " (site.ru/dir/start.php )

echo '!@';

then I can use these pages in parallel until " index.php " waiting for 40 seconds. when accessing it…
I open start.php
And I see ‘!@’

why when using Yii2
open the page site.ru/task/fork :

public function actionFork()

I can’t open any of the pages of this site, the
whole site is just waiting for the script to run.

as if it does not give the opportunity to work with the site in parallel with the execution of this script

I cannot test any of the pages. I get 503
Do you use PHP development server or Apache or something like that?

I am able to reproduce this. I used Debian/Apache Server. The CPU is 99% idle during the sleep time - so the system has plenty of resources to service the other unrelated request. I was getting worried as this is a huge performance implication. But fear not! I tested this in production configuration and everything works great and the unrelated request does NOT wait for the sleep to complete. I would like to know which configuration causes this and I suspect this may be related to the Debug configuration. It would be nice to not have this issue in Development Environment as well, if possible.