shaarli / Shaarli

The personal, minimalist, super-fast, database free, bookmarking service - community repo
https://shaarli.readthedocs.io/
Other
3.45k stars 297 forks source link

infinityfree.net shared hosting : error "Not enough available disk space to save the datastore" #1985

Open aegidius77 opened 1 year ago

aegidius77 commented 1 year ago

Hi,

After completing the Install Shaarli page, I get the Shaarli is now configured. Please login and start shaaring your bookmarks! page, which is OK. But after trying to log in, I get a error message. Never got this error before when installing shaarli-v0.12.1. Is it a hosting side problem (like PHP version) ? Regards

install informations :

shaarli-v0.12.2
hosting : Infinityfree.net
Server requirements / Permissions : All read/write permissions are properly set.
PHP : Running PHP 7.4.8
Required extensions : all required extensions loaded (json, simplexml, mbstring)
Optional extensions loaded : gd, intl, curl, gettext
Optional extensions not loaded : ldap

error message :

An unexpected error happened, and the error template could not be displayed.

Not enough available disk space to save the datastore.
/home/volxxx/epizy.com/xxx/htdocs/shaarli/application/bookmark/BookmarkIO.php134
#0 /home/volxxx/epizy.com/xxx/htdocs/shaarli/vendor/malkusch/lock/classes/mutex/LockMutex.php(42): Shaarli\Bookmark\BookmarkIO->Shaarli\Bookmark\{closure}()
#1 /home/volxxx/epizy.com/xxx/htdocs/shaarli/application/bookmark/BookmarkIO.php(155): malkusch\lock\mutex\LockMutex->synchronized(Object(Closure))
#2 /home/volxxx/epizy.com/xxx/htdocs/shaarli/application/bookmark/BookmarkIO.php(141): Shaarli\Bookmark\BookmarkIO->synchronized(Object(Closure))
#3 /home/volxxx/epizy.com/xxx/htdocs/shaarli/application/bookmark/BookmarkFileService.php(317): Shaarli\Bookmark\BookmarkIO->write(Object(Shaarli\Bookmark\BookmarkArray))
#4 /home/volxxx/epizy.com/xxx/htdocs/shaarli/application/bookmark/BookmarkFileService.php(415): Shaarli\Bookmark\BookmarkFileService->save()
#5 /home/volxxx/epizy.com/xxx/htdocs/shaarli/application/bookmark/BookmarkFileService.php(87): Shaarli\Bookmark\BookmarkFileService->initialize()
#6 /home/volxxx/epizy.com/xxx/htdocs/shaarli/application/container/ContainerBuilder.php(101): Shaarli\Bookmark\BookmarkFileService->__construct(Object(Shaarli\Config\ConfigManager), Object(Shaarli\Plugin\PluginManager), Object(Shaarli\History), Object(malkusch\lock\mutex\FlockMutex), true)
#7 /home/volxxx/epizy.com/xxx/htdocs/shaarli/vendor/pimple/pimple/src/Pimple/Container.php(118): Shaarli\Container\ContainerBuilder->Shaarli\Container\{closure}(Object(Shaarli\Container\ShaarliContainer))
#8 /home/volxxx/epizy.com/xxx/htdocs/shaarli/vendor/slim/slim/Slim/Container.php(109): Pimple\Container->offsetGet('bookmarkService')
#9 /home/volxxx/epizy.com/xxx/htdocs/shaarli/vendor/slim/slim/Slim/Container.php(164): Slim\Container->get('bookmarkService')
#10 /home/volxxx/epizy.com/xxx/htdocs/shaarli/application/container/ContainerBuilder.php(114): Slim\Container->__get('bookmarkService')
#11 /home/volxxx/epizy.com/xxx/htdocs/shaarli/vendor/pimple/pimple/src/Pimple/Container.php(118): Shaarli\Container\ContainerBuilder->Shaarli\Container\{closure}(Object(Shaarli\Container\ShaarliContainer))
#12 /home/volxxx/epizy.com/xxx/htdocs/shaarli/vendor/slim/slim/Slim/Container.php(109): Pimple\Container->offsetGet('pageBuilder')
#13 /home/volxxx/epizy.com/xxx/htdocs/shaarli/vendor/slim/slim/Slim/Container.php(164): Slim\Container->get('pageBuilder')
#14 /home/volxxx/epizy.com/xxx/htdocs/shaarli/application/front/controller/visitor/ErrorController.php(20): Slim\Container->__get('pageBuilder')
#15 [internal function]: Shaarli\Front\Controller\Visitor\ErrorController->__invoke(Object(Slim\Http\Request), Object(Slim\Http\Response), Object(Shaarli\Bookmark\Exception\NotEnoughSpaceException))
#16 /home/volxxx/epizy.com/xxx/htdocs/shaarli/vendor/slim/slim/Slim/App.php(701): call_user_func_array(Object(Shaarli\Front\Controller\Visitor\ErrorController), Array)
#17 /home/volxxx/epizy.com/xxx/htdocs/shaarli/vendor/slim/slim/Slim/App.php(394): Slim\App->handleException(Object(Shaarli\Bookmark\Exception\NotEnoughSpaceException), Object(Slim\Http\Request), Object(Slim\Http\Response))
#18 /home/volxxx/epizy.com/xxx/htdocs/shaarli/vendor/slim/slim/Slim/App.php(297): Slim\App->process(Object(Slim\Http\Request), Object(Slim\Http\Response))
#19 /home/volxxx/epizy.com/xxx/htdocs/shaarli/index.php(202): Slim\App->run(true)
#20 {main}
nodiscc commented 1 year ago

Not enough available disk space to save the datastore.

How much free disk space is available?

aegidius77 commented 1 year ago

Well, 5GB should be enough ... As I said, shaarli 0.12.1 works fine, but not shaarli 0.12.2.

nodiscc commented 1 year ago

The free disk space check was added in v0.12.2 https://github.com/shaarli/Shaarli/blob/master/application/bookmark/BookmarkIO.php#L169, and it checks that the disk_free_space function is available before running. However, I found clues that InfinityFree.net might have disabled this function in a way that it always returns 0 (https://forum.infinityfree.net/t/expressionengine-unable-to-update/63826/3).

To double-check this, could you edit application/bookmark/BookmarkIO.php, and replace return disk_free_space(dirname($this->datastore)) > (strlen($data) + 1024 * 500); with return PHP_INT_MAX; return True;, and tell us if you are able to add bookmarks?

(This is a dirty workaround, but if the server setup lies about how much free space is available, I don't see a proper fix right now)

aegidius77 commented 1 year ago

Hi,

Thank you and sorry for late replying.

I replaced the line you told me about and here is the error message I get :

An unexpected error happened, and the error template could not be displayed.
Return value of Shaarli\Bookmark\BookmarkIO::checkDiskSpace() must be of the type bool, int returned
/home/vol19_2/epizy.com/.../htdocs/shaarli12/application/bookmark/BookmarkIO.php171
#0 /home/vol19_2/epizy.com/.../htdocs/shaarli12/application/bookmark/BookmarkIO.php(133): Shaarli\Bookmark\BookmarkIO->checkDiskSpace(' #1 /home/vol19_2/epizy.com/.../htdocs/shaarli12/vendor/malkusch/lock/classes/mutex/LockMutex.php(42): Shaarli\Bookmark\BookmarkIO->Shaarli\Bookmark\{closure}()
#2 /home/vol19_2/epizy.com/.../htdocs/shaarli12/application/bookmark/BookmarkIO.php(155): malkusch\lock\mutex\LockMutex->synchronized(Object(Closure))
#3 /home/vol19_2/epizy.com/.../htdocs/shaarli12/application/bookmark/BookmarkIO.php(141): Shaarli\Bookmark\BookmarkIO->synchronized(Object(Closure))
#4 /home/vol19_2/epizy.com/.../htdocs/shaarli12/application/bookmark/BookmarkFileService.php(317): Shaarli\Bookmark\BookmarkIO->write(Object(Shaarli\Bookmark\BookmarkArray))
#5 /home/vol19_2/epizy.com/.../htdocs/shaarli12/application/bookmark/BookmarkFileService.php(415): Shaarli\Bookmark\BookmarkFileService->save()
#6 /home/vol19_2/epizy.com/.../htdocs/shaarli12/application/bookmark/BookmarkFileService.php(87): Shaarli\Bookmark\BookmarkFileService->initialize()
#7 /home/vol19_2/epizy.com/.../htdocs/shaarli12/application/container/ContainerBuilder.php(101): Shaarli\Bookmark\BookmarkFileService->__construct(Object(Shaarli\Config\ConfigManager), Object(Shaarli\Plugin\PluginManager), Object(Shaarli\History), Object(malkusch\lock\mutex\FlockMutex), true)
#8 /home/vol19_2/epizy.com/.../htdocs/shaarli12/vendor/pimple/pimple/src/Pimple/Container.php(118): Shaarli\Container\ContainerBuilder->Shaarli\Container\{closure}(Object(Shaarli\Container\ShaarliContainer))
#9 /home/vol19_2/epizy.com/.../htdocs/shaarli12/vendor/slim/slim/Slim/Container.php(109): Pimple\Container->offsetGet('bookmarkService')
#10 /home/vol19_2/epizy.com/.../htdocs/shaarli12/vendor/slim/slim/Slim/Container.php(164): Slim\Container->get('bookmarkService')
#11 /home/vol19_2/epizy.com/.../htdocs/shaarli12/application/container/ContainerBuilder.php(114): Slim\Container->__get('bookmarkService')
#12 /home/vol19_2/epizy.com/.../htdocs/shaarli12/vendor/pimple/pimple/src/Pimple/Container.php(118): Shaarli\Container\ContainerBuilder->Shaarli\Container\{closure}(Object(Shaarli\Container\ShaarliContainer))
#13 /home/vol19_2/epizy.com/.../htdocs/shaarli12/vendor/slim/slim/Slim/Container.php(109): Pimple\Container->offsetGet('pageBuilder')
#14 /home/vol19_2/epizy.com/.../htdocs/shaarli12/vendor/slim/slim/Slim/Container.php(164): Slim\Container->get('pageBuilder')
#15 /home/vol19_2/epizy.com/.../htdocs/shaarli12/application/front/controller/visitor/ErrorController.php(20): Slim\Container->__get('pageBuilder')
#16 [internal function]: Shaarli\Front\Controller\Visitor\ErrorController->__invoke(Object(Slim\Http\Request), Object(Slim\Http\Response), Object(TypeError))
#17 /home/vol19_2/epizy.com/.../htdocs/shaarli12/vendor/slim/slim/Slim/App.php(728): call_user_func_array(Object(Shaarli\Front\Controller\Visitor\ErrorController), Array)
#18 /home/vol19_2/epizy.com/.../htdocs/shaarli12/vendor/slim/slim/Slim/App.php(396): Slim\App->handlePhpError(Object(TypeError), Object(Slim\Http\Request), Object(Slim\Http\Response))
#19 /home/vol19_2/epizy.com/.../htdocs/shaarli12/vendor/slim/slim/Slim/App.php(297): Slim\App->process(Object(Slim\Http\Request), Object(Slim\Http\Response))
#20 /home/vol19_2/epizy.com/.../htdocs/shaarli12/index.php(202): Slim\App->run(true)
#21 {main}
nodiscc commented 1 year ago

Sorry, it should be return True; instead of return PHP_INT_MAX;

aegidius77 commented 1 year ago

It worked. Thanks.

nodiscc commented 1 year ago

This is just a workaround, and even though the problem is specific to this shared hosting provider, and to their strange PHP config, we may want to add a way to disable free disk space checking in the configuration (without manually changing application code).

magicvince commented 1 year ago

Solution is also available for ouvaton.coop

seyfro commented 1 year ago

FYI - got the same issue on my server - changed application/bookmark/BookmarkIO.php as described above and it works again