owncloud / ocis

:atom_symbol: ownCloud Infinite Scale Stack
https://doc.owncloud.com/ocis/next/
Apache License 2.0
1.39k stars 182 forks source link

postprocessing state of a non accessible file should not affect a DELETE #9244

Open butonic opened 5 months ago

butonic commented 5 months ago

in the https://github.com/owncloud/ocis/pull/9236 the [ci failed](https://drone.owncloud.com/owncloud/ocis/35340/44/6

  @issue-3561 @provisioning_api-app-required
  Scenario Outline: listing other user's trashbin is prohibited for newly recreated user with same name # /drone/src/tests/acceptance/features/coreApiTrashbin/trashbinFilesFolders.feature:211
    Given using <dav-path-version> DAV path                                                             # FeatureContext::usingOldOrNewDavPath()
    And user "testtrashbin102" has been created with default attributes and without skeleton files      # FeatureContext::userHasBeenCreatedWithDefaultAttributes()
    And user "testtrashbin102" has uploaded file "filesForUpload/textfile.txt" to "/textfile0.txt"      # FeatureContext::userHasUploadedAFileTo()
    And user "testtrashbin102" has uploaded file "filesForUpload/textfile.txt" to "/textfile2.txt"      # FeatureContext::userHasUploadedAFileTo()
    And user "Brian" has been created with default attributes and without skeleton files                # FeatureContext::userHasBeenCreatedWithDefaultAttributes()
    And user "testtrashbin102" has deleted file "/textfile0.txt"                                        # FeatureContext::userHasDeletedResource()
    And user "testtrashbin102" has deleted file "/textfile2.txt"                                        # FeatureContext::userHasDeletedResource()
    And user "testtrashbin102" has been deleted                                                         # FeatureContext::userHasBeenDeleted()
    And user "testtrashbin102" has been created with default attributes and without skeleton files      # FeatureContext::userHasBeenCreatedWithDefaultAttributes()
    And user "testtrashbin102" has uploaded file "filesForUpload/textfile.txt" to "/textfile3.txt"      # FeatureContext::userHasUploadedAFileTo()
    And user "testtrashbin102" has deleted file "/textfile3.txt"                                        # FeatureContext::userHasDeletedResource()
    When user "Brian" tries to list the trashbin content for user "testtrashbin102"                     # TrashbinContext::userTriesToListTheTrashbinContentForUser()
    Then the HTTP status code should be "404"                                                           # FeatureContext::thenTheHTTPStatusCodeShouldBe()
    And the last webdav response should not contain the following elements                              # TrashbinContext::theLastWebdavResponseShouldNotContainFollowingElements()
      | path          | user            |
      | textfile0.txt | testtrashbin102 |
      | textfile2.txt | testtrashbin102 |
      | textfile3.txt | testtrashbin102 |

    Examples:
      | dav-path-version |
      | new              |
      | spaces           |
        Failed step: And user "testtrashbin102" has deleted file "/textfile3.txt"
        HTTP status code was not 204 while trying to delete resource '/textfile3.txt' for user 'testtrashbin102'
        Failed asserting that an array contains 503.

with a 503 error

    _______________________________________________________________________

        ==> REQUEST

        DELETE /remote.php/dav/spaces/48dc4de9-4966-4e45-ad55-7a27e2a7434f$17844abc-e5ad-4797-982b-8d3a0a3fbe61/textfile3.txt
        X-Request-ID: coreApiTrashbin/trashbinFilesFolders.feature:234-222

        <== RESPONSE

        503 Service Unavailable
        X-Xss-Protection: 1; mode=block
        <== RES BODY
        <?xml version="1.0" encoding="UTF-8"?>
        <d:error xmlns:d="DAV" xmlns:s="http://sabredav.org/ns"><s:exception>Sabre\DAV\Exception\ServiceUnavailable</s:exception><s:message>internal error: file is processing</s:message></d:error>

A file is uploaded and immediately deleted:

    And user "testtrashbin102" has uploaded file "filesForUpload/textfile.txt" to "/textfile3.txt"      # FeatureContext::userHasUploadedAFileTo()
    And user "testtrashbin102" has deleted file "/textfile3.txt"                                        # FeatureContext::userHasDeletedResource()

We should not die with a 503 here ... and this seems to be racy.

IMO it should be possible to delete a file even if postprocessing has not finished, yet.

phil-davis commented 5 months ago

Yes, it would be nice if the delete is "queued" to be done when the file post-processing is done. (Or a way to "abort" the post-processing and the file never "really exists"). And the DELETE request returns a success status.

Otherwise, the DELETE request could return a 425 to indicate that the post-processing is not yet complete - and it is the responsibility of the client to try again after "some time". That is what happens for a GET (download) request.

aliamerj commented 5 months ago

Hi, Can I work on this issue ?