freescout-help-desk / freescout

FreeScout — Free self-hosted help desk & shared mailbox (Zendesk / Help Scout alternative)
https://freescout.net
GNU Affero General Public License v3.0
2.87k stars 481 forks source link

Allowed memory size exhausted #3956

Closed githubuser-112 closed 4 months ago

githubuser-112 commented 4 months ago

Hi,

one of our agents is blocked out of the system, the log shows the following:

Allowed memory size of 536870912 bytes exhausted (tried to allocate 3689224 bytes) {"userId":4,"email":"xxx@xxx.tld","exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalErrorException(code: 1): Allowed memory size of 536870912 bytes exhausted (tried to allocate 3689224 bytes) at ..../web/vendor/laravel/framework/src/Illuminate/Cache/FileStore.php:187)

Any idea how to fix it and why it is only happening to one agent? Rest of the agents can access the system without problem.

Thank you very much!

PHP version: 8.2.17 FreeScout version: 1.8.119 Database: MySQL Are you using CloudFlare: No

freescout-helpdesk commented 4 months ago

Can you give the full error message.

githubuser-112 commented 4 months ago

Thanks for your fast response!

This is the full error message. After that there's only "[stacktrace] #0 {main} "}".

githubuser-112 commented 4 months ago

Just checked the server error file, here´s the entry:

2024/04/12 10:04:50 [error] 2856680#2856680: *96110973 FastCGI sent in stderr: "PHP message: PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 3689224 bytes) in /web/vendor/laravel/framework/src/Illuminate/Cache/FileStore.php on line 187" while reading response header from upstream, client: xxx.xxx.xxx.xxx, server: xxx.tld, request: "GET / HTTP/2.0", upstream: "fastcgi://unix:/var/lib/php5-fpm/web33_1112ed3f.sock:", host: "xxx.tld"

freescout-helpdesk commented 4 months ago

There should be full stacktrace in Manage > Logs > App Logs

githubuser-112 commented 4 months ago

Unfortunately there is not, please see screenshot:

grafik

freescout-helpdesk commented 4 months ago

Click on it to unfold (On the grey square to the left from "Allowed...")

githubuser-112 commented 4 months ago

This is unfolded already. I´m sorry, but there is not more information given by the system.

Just for you to check, this is how it looks before clicking:

grafik

borgarlie commented 4 months ago

We also quite often get a similar issue. Perhaps a couple of times a day.

Allowed memory size of 4294967296 bytes exhausted (tried to allocate 4294967304 bytes) {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalErrorException(code: 1): Allowed memory size of 4294967296 bytes exhausted (tried to allocate 4294967304 bytes) at /www/html/overrides/webklex/php-imap/src/Connection/Protocols/ImapProtocol.php:275)
[stacktrace]
#0 {main}
"}

(Nothing more in stacktrace)

We have tried increasing the memory a few times, but even get the issue at 4gb. I would assume there is some memory leak somewhere, but I am not that familiar with PHP.

NOTE: We have 500 users, 74 mailboxes, 350k threads in the database, and 1000s of emails incoming daily. The issue is almost always a part of the fetch emails job.

Edit: This is probably not at all related to the issue you are describing regarding an agent getting locked out.

freescout-helpdesk commented 4 months ago

This is unfolded already. I´m sorry, but there is not more information given by the system.

It means the issue need to be investigated on your server by someone.

slokhorst commented 3 weeks ago

Same issue here. I'm using the tiredofit/docker-freescout docker image.

Freescout is unable to fetch any email from the server. It seems like the fetching process uses too much memory.

image

slokhorst commented 3 weeks ago

Apparently, this is an issue with webklex/php-imap, which cannot handle emails with large attachments. From that issue: "for saving a 18MB File from an E-Mail you need a memory limit of 400MB".

Increasing memory_limit in your php.ini is a workaround, but this is only reliable if you have a hard limit on email size in your inbox, which you are sure is never exceeded.

freescout-help commented 3 weeks ago

@slokhorst See https://github.com/Webklex/php-imap/issues/433#issuecomment-2288560006 This issue originally was devoted to another problem. So better not to continue in this issue.