You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug description
If there are more than one script use in the Logger stream to "php://stdout" and both scripts run within CLI having the output into the same place ( php script.php > /dev/null or > /path/to/file.log) then one of the script becomes stuck.
It wasn't an issue with Phalcon4 and PHP 7.4 but after upgrade to Phalcon5.6 and PHP 8.2 it took a lot to identify why my queue workers are being stuck
To Reproduce
Write a simple infinite loop logger with while(true)
Launch them in parallel with the output into the same file on the disk
Watch the file with debug printing: it has some "NULNULNULNUL...." string and the output is almost taken but one of the worker while there is no printing from the second worker script
Steps to reproduce the behavior:
usePhalcon\Logger\Logger;
usePhalcon\Logger\Adapter\StreamasLoggerStreamAdapter;
$adapters['stdout'] = newLoggerStreamAdapter('php://stdout');
$logger = newLogger('messages', $adapters);
$num = $argv[1];
while (true) {
$logger->info('I am here ' . $num);
$logger->info('I am here again ' . $num);
sleep(1);
}
Then we should launch via cli both scripts like:
php worker.php 1 > 1.log
php worker.php 2 > 1.log
NULLNULLNULLNULLNULLNULLNULL
��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������[2024-03-14T11:45:52+00:00][INFO] I am here 1
[2024-03-14T11:45:52+00:00][INFO] I am here again 1
[2024-03-14T11:45:53+00:00][INFO] I am here 1
[2024-03-14T11:45:53+00:00][INFO] I am here again 1
[2024-03-14T11:45:54+00:00][INFO] I am here 1
[2024-03-14T11:45:54+00:00][INFO] I am here again 1
[2024-03-14T11:45:55+00:00][INFO] I am here 1
[2024-03-14T11:45:55+00:00][INFO] I am here again 1
[2024-03-14T11:45:56+00:00][INFO] I am here 1
[2024-03-14T11:45:56+00:00][INFO] I am here again 1
[2024-03-14T11:45:57+00:00][INFO] I am here 1
[2024-03-14T11:45:57+00:00][INFO] I am here again 1
[2024-03-14T11:45:58+00:00][INFO] I am here 1
Expected behavior
We expect to see printing of both 1 & 2 workers but not only one.
If we replace stream php://stdout with "echo" it works better and both printings are visible.
Details
Phalcon version: 5.6.1
PHP Version: 8.2.16
Operating System: Debian 12
Installation type: installing via package manager & compiling from source, same
Zephir version (if any):??
Server: Just command line
Additional context
No matter where you push stream: into the /path/to/file.log or /dev/null if this is the same output location one of the script is blocked forever on $logger->info line and never goes further
The text was updated successfully, but these errors were encountered:
Bug description
If there are more than one script use in the Logger stream to "php://stdout" and both scripts run within CLI having the output into the same place ( php script.php > /dev/null or > /path/to/file.log) then one of the script becomes stuck.
It wasn't an issue with Phalcon4 and PHP 7.4 but after upgrade to Phalcon5.6 and PHP 8.2 it took a lot to identify why my queue workers are being stuck
To Reproduce
Steps to reproduce the behavior:
Then we should launch via cli both scripts like:
php worker.php 1 > 1.log
php worker.php 2 > 1.log
Expected behavior
We expect to see printing of both 1 & 2 workers but not only one.
If we replace stream php://stdout with "echo" it works better and both printings are visible.
Details
Additional context
No matter where you push stream: into the /path/to/file.log or /dev/null if this is the same output location one of the script is blocked forever on $logger->info line and never goes further
The text was updated successfully, but these errors were encountered: