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

Nextcloud: use php.ini for cron job as well #89392

Closed
wants to merge 2 commits into from

Conversation

lheckemann
Copy link
Member

Motivation for this change

The cron jobs will sometimes fail because not enough memory is available. Enough memory would be available if the php.ini for nextcloud's fpm pool were used, so use it.

Things done
  • Deployed a nextcloud using this and checked that the cronjob now succeeds where it used to fail
  • Fits CONTRIBUTING.md.

@lheckemann
Copy link
Member Author

@ofborg test nextcloud

@aanderse
Copy link
Member

aanderse commented Jun 3, 2020

This gets complicated because the new phpIni option could be misleading. phpfpm pools will also read from php.buildEnv { extraConfig } if provided.

Let's pull in a few more minds to make sure we get this done in the most understandable way possible by pulling in a few more minds to mull this over... @NixOS/php and @jtojnar.

@etu
Copy link
Contributor

etu commented Jun 3, 2020

This could fail horribly if one used a customized PHP for the fpm pool and than that the cron job used the ini file with a non-customized PHP and pulled the ini-file from a customized one.

Better way would be to configure the PHP to contain all the settings and use the extended PHP package in both places.

Edit: This should be inside of the nextcloud module.

@aanderse
Copy link
Member

aanderse commented Jun 3, 2020

Actually reading through the code this already uses the custom php package which should include the proper ini. The issue may be here... https://github.com/mayflower/nixpkgs/blob/078cfc0926ffc5dcaa45b29cbbbb7451e0ff8a30/nixos/modules/services/web-apps/nextcloud.nix#L28

@lheckemann lheckemann marked this pull request as draft June 3, 2020 12:05
@lheckemann
Copy link
Member Author

lheckemann commented Jun 3, 2020

Hm, ok, I'm confused in that case. It was running out of memory with a limit significantly lower than our maxUploadSize. I'll convert this to a draft and will have another look at the issue.

@Ma27 Ma27 self-requested a review June 3, 2020 12:07
@Ma27
Copy link
Member

Ma27 commented Jul 12, 2020

@lheckemann did you have time to take another look at this? :)

@lheckemann
Copy link
Member Author

We're getting the following, in spite of maxUploadSize being set to 16G:

systemd[1]: Starting nextcloud-cron.service...
php[43203]: PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /rpool/nextcloud/store-apps/mail/vendor/pear-pear.horde.org/Horde_Mail/Horde/Mail/Rfc822/List.php on line 323
Nextcloud[43203]: {"reqId":"zZveIu4jbm36qnOZAWgB","level":3,"time":"2020-07-13T08:37:20+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) at /rpool/nextcloud/store-apps/mail/ven>
php[43203]: PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /rpool/nextcloud/store-apps/mail/vendor/pear-pear.horde.org/Horde_Mail/Horde/Mail/Rfc822/List.php on line 238
systemd[1]: nextcloud-cron.service: Main process exited, code=exited, status=255/EXCEPTION

So the memory limit does seem to be 128M instead of 16G, and the changes in this PR did fix that issue. What I don't understand at this point is why what @aanderse said doesn't seem to be the case:

Actually reading through the code this already uses the custom php package which should include the proper ini.

Will investigate soon.

@Ma27
Copy link
Member

Ma27 commented Jul 13, 2020

@lheckemann is this happening on 20.03? On 20.03 the PHP package in use is phpPackage = pkgs.php73; while the new php.buildEnv API is used on master to configure the package used for nextcloud-cron.

@lheckemann
Copy link
Member Author

That'll be it, thanks! 🤦‍♂️

@lheckemann lheckemann closed this Jul 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants