Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to fetch large mailbox #4343

Closed
shunkica opened this issue Nov 13, 2024 · 4 comments
Closed

Unable to fetch large mailbox #4343

shunkica opened this issue Nov 13, 2024 · 4 comments

Comments

@shunkica
Copy link
Contributor

shunkica commented Nov 13, 2024

PHP version: 8.2
FreeScout version: 1.8.156
Database: MySQL
Are you using CloudFlare: No
Are you using non-official modules: No

I am trying to set up Freescout for a mailbox which has around 50GB of unread mail from the last 10 or so days.

Even though I have given PHP a 2G memory limit it is still not enough, as the fetching process keeps crashing with:

Allowed memory size of 2147483648 bytes exhausted (tried to allocate 5323576 bytes) {"exception":"[object] (Symfony\Component\Debug\Exception\FatalErrorException(code: 1): Allowed memory size of 2147483648 bytes exhausted (tried to allocate 5323576 bytes) at /www/html/overrides/webklex/php-imap/src/Structure.php:109)

And in the browser I get 504 timeout when running manual fetch.

It would appear as if the app was trying to buffer all the emails at once, because there is no single mail which is over 50MB in size, let alone 2G.

Default docker installation, no modules and no customizations. I am posting here as I don't believe this has anything to do with the app running in Docker.

Let me know if there is any additional info I can provide.

@freescout-help
Copy link
Collaborator

Email are fetches in bunches of 300 emails: https://github.com/freescout-help-desk/freescout/blob/dist/app/Console/Commands/FetchEmails.php#L62

Apparently you have some large email or email with a large attachment.

@shunkica
Copy link
Contributor Author

shunkica commented Nov 13, 2024

Indeed after manually changing the PAGE_SIZE to 20 in the source directly the fetching starts working.
Can I change the PAGE_SIZE via some env variable?
Also now I am still having the problem with script execution timeouts, and 504 timeouts.

@freescout-help
Copy link
Collaborator

Can I change the PAGE_SIZE via some env variable?

No.

Also now I am still having the problem with script execution timeouts, and 504 timeouts.

Try to run fetching via the server console. There can be no timeouts via the console:

php artisan freescout:fetch-emails

@shunkica
Copy link
Contributor Author

Ok, thank you. I will post a feature request to allow modification of PAGE_SIZE.

@shunkica shunkica closed this as not planned Won't fix, can't repro, duplicate, stale Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants