core icon indicating copy to clipboard operation
core copied to clipboard

Scanner stops scanning SMB shares without visible reason, StorageNotAvailableException

Open mmattel opened this issue 10 years ago • 12 comments

Steps to reproduce

  1. Create a SMB share
  2. Start two shells, for the ./occ command and the other tail -f ownlcloud.log
  3. Run sudo -uwww-data ./occ files:scan --all -v

Expected behaviour

Scanning should pass when running over SMB shares, no errors should get logged. It worked in the past.

Actual behaviour

Scanning stops at one file (interrestingly always the same), but this file was scanned in the past without problems. When owncloud "hangs", no error is logged. On 9.0.2, the error gets logged when you interrupt (press ctrl-c). On 9.1, no error gets logged...

Notes:

Because I thought that this clould be a samba problem (as it was last time), I deinstalled and reinstalled samba completely from scartch. Then I accessed samba via fstab mounts and smbclient and all worked well as before. Even typing in smbclient allinfo "\Import\2006-08-19\2006-08-13_09-56-44_DSC0981.JPG\" returned the right results and showed no problem. On 9.1, you can use the command sudo -uwww-data ./occ files:scan --all --unscanned -v to scan those folders who have not been scanned before. Using that, you get some folders further, but it again stops at another file and does not go over it. The reason for StorageNotAvailableException is absolutely not clear to me as a.) it worked before and b.) this is local lan 1Gbit/s Deleting the SMB mount, cleaning up the cache with files:cleanup and remount, does not changethe behaviour.

Server configuration

Operating system: Ubuntu 14.04 Running samba version: 2:4.3.9+dfsg-0ubuntu0.14.04.3

Web server: nginx 1.9.14

Database: mysql

PHP version: 5.5.9

ownCloud version: (see ownCloud admin page) Two instances: ownCloud 9.0.2 RC1 (daily) Build:2016-04-28T03:03:12+00:00 795f321a1985b682bff584f252dd6f2fd95dad65 ownCloud 9.1.0 beta 2 (git)

Updated from an older ownCloud or fresh install: This was a fresh setup from tar and updated once, daily channel

Where did you install ownCloud from: tar

Signing status (ownCloud 9.0 and above):

Datei nicht gefunden
Das ausgewählte Dokument wurde auf dem Server nicht gefunden.
Sie können zur Rückkehr zu ownCloud hier klicken.

List of activated apps (9.0.2):

Enabled:
  - activity: 2.2.1
  - comments: 0.2
  - dav: 0.1.6
  - federatedfilesharing: 0.1.0
  - federation: 0.0.4
  - files: 1.4.4
  - files_external: 0.5.2
  - files_pdfviewer: 0.8.1
  - files_sharing: 0.9.1
  - files_texteditor: 2.1
  - files_trashbin: 0.8.0
  - files_versions: 1.2.0
  - files_videoplayer: 0.9.8
  - firstrunwizard: 1.1
  - gallery: 14.5.0
  - notifications: 0.2.3
  - provisioning_api: 0.4.1
  - systemtags: 0.2
  - templateeditor: 0.1
  - updatenotification: 0.1.0
Disabled:
  - encryption
  - external
  - user_external
  - user_ldap

The content of config/config.php (9.0.2, principly the same for 9.1):

{
    "system": {
        "instanceid": "ock982ae3c5s",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "xxxx"
        ],
        "datadirectory": "\/var\/www\/owncloud\/data",
        "overwrite.cli.url": "https:\/\/xxxx",
        "dbtype": "mysql",
        "version": "9.0.2.0",
        "dbname": "owncloud",
        "dbhost": "localhost",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "logtimezone": "Europe\/Vienna",
        "installed": true,
        "filelocking.enabled": "true",
        "memcache.local": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "localhost",
            "port": 6379,
            "timeout": 0,
            "dbindex": 0
        },
        "assetdirectory": "\/var\/www\/owncloud",
        "asset-pipeline.enabled": true,
        "filesystem_check_changes": 1,
        "preview_max_scale_factor": 1,
        "enabledPreviewProviders": [
            "OC\\Preview\\PNG",
            "OC\\Preview\\JPEG",
            "OC\\Preview\\GIF",
            "OC\\Preview\\Illustrator",
            "OC\\Preview\\Postscript",
            "OC\\Preview\\Photoshop",
            "OC\\Preview\\TIFF",
            "OC\\Preview\\Raw"
        ],
        "loglevel": 2,
        "maintenance": false,
        "mail_smtpmode": "smtp",
        "mail_smtpsecure": "tls",
        "mail_from_address": "owncloud",
        "mail_domain": "xxxx",
        "mail_smtpauthtype": "LOGIN",
        "mail_smtpauth": 1,
        "mail_smtphost": "xxxx",
        "mail_smtpport": "587",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***"
    }
}

Are you using external storage, if yes which one: local/smb/sftp/... SMB

Are you using encryption: yes/no No

Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/... No

Client configuration

Browser: Opera

Operating system: W7x64

Logs

owncloud.log

For 9.0.2:

{"reqId":"f6DxiwBd7vrT5G5ho1hX","remoteAddr":"","app":"no app in context","message":"Storage smb::host@storage\/\/smb_share_name\/\/ not available","level":3,"time":"2016-06-08T13:47:53+02:00","method":"--","url":"--","user":"--"}

{"reqId":"f6DxiwBd7vrT5G5ho1hX","remoteAddr":"","app":"no app in context","message":"Exception: {\"Exception\":\"OCP\\\\Files\\\\StorageNotAvailableException\",\"Message\":\"Unknown error (smb: \\\\> allinfo \\\"\\\\Import\\\\2006-08-19\\\\2006-08-13_09-56-44_DSC0981.JPG\\\")\",\"Code\":0,\"Trace\":\"
#0 \\\/var\\\/www\\\/owncloud\\\/apps\\\/files_external\\\/lib\\\/smb.php(319): OC\\\\Files\\\\Storage\\\\SMB->getFileInfo('Import\\\/2006-08-...')\\
n#1 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/files\\\/storage\\\/common.php(97): OC\\\\Files\\\\Storage\\\\SMB->filetype('Import\\\/2006-08-...')\\
n#2 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/files\\\/storage\\\/common.php(131): OC\\\\Files\\\\Storage\\\\Common->is_dir('Import\\\/2006-08-...')\\
n#3 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/files\\\/storage\\\/common.php(151): OC\\\\Files\\\\Storage\\\\Common->isCreatable('Import\\\/2006-08-...')\\
n#4 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/files\\\/storage\\\/common.php(635): OC\\\\Files\\\\Storage\\\\Common->getPermissions('Import\\\/2006-08-...')\\
n#5 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/files\\\/storage\\\/wrapper\\\/wrapper.php(566): OC\\\\Files\\\\Storage\\\\Common->getMetaData('Import\\\/2006-08-...')\\
n#6 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/files\\\/storage\\\/wrapper\\\/availability.php(455): OC\\\\Files\\\\Storage\\\\Wrapper\\\\Wrapper->getMetaData('Import\\\/2006-08-...')\\
n#7 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/files\\\/storage\\\/wrapper\\\/wrapper.php(566): OC\\\\Files\\\\Storage\\\\Wrapper\\\\Availability->getMetaData('Import\\\/2006-08-...')\\
n#8 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/files\\\/storage\\\/wrapper\\\/encryption.php(172): OC\\\\Files\\\\Storage\\\\Wrapper\\\\Wrapper->getMetaData('Import\\\/2006-08-...')\\
n#9 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/files\\\/storage\\\/wrapper\\\/wrapper.php(566): OC\\\\Files\\\\Storage\\\\Wrapper\\\\Encryption->getMetaData('Import\\\/2006-08-...')\\
n#10 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/files\\\/cache\\\/scanner.php(111): OC\\\\Files\\\\Storage\\\\Wrapper\\\\Wrapper->getMetaData('Import\\\/2006-08-...')\\
n#11 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/files\\\/cache\\\/scanner.php(142): OC\\\\Files\\\\Cache\\\\Scanner->getData('Import\\\/2006-08-...')\\
n#12 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/files\\\/cache\\\/scanner.php(385): OC\\\\Files\\\\Cache\\\\Scanner->scanFile('Import\\\/2006-08-...', 3, '23795', NULL, true)\\
n#13 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/files\\\/cache\\\/scanner.php(425): OC\\\\Files\\\\Cache\\\\Scanner->scanChildren('Import\\\/2006-08-...', true, 3, Array, true)\\
n#14 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/files\\\/cache\\\/scanner.php(425): OC\\\\Files\\\\Cache\\\\Scanner->scanChildren('Import', true, 3, Array, true)\\
n#15 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/files\\\/cache\\\/scanner.php(305): OC\\\\Files\\\\Cache\\\\Scanner->scanChildren('', true, 3, Array, true)\\
n#16 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/files\\\/utils\\\/scanner.php(172): OC\\\\Files\\\\Cache\\\\Scanner->scan('', true, 3)\\
n#17 \\\/var\\\/www\\\/owncloud\\\/apps\\\/files\\\/command\\\/scan.php(131): OC\\\\Files\\\\Utils\\\\Scanner->scan('\\\/user_x')\\
n#18 \\\/var\\\/www\\\/owncloud\\\/apps\\\/files\\\/command\\\/scan.php(196): OCA\\\\Files\\\\Command\\\\Scan->scanFiles('user_x', '\\\/user_x', true, Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\
n#19 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/symfony\\\/console\\\/Command\\\/Command.php(259): OCA\\\\Files\\\\Command\\\\Scan->execute(Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\
n#20 \\\/var\\\/www\\\/owncloud\\\/core\\\/command\\\/base.php(158): Symfony\\\\Component\\\\Console\\\\Command\\\\Command->run(Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\
n#21 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/symfony\\\/console\\\/Application.php(840): OC\\\\Core\\\\Command\\\\Base->run(Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\
n#22 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/symfony\\\/console\\\/Application.php(192): Symfony\\\\Component\\\\Console\\\\Application->doRunCommand(Object(OCA\\\\Files\\\\Command\\\\Scan), Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\
n#23 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/symfony\\\/console\\\/Application.php(123): Symfony\\\\Component\\\\Console\\\\Application->doRun(Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\
n#24 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/console\\\/application.php(145): Symfony\\\\Component\\\\Console\\\\Application->run(NULL, NULL)\\
n#25 \\\/var\\\/www\\\/owncloud\\\/console.php(84): OC\\\\Console\\\\Application->run()\\
n#26 \\\/var\\\/www\\\/owncloud\\\/occ(11): require_once('\\\/var\\\/w...')\\
n#27 {main}\",\"File\":\"\\\/var\\\/www\\\/owncloud\\\/apps\\\/files_external\\\/lib\\\/smb.php\",\"Line\":119}","level":3,"time":"2016-06-08T13:47:53+02:00","method":"--","url":"--","user":"--"}

For 9.1: No log entry is ceated

mmattel avatar Jun 08 '16 12:06 mmattel

Note: there is generic code that converts the exception to "StorageNotAvailableException" so it might be a legitimate unhandled SMB error that mistakenly gets converted to that.

Ideally "StorageNotAvailableException" should rather be "opt-in", meaning that only a subset of exceptions where we know that it's really away gets converted to that.

That aside, the "Unknown error" really looks weird.

@icewind1991 there isn't even an error code this time

PVince81 avatar Jun 08 '16 15:06 PVince81

It would be helpful to know what the error code is or getting more about because then I would be able to dive in deeper. "StorageNotAvailableException" is imho misleading. I was completely rechecking my physical smb backend because of this message. The weired thing is that 9.0.2 reports an error and 9.1 does not but both stuck at the same thing.

mmattel avatar Jun 08 '16 15:06 mmattel

Made additional tests: It stucks not on a folder but on a file level access. I can see this with the verbose level set. That what wonders me really is, that the error thrown is NOT automatically pushed, but is triggered when pressing ctrl-c because the process is somewhere stuck and there is no more progress.

mmattel avatar Jun 08 '16 16:06 mmattel

When the error occurs and you let the files:scan command rerun you get:

{"reqId":"k7tinuVxy2H\/cS3UGEy4","remoteAddr":"","app":"no app in context","message":"Storage failedstorage not available","level":3,"time":"2016-06-08T18:10:34+02:00","method":"--","url":"--","user":"--"}

Refreshing the browser screen helps and I can run the command from the console again ??

mmattel avatar Jun 08 '16 16:06 mmattel

More info:

  • Mounting another SMB folder containing ~4000 files and folders (this is the only one mounted) and starting the scan manually, it worked.
  • The problematic but previously working SMB mount contains ~19k files and folders and stops at ~2000

mmattel avatar Jun 08 '16 17:06 mmattel

I am also having the same issue on 9.0.2 and 9.0.3 did not have the issue on 8.2.3 though

running Debian 8 apache php 5.6 mysql DB

laurensqq avatar Jul 20 '16 13:07 laurensqq

I thought I am the only one having strange issues. Now I feel not so alone anymore... :smile:

@laurensqq would you please describe your folderdetails (how many elements in total ect..) where it runs into, pls see my comment above. Trying to figure out if the quantity of elements to be processed could be an issue. Pls also document the command you used.

@PVince81 @icewind1991 for me it seems that getting this error is just a symptom which is somehow triggered by something else, but the real cause is somewhere else.

mmattel avatar Jul 20 '16 13:07 mmattel

sorry for the late replay,

the root folder structure are 331 folders . scanning stops at folder 23, contains 4 folders directly below it and is 9.4 MB is size.

root folder size is 9.21 GB in size and contains 16 223 files

command used is "php /var/www/owncloud/occ files:scan --all -v"

laurensqq avatar Aug 16 '16 06:08 laurensqq

https://github.com/owncloud/core/pull/26529 could help with that

PVince81 avatar Jan 13 '17 15:01 PVince81

is this still an issue with OC 10.0.2 ?

PVince81 avatar Aug 07 '17 20:08 PVince81

Please reopen if issue still appears with 10.0.4.

PVince81 avatar Dec 12 '17 15:12 PVince81

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock[bot] avatar Aug 02 '19 04:08 lock[bot]