cockpit: Too many open files on Siteground

I’m getting a 500 error when trying to create a collection on SiteGround

The php_errorlog shows

[21-Apr-2018 12:25:46 UTC] PHP Fatal error:  Uncaught exception 'RuntimeException' with message 'SplFileObject::__construct(/home/[redacted]/public_html/cockpit-master/assets/app/media/icons/image.svg): failed to open stream: Too many open files' in /home/[redacted]/public_html/cockpit-master/lib/Lime/Helper/Filesystem.php:48
Stack trace:
#0 /home/[redacted]/public_html/cockpit-master/lib/Lime/Helper/Filesystem.php(48): SplFileObject->__construct('/home/[redacted]/...')
#1 /home/[redacted]/public_html/cockpit-master/storage/tmp/collection.php.b2f467b25b0eee2f9e5a113d790beecc.lexy.php(39): Lime\Helper\Filesystem->ls('*.svg', 'assets:app/medi...')
#2 /home/[redacted]/public_html/cockpit-master/lib/Lexy.php(435): include('/home/[redacted]/...')
#3 /home/[redacted]/public_html/cockpit-master/lib/Lexy.php(124): lexy_include_with_params('/home/[redacted]/...', Array, '/home/[redacted]/...')
#4 /home/[redacted]/public_html/cockpit-master/lib/LimeExtra/App.php(107): Lexy->file('/home/[redacted]/...', Array)
#5 /home/[redacted]/public_html/cockpit-master/lib/LimeExtra/Controller.php(43): in /home/[redacted]/public_html/cockpit-master/lib/Lime/Helper/Filesystem.php on line 48

When I ssh into siteground “ulimit -n” shows 1024. It’s shared hosting so it won’t let me increase the limit and Siteground won’t do it for me.

I’m not running any other processes. There is no traffic to speak of on the site yet. Everything works fine in my local Docker container. It fails with both Master and Next on SiteGround I’ve tried PHP 7.2 (which fails for a different reason), PHP 7.1 and PHP 5.6. This is a new install, so there shouldn’t be many files yet. storage and all subdirectories are writable. files are being written to storage/tmp. assets/app/media/icons has 60 files in it. Nowhere near 1024.

Is there a way around this beside upgrading my hosting account or switching providers? Perhaps a code patch?

If not, anybody successfully using Cockpit CMS on Siteground, what service level do I need?

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15 (8 by maintainers)

Commits related to this issue

Most upvoted comments

It works. Thank you very much.

I was aware of needing a more robust solution and I had the idea with a dummy class, too. This is why I called it a “dirty hack”. But I would have to do a lot of research about file handling for it. Thanks for doing the work.

I tested it on strato with unknown ulimit and on an Uberspace7 with ulimit 1024. Both are able to create new collections.

I wasn’t able to update the folders on strato (wget ..., cp -u -r ...) with existing config and storage for any reason (404 on collections page). But I can’t reproduce it. I did too much tests and rewrote some code serverside…

A fresh installation (wget https://github.com/agentejo/cockpit/archive/next.zip) worked fine on both servers. Updating an installation with existing storage on Uberspace via git pull worked, too.

Now I’m happy 😄