Skip to content

csync tests fail with file locking enabled #16794

Closed

Description

@DeepDiver1975

https://ci.owncloud.org/job/client-test-matrix-linux-no-build/compiler=g++,label=master,mirallBranch=v1.8.1,qt=qt4,serverVersion=owncloud8.1-locking,tc=t4/49/console

!!! OCC::PUTFileJob created for "https://test1.owncloud.com/owncloud8.1-locking/" + "t1-20150606182231-23/test_ignored/sub/file.txt" 
void OCC::AbstractNetworkJob::slotFinished() 299 "Error downloading https://mirall-test:[email protected]/owncloud8.1-locking/remote.php/webdav/t1-20150606182231-23/test_ignored/sub/file.txt - server replied: Locked" 
void OCC::PropagateUploadFileQNAM::slotPutFinished()  QUrl( "https://mirall-test:[email protected]/owncloud8.1-locking/remote.php/webdav/t1-20150606182231-23/test_ignored/sub/file.txt" )  FINISHED WITH STATUS 299 "Error downloading https://mirall-test:[email protected]/owncloud8.1-locking/remote.php/webdav/t1-20150606182231-23/test_ignored/sub/file.txt - server replied: Locked" QVariant(int, 423) QVariant(QString, "Locked") 
"<?xml version="1.0" encoding="utf-8"?>
<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
  <s:exception>OC\Connector\Sabre\Exception\FileLocked</s:exception>
  <s:message>files/31812182908e584fabc491926ff04e5c is locked</s:message>
</d:error>
" 
blacklisting  "test_ignored/sub/file.txt"  for  25 , retry count  1 

Activity

  1. added this to the milestone on Jun 8, 2015
  2. DeepDiver1975 commented on Jun 8, 2015

    @DeepDiver1975
    ContributorAuthor

    @PVince81 @icewind1991 @dragotin we need combined forces here - THX

  3. PVince81 commented on Jun 8, 2015

    @PVince81
    Contributor

    Yes, this is what happens when a file is locked.
    So either the test isn't supposed to lock, maybe there's a stray lock.
    Or the test is doing stuff in parallel and it triggers the new locking logic.

  4. PVince81 commented on Jun 8, 2015

    @PVince81
    Contributor

    @DeepDiver1975 where is the source code for those csync tests ?

  5. DeepDiver1975 commented on Jun 8, 2015

    @DeepDiver1975
    ContributorAuthor
  6. PVince81 commented on Jun 8, 2015

    @PVince81
    Contributor

    I locally ran t1.pl and also t4.pl (which is the one that contains "test_ignored") and the tests passed.
    Ran them several times and they worked fine.
    So it's possibly a race condition of some sorts...

    I also noticed with redis-cli and the KEYS * command that after the test run there are quite a few stray keys.
    After t1.pl: 32 stray keys
    After t4.pl: 19 stray keys
    Leaking keys could be an explanation for the failing test on Jenkins.

    I will try every possible file operation and find out which one is leaking keys.

  7. PVince81 commented on Jun 8, 2015

    @PVince81
    Contributor

    Here is a list of file operations and how many keys are left in redis after doing them:
    (keys are cleared with the FLUSHALL command between runs)

    web UI

    • create file: 3
    • create folder: 2
    • upload file: 7
    • delete file: 6
    • delete folder: 4
    • download file: 2
    • display file list: 1 (it seems to recreate a preview over and over again for some reason ?)

    WebDAV

    • create folder: 2
    • upload file: 2
    • delete file: 7
    • delete folder: 4
    • download file: 2
    • propfind: 0

    For operations that use fopen(), I can understand that the keys aren't released until later due to the fclose() detection that happens only at GC time. I'm not sure why other operations like creating a folder would leak keys.

    Any idea @icewind1991 ?

    I'll redo a test run with t1.pl and check whether the keys auto-expire after a while.

  8. DeepDiver1975 commented on Jun 8, 2015

    @DeepDiver1975
    ContributorAuthor

    FYI: I'm using apcu on that test server as lock storage

  9. PVince81 commented on Jun 8, 2015

    @PVince81
    Contributor

    We might want to run these tests on redis on Jenkins instead, which we agreed would be the recommended approach, at least for the beginning.

    I'll try with apcu later.

  10. DeepDiver1975 commented on Jun 8, 2015

    @DeepDiver1975
    ContributorAuthor

    We might want to run these tests on redis on Jenkins instead, which we agreed would be the recommended approach, at least for the beginning.

    I'm very much aware of this - the test server runs some old suse - I doubt we have redis at hand ... easily

  11. PVince81 commented on Jun 8, 2015

    @PVince81
    Contributor
    • TODO: test if keys expire

    t1.pl: 32 stray keys, after more than 5 minutes, the keys are still there.
    If I restart Apache2, hoping to force GC, but the keys are still there.
    That's bad.

    • TODO: test with apcu => ran t1.pl then t4.pl, no errors
    • TODO: unobfuscate key names (they are md5) to find out what paths are still locked
  12. PVince81 commented on Jun 8, 2015

    @PVince81
    Contributor

    Is the APCu cache cleared between test runs ?
    I suppose that Jenkins is running all the t*.pl tests in order ?
    Maybe one of the previous tests is leaving something locked.

    • TODO: run all t*.pl tests in order with redis
    • TODO: run all t*.pl tests in order with APCu
  13. DeepDiver1975 commented on Jun 8, 2015

    @DeepDiver1975
    ContributorAuthor

    I suppose that Jenkins is running all the t*.pl tests in order ?

    No - pure random execution - can even be selective (what I do in case of one test failing)

  14. 10 remaining items

  15. PVince81 commented on Jun 8, 2015

    @PVince81
    Contributor

    Ran all the csync tests locally in order, with APCu and redis. They all passed.
    After that I dumped the redis DB and can confirm that all keys were set to "0" as @icewind1991 said.

  16. PVince81 commented on Jun 8, 2015

    @PVince81
    Contributor

    @DeepDiver1975 if APCu isn't cleant up and the tests are running since the PR existed and evolved over several commits, maybe there's a key that got stuck at that moment due to broken/old code ?

  17. icewind1991 commented on Jun 8, 2015

    @icewind1991
    Contributor

    #16800 for cleaning up keys

  18. PVince81 commented on Jun 8, 2015

    @PVince81
    Contributor
  19. DeepDiver1975 commented on Jun 8, 2015

    @DeepDiver1975
    ContributorAuthor

    @DeepDiver1975 if APCu isn't cleant up and the tests are running since the PR existed and evolved over several commits, maybe there's a key that got stuck at that moment due to broken/old code ?

    let me kill the instance and install from scratch - this will generate a new instance id and result in a clean apc cache .....

    .... wait - what is the TTL for our locks?

  20. PVince81 commented on Jun 8, 2015

    @PVince81
    Contributor

    I don't remember seeing any TTL logic in the locking providers. @icewind1991 ?
    Might need to call "setTimeout()" on the keys every time we touch them to refresh the timeout.

  21. DeepDiver1975 commented on Jun 8, 2015

    @DeepDiver1975
    ContributorAuthor

    hmmm . didn't we initially talk about a TTL? Locks cannot stay forever

  22. PVince81 commented on Jun 8, 2015

    @PVince81
    Contributor

    Yes, still an open todo it seems: #11804 (comment)

  23. PVince81 commented on Jun 12, 2015

    @PVince81
    Contributor

    @icewind1991 can you add the TTL ? I saw in the redis API that it should be possible to set a timeout on lock keys. Let's keep this ticket open for that.

  24. icewind1991 commented on Jun 12, 2015

    @icewind1991
    Contributor

    What do we want to do with the other memcache backends? from what I can tell not all of them have the ability to set the ttl separately and most of them don't handle ttl the way we want with inc/dec

  25. PVince81 commented on Jun 12, 2015

    @PVince81
    Contributor

    Hmmm, it means that for other backends we would need to implement the timeout logic ourselves. One possibility would be to add the lock time inside the value.

    And then for every lock operation, we'd need to check the time first... and potentially lose atomicity.

  26. DeepDiver1975 commented on Jun 16, 2015

    @DeepDiver1975
    ContributorAuthor

    all green now -> close - THX

  27. PVince81 commented on Jun 16, 2015

    @PVince81
    Contributor

    Raised #16966 for the TTL discussion (please schedule accordingly)

  28. locked as resolved and limited conversation to collaborators on Aug 11, 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