1

Once I have executed this command php artisan WebSockets:serve and I just leave my computer idle or sleep mode. After 7-8 hours ( checked from WebSocket's statistic table ), the WebSockets has stopped working. Following is the log that I retrieved from my server's command prompt.

ExceptionInvalidArgumentExceptionthrown:Unable to parse URI: http://:6001/
apps/{app_id}/events?auth_key={CUSTOM_APP_ID}&auth_signature=a15f9e44b3acc77160d228d8
6c733c4813c54d73e321fb3a1643249eab25531d&auth_timestamp=1611788876&auth_version=
1.0&body_md5=bbafc96e27e4303190e125ed0345c6c5`

PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 262144 bytes) in Server\Directory\vendor\react\promise-stream\src\functions.php on line 61

Symfony\Component\Debug\Exception\FatalErrorException : Allowed memory size
of 134217728 bytes exhausted (tried to allocate 262144 bytes)

at Server\Directory\vendor\react\promise-stream\src\functions.php:6
1
57| $buffer = '';
58|
59| $promise = new Promise\Promise(function ($resolve, $reject) use ($st
ream, $maxLength, &$buffer, &$bufferer) {
60| $bufferer = function ($data) use (&$buffer, $reject, $maxLength)
{

61| $buffer .= $data;
62|
63| if ($maxLength !== null && isset($buffer[$maxLength])) {
64| $reject(new \OverflowException('Buffer exceeded maximum
length'));
65| }

Whoops\Exception\ErrorException: Allowed memory size of 134217728 bytes exhausted (tried to allocate 262144 bytes)

at Server\Directory\vendor\react\promise-stream\src\functions.php:6
1
57| $buffer = '';
58|
59| $promise = new Promise\Promise(function ($resolve, $reject) use ($st
ream, $maxLength, &$buffer, &$bufferer) {
60| $bufferer = function ($data) use (&$buffer, $reject, $maxLength)
{

61| $buffer .= $data;
62|
63| if ($maxLength !== null && isset($buffer[$maxLength])) {
64| $reject(new \OverflowException('Buffer exceeded maximum
length'));
65| }

Exception trace:

1 Whoops\Run::handleError("Allowed memory size of 134217728 bytes exhausted
(tried to allocate 262144 bytes)", "Server\Directory\vendor\react\pro
mise-stream\src\functions.php")
Server\Directory\vendor\filp\whoops\src\Whoops\Run.php:454

2 Whoops\Run::handleShutdown()
[internal]:0

According to the log, it keeps showing "Exception InvalidArgumentException" until the PHP Fatal error happened. I even upgraded my memory_limit from 128M to 256M in php.ini file. Still getting this error on my server.

Drew
  • 123
  • 10
  • This is the bigest clue `PHP Fatal error: Allowed memory size of 134217728 bytes exhausted ` You have blown your 128meg memory limit, can you access php.ini to increase this – RiggsFolly Feb 01 '21 at 16:59
  • If you are still getting this error then you didnt amend the correct `php.ini` file is the most likey reason – RiggsFolly Feb 01 '21 at 17:00
  • @RiggsFolly ok, I have double confirm that ```256M``` in php.ini is correct. Currently, I am facing new error which is ```PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to all ocate 262144 bytes) in C:\Inetpub\needlePlayground\vendor\react\promise-stream\s rc\functions.php on line 61 ```. Any idea to solve this? – Drew Feb 03 '21 at 02:38
  • Well `268435456` = `256M`, so you have blown the limit again. Makes me think that there is something wrong in the code yo have written. You cannot just keep increasing the limit without a good reason. – RiggsFolly Feb 03 '21 at 13:47
  • @RiggsFolly I think the Laravel WebSockets's statistic code contains bugs. After the statistic feature has set to false, I didn't receive any error and it is still working. Just that I cannot store/observe the statistical data. Thanks for the help! – Drew Feb 04 '21 at 10:29
  • Hey @Drew, I do have a similiar problem since years with Laravel websockets. They suddenly stop working around 128mib and supervisord fails to restart them. Setting statistics to `false` didn't help unfortunately. The error you described here you saw in debug mode after running `php artisan websockets:serve` for some time, right? – Hillcow Jun 23 '21 at 07:50
  • @Hillcow Hi, sorry for late reply. Setting statistic to ````false```` is working in my case so far but the downside is I cannot check or gather the data from statistics. Yes you are right for ````php artisan websockets:serve```` and around 7-8 hrs for me. – Drew Aug 08 '21 at 09:25
  • @Drew thanks, but turning of stats did not help at all unfortunately. – Hillcow Sep 05 '21 at 13:19

0 Answers0