Skip to content

OCP\Lock\LockedException during files:scan  #24507

Closed

Description

@morodin

Steps to reproduce

  1. Starting file scan: php console.php files:scan all

Expected behaviour

Scan finishes.

Actual behaviour

The scan is stopped with the following exception:

  [OCP\Lock\LockedException]
  "files/e2d61478e39c7ca55b79526151165f30" is locked

files:scan [-p|--path="..."] [-q|--quiet] [--all] [user_id1] ... [user_idN]

The user has no files at all, there might be a shared file with this user.
We found similar problems, tried the solution suggested, like setting the service in maintenance mode and clearing the file_locks table, but without success.

I'm quite sure that the data i can provide is not enough to analyse this issue and would be more than happy to do additional tests.

Server configuration

Operating system: CentOS release 6.7
Web server: Apache/2.2.15
Database: mysql 5.1.73
PHP version: PHP 5.6.20
ownCloud version: 8.2.4
Updated from older install, all the way up from 6.x.
Where did you install ownCloud from:
Installed form tar archive.

Settings page reports "All checks passed".

List of activated apps:
Enabled:

  • files: 1.2.1
  • files_pdfviewer: 0.7.1
  • files_sharing: 0.7.0
  • files_texteditor: 2.0
  • files_trashbin: 0.7.0
  • files_versions: 1.1.0
  • files_videoviewer: 0.1.3
  • firstrunwizard: 1.1
  • gallery: 14.2.0
  • notifications: 0.1.0
  • updater: 0.6
  • user_ldap: 0.7.1

Disabled:

  • activity
  • bookmarks
  • calendar
  • contacts
  • documents
  • encryption
  • external
  • files_external
  • mozilla_sync
  • news
  • provisioning_api
  • templateeditor
  • user_external

The content of config/config.php:

$CONFIG = array (
  'instanceid' => 'xx',
  'passwordsalt' => 'xx',
  'datadirectory' => '/export/owncloud-data',
  'dbtype' => 'mysql',
  'dbname' => 'owncloud',
  'dbhost' => 'localhost',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'owncloud',
  'dbpassword' => 'xx',
  'installed' => true,
  'loglevel' => 2,
  'log_rotate_size' => '104857600',
  'ldapIgnoreNamingRules' => false,
  'forcessl' => true,
  'theme' => '',
  'maintenance' => false,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'preview_libreoffice_path' => '/usr/bin/libreoffice',
  'enable_previews' => true,
  'trusted_domains' =>
  array (
    0 => 'xx.example.domain.com',
  ),
  'mail_smtpmode' => 'smtp',
  'mail_from_address' => 'owncloud',
  'mail_domain' => 'exampe.domain.com',
  'mail_smtphost' => '127.0.0.1',
  'mail_smtpport' => '25',
  'version' => '8.2.4.2',
  'secret' => 'xx',
  'trashbin_retention_obligation' => 'auto',
);

Are you using external storage, if yes which one:
no

Are you using encryption:
no

Are you using an external user-backend, if yes which one:
ActiveDirectory

LDAP configuration (delete this part if not used)

+-------------------------------+------------------------------------------------------------------------------+
| Configuration                 | s01                                                                          |
+-------------------------------+------------------------------------------------------------------------------+
| hasMemberOfFilterSupport      | 1                                                                            |
| hasPagedResultSupport         |                                                                              |
| homeFolderNamingRule          |                                                                              |
| lastJpegPhotoLookup           | 0                                                                            |
| ldapAgentName                 | cn=someuser,ou=someou,dc=example,dc=com                           |
| ldapAgentPassword             | ***                                                                          |
| ldapAttributesForGroupSearch  |                                                                              |
| ldapAttributesForUserSearch   |                                                                              |
| ldapBackupHost                | ldap://dc.example.com                                            |
| ldapBackupPort                | 389                                                                          |
| ldapBase                      | dc=example,dc=com                                                 |
| ldapBaseGroups                | dc=example,dc=com                                                 |
| ldapBaseUsers                 | dc=example,dc=com                                                 |
| ldapCacheTTL                  | 600                                                                          |
| ldapConfigurationActive       | 1                                                                            |
| ldapEmailAttribute            | mail                                                                         |
| ldapExperiencedAdmin          | 0                                                                            |
| ldapExpertUUIDGroupAttr       |                                                                              |
| ldapExpertUUIDUserAttr        |                                                                              |
| ldapExpertUsernameAttr        |                                                                              |
| ldapGroupDisplayName          | cn                                                                           |
| ldapGroupFilter               | (&(|(objectclass=group)))                                                    |
| ldapGroupFilterGroups         |                                                                              |
| ldapGroupFilterMode           | 0                                                                            |
| ldapGroupFilterObjectclass    | group                                                                        |
| ldapGroupMemberAssocAttr      | member                                                                       |
| ldapHost                      | ldap://ldap.example.com
| ldapIgnoreNamingRules         |                                                                              |
| ldapLoginFilter               | (&(&(|(l=xx)(l=yy))(objectclass=user))(samaccountname=%uid)) |
| ldapLoginFilterAttributes     |                                                                              |
| ldapLoginFilterEmail          | 0                                                                            |
| ldapLoginFilterMode           | 0                                                                            |
| ldapLoginFilterUsername       | 1                                                                            |
| ldapNestedGroups              | 0                                                                            |
| ldapOverrideMainServer        | 0                                                                            |
| ldapPagingSize                | 500                                                                          |
| ldapPort                      | 389                                                                          |
| ldapQuotaAttribute            |                                                                              |
| ldapQuotaDefault              |                                                                              |
| ldapTLS                       | 1                                                                            |
| ldapUserDisplayName           | displayname                                                                  |
| ldapUserDisplayName2          |                                                                              |
| ldapUserFilter                | (&(|(l=xx)(l=yy))(objectclass=user))                         |
| ldapUserFilterGroups          |                                                                              |
| ldapUserFilterMode            | 1                                                                            |
| ldapUserFilterObjectclass     | person                                                                       |
| ldapUuidGroupAttribute        | auto                                                                         |
| ldapUuidUserAttribute         | auto                                                                         |
| turnOffCertCheck              | 1                                                                            |
| useMemberOfToDetectMembership | 1                                                                            |
+-------------------------------+------------------------------------------------------------------------------+

Client configuration

Browser: n.a.a
Operating system:

Logs

Web server error log

nothing relevant here

ownCloud log (data/owncloud.log)

no entry during the scan at all

Activity

  1. PVince81 commented on May 10, 2016

    @PVince81
    Contributor

    Did you try adding --:

    Before: php console.php files:scan all
    After: php console.php files:scan --all

    The syntax you used would try and scan files for a user called "all".

  2. PVince81 commented on May 10, 2016

    @PVince81
    Contributor

    The output you posted does look like you used the wrong syntax.
    Still, it's weird that it would show a LockedException in this case.

    CC @icewind1991

  3. morodin commented on May 10, 2016

    @morodin
    Author

    I did use the correct syntax. I even got the a user list and called the scan for each user. I still get the error for some users.

  4. PVince81 commented on May 10, 2016

    @PVince81
    Contributor

    Does the scanner abort after the error or continues scanning ?
    It is also likely that the folders were really in use by users, so they were locked.

    But if it's always the same ones during each scan, maybe there are stray locks in the database.
    In this case, plan a maintenance window and in that time, enable maintenance mode, then delete * from oc_file_locks, disable maintenance mode.

  5. morodin commented on May 10, 2016

    @morodin
    Author

    It is always the same one. And, as I wrote, did the 'enable maintenance mode, delete * from oc_file_locks, disable maintenance mode'. Starting the scan populates the oc_file_locks table again and the scan stops at exactly the same point.

  6. PVince81 commented on May 10, 2016

    @PVince81
    Contributor

    Do you happen to have any symlinks in your folder structure ?

  7. morodin commented on May 10, 2016

    @morodin
    Author

    If you mean the owncloud data directory, no. The only symlink I have is from /export/owncloud to /export/owncloud-8.2.4.

  8. d3vm4t commented on May 13, 2016

    @d3vm4t

    I faced the same issue after upgrading from version 8.2.3 to 8.2.4. After the upgrade I tried to scan the files with php occ files:scan --all and ran into the mentioned exception:

    [OCP\Lock\LockedException]
    "files/xxx" is locked
    
    files:scan [-p|--path="..."] [-q|--quiet] [--all] [user_id1] ... [user_idN]
    

    Then I have cleared everything in the oc_file_locks table but after doing a scan with files:scan --all the table was filled with the same content again and the scan stopped at same position with the same exception. Clearing the oc_file_cache table and doing another scan led to the same problem.
    Nothing useful in the logs... I could not find a solution. Therefore I rolled the installation back to my 8.2.3 backup but kept the database and files of 8.2.4 so I can give further information about this case. But I don't really know which information might be helpful.
    I have nearly the same configuration as morodin. The owncloud installation is on a shared hosting server with Apache/2.4.10 and PHP Version 5.6.12. I have only apps enabled that are enabled by default so there is actually nothing special with the installation. With owncloud 6 up to 8.2.3 everything was/is fine with it. I only get the exception mentioned above with 8.2.4. I have installed 8.2.4 from zip archive. The md5 sum was correct.
    Please let me know which information might be helpful to specify the problem.

    Edit: Of course, I meant php occ files:scan --all instead of php occ files:scan -all.

  9. PVince81 commented on May 17, 2016

    @PVince81
    Contributor

    @d3vm4t thanks for the info.

    @icewind1991 would be good to have a way to get more debug info about locks in a productive environment, at least to find out which file is affected by the stray lock.

  10. added this to the milestone on May 17, 2016
  11. PVince81 commented on May 17, 2016

    @PVince81
    Contributor

    @d3vm4t when you say "everything was fine with 8.2.3", do you mean that "occ files:scan --all" does not stop at the lock ? This could be an important clue as we can find out what changed in the code between the versions and could possibly cause this issue.

  12. morodin commented on May 17, 2016

    @morodin
    Author

    For me, this issue existed with 8.2.2 as well. And i would second the comment about getting info which file is causing the lock. Do you have any way that we can go now to find out, which file it is?

  13. 7 remaining items

  14. PVince81 commented on May 17, 2016

    @PVince81
    Contributor

    And here we go, this is breaking commit: fd8e3f7 from PR #24260 @icewind1991

  15. PVince81 commented on May 17, 2016

    @PVince81
    Contributor

    It seems to work fine in v9.0.2.

    So maybe there is something in the 8.2 specific code that is triggering this issue, possibly the way how sharing works. Note that sharing has been reworked in 9.0.2.

  16. PVince81 commented on Jun 13, 2016

    @PVince81
    Contributor

    Just retried on stable8.2 and the problem still exists.

    @icewind1991 please have a look, see steps here #24507 (comment)

  17. PVince81 commented on Jun 16, 2016

    @PVince81
    Contributor

    Problem did not exist in 8.1. Fixed in 8.2.6.

  18. crysman commented on Jun 24, 2016

    @crysman

    I've had the same issue.
    I've been able to run php occ files:scan --all without any errors with LOCK after I disabled the Share Files 0.7.0 plugin.

    BUT, after I enabled the plugin again, the issue is back :/ There is something wrong... And according to what I am reporting here, it is primarily connected to that plugin.

    I've updated today to 8.2.5 (8.2.5.2), I do not know if it worked before the update, though :/

  19. PVince81 commented on Jun 24, 2016

    @PVince81
    Contributor

    Fixed in 8.2.6.

    If you like you could try with 8.2.6 RC1

  20. crysman commented on Jun 24, 2016

    @crysman

    If its fixed in 2.6, I'll wait for non-rc public version and instll it via standard Debian repo, thanks!

  21. crysman commented on Jan 2, 2017

    @crysman

    I've just tried it in 9.1.2 and it runs and ends correctly except some exceptions thrown just by some users.

  22. Matan commented on Mar 30, 2017

    @Matan

    I'm getting this same issue on oc 9.1.4 (docker with 'latest' tag), I even disabled the sharing app, still happened.

  23. Tarry91 commented on Sep 17, 2017

    @Tarry91

    I do have the same problem, just at the beginning of the scan of one of the users. The very first thing the scan does is throwing the " "files/...." is locked " error. I already tried all the tips posted above without any success.
    Implementing PVince81s debug code I get the following line in the logfile:

    {"reqId":"clzRBbobD4Vt5FmE6kMv","level":0,"time":"2017-09-17T20:56:36+02:00","remoteAddr":"","user":"--","app":"LOCKING","method":"--","url":"--","message":"acquireLock $path="scanner::" $type="2"","userAgent":"--","version":"12.0.2.0"}

    does that make sense to anyone?

    EDIT: A server restart seems to fix this problem for me. strange.

  24. 0prinz0 commented on Sep 21, 2017

    @0prinz0
  25. lock commented on Aug 2, 2019

    @lock

    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.

  26. locked as resolved and limited conversation to collaborators on Aug 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions