Occ files:scan and PHP Fatal error Allowed memory exhausted

Nextcloud version (eg, 10.0.2): 11.0.1
Operating system and version (eg, Ubuntu 16.04): CentOS Linux release 7.3.1611 (Core)
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.6 (CentOS)
PHP version (eg, 5.6): PHP 7.1.1
Is this the first time you’ve seen this error and can you replicate it?: no and yes

The issue you are facing:

For some users, an ‘occ files:scan username’ displays this error message:

Starting scan for user 1 out of 1 (username)
PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 20480 bytes) in /www/nextcloud-11.0.1/apps/files_external/3rdparty/icewind/smb/src/NativeShare.php on line 90

and exits. Apart from the fact that this error is happening, I’m curious about the “/smb/” in the error message. Is this indicating that perhaps an external smb storage is being scanned? If so, should that be happening? I didn’t expect that ownCloud or Nextcloud would scan external storages.

The output of your Nextcloud log in Admin > Logging:

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

The output of your Apache/nginx/system log in /var/log/____:


Remember, this information may be requested if it isn’t supplied; for fastest response please provide as much as you can :heart: Feel free to use a pastebin service, otherwise log files can be indented with 4 spaces on each line to present them in a friendlier way on the forum.

Hi,

I happened to deal with Archlinux/Nextcloud issues this weekend and suffering from the same issues(it ate 16G memory and no clues whether it will stop anyway. )I suspect that it’s due to config.php is not updated towards the most current permission(switching from http->nextcloud) or there’s an issue when upgrading nextcloud.

I finally managed to solve it by re-installed nextcloud. Not sure it’s the best way of dealing with it.

1 Like

Hey I have the same issue. In how far you reinstalled it? Just reinstalled the package or a complete fresh install of Nextcloud 21? How did you migrate your old data back to the new install?

I already created a bug report for the Archlinux package and posted about here. Very strange issue :frowning:

DO NOT DO THIS UNLESS YOU 1000% SURE WHAT YOU ARE DOING. IT MAY CAUSE DATA LOSSES!!!

I reinstalled it by

  1. Remove all php/nextcloud packages.
  2. (PLEASE MAKE SURE YOU UNDERSTAND WHAT YOU ARE DOING)clean the database, and recreated an empty one
  3. mv your data under data/[USERNAME] to somewhere else
  4. Reinstall all packages.
  5. I used uwsgi, but the ini file in the package is not quite correct. Have to make some changes there. I have to add 1) chmod-socket = 666 2) add /var/log/nextcloud into open_basedir 3) I use systemd for cron job, so comment out the last line.
  6. Then rerun installation guidance.
  7. Restore data/[USERNAME] to /var/lib/nextcloud/data and run occ files:scan --all

I lost my contacts, calendars because those are in database, but luckily I have local backups. Also there still issues cannot be solved now such as it’s referencing /tmp/nextcloudtemp but it’s not in /usr/lib/tmpfiles.d/nextcloud.conf