Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

S3: Deleting non-existant file causes cron to give up on transfer #1748

Open
WebSpider opened this issue Dec 29, 2023 · 3 comments
Open

S3: Deleting non-existant file causes cron to give up on transfer #1748

WebSpider opened this issue Dec 29, 2023 · 3 comments
Assignees
Labels

Comments

@WebSpider
Copy link
Collaborator

WebSpider commented Dec 29, 2023

What software is in use

filesender 2.40

What happens

During cron, when using S3 as storage backend, some transfers are not expired, since the corresponding bucket cannot be found (it probably was already deleted, it actually does not exist on S3 storage)

[2023-12-29 02:21:43] [cron:info] Transfer#2454024 expired, closing it
[2023-12-29 02:21:43] [cron:info] Event#transfer_expired on Transfer#2454024
[2023-12-29 02:21:43] [cron:info] deleteFile() error exception 'Aws\S3\Exception\S3Exception' with message 'Error executing "ListObjects" on "https://swift-s3-endpoint/c57a9e66-036c-4691-8402-beebca338427?encoding-type=url"; AWS HTTP error: Client error: `GET https://swift-s3-endpoint/c57a9e66-036c-4691-8402-beebca338427?encoding-type=url` resulted in a `404 Not Found` response:
<?xml version='1.0' encoding='UTF-8'?>
<Error><Code>NoSuchBucket</Code><Message>The specified bucket does not exist.</Me (truncated...)
 NoSuchBucket (client): The specified bucket does not exist. - <?xml version='1.0' encoding='UTF-8'?>
<Error><Code>NoSuchBucket</Code><Message>The specified bucket does not exist.</Message><RequestId>txa6dd31f226164aa9a35ff-00658e1f27</RequestId><BucketName>c57a9e66-036c-4691-8402-beebca338427</BucketName></Error>'

GuzzleHttp\Exception\ClientException: Client error: `GET https://swift-s3-endpoint/c57a9e66-036c-4691-8402-beebca338427?encoding-type=url` resulted in a `404 Not Found` response:
<?xml version='1.0' encoding='UTF-8'?>
<Error><Code>NoSuchBucket</Code><Message>The specified bucket does not exist.</Me (truncated...)
 in /path/to/filesender/optional-dependencies/s3/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113
Stack trace:
#0 /path/to/filesender/optional-dependencies/s3/vendor/guzzlehttp/guzzle/src/Middleware.php(72): GuzzleHttp\Exception\RequestException::create(Object(GuzzleHttp\Psr7\Request), Object(GuzzleHttp\Psr7\Response), NULL, Array, NULL)
#1 /path/to/filesender/optional-dependencies/s3/vendor/guzzlehttp/promises/src/Promise.php(204): GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object(GuzzleHttp\Psr7\Response))
#2 /path/to/filesender/optional-dependencies/s3/vendor/guzzlehttp/promises/src/Promise.php(153): GuzzleHttp\Promise\Promise::callHandler(1, Object(GuzzleHttp\Psr7\Response), NULL)
#3 /path/to/filesender/optional-dependencies/s3/vendor/guzzlehttp/promises/src/TaskQueue.php(48): GuzzleHttp\Promise\Promise::GuzzleHttp\Promise\{closure}()
#4 /path/to/filesender/optional-dependencies/s3/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php(163): GuzzleHttp\Promise\TaskQueue->run()
#5 /path/to/filesender/optional-dependencies/s3/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php(189): GuzzleHttp\Handler\CurlMultiHandler->tick()
#6 /path/to/filesender/optional-dependencies/s3/vendor/guzzlehttp/promises/src/Promise.php(248): GuzzleHttp\Handler\CurlMultiHandler->execute(true)
#7 /path/to/filesender/optional-dependencies/s3/vendor/guzzlehttp/promises/src/Promise.php(224): GuzzleHttp\Promise\Promise->invokeWaitFn()
#8 /path/to/filesender/optional-dependencies/s3/vendor/guzzlehttp/promises/src/Promise.php(269): GuzzleHttp\Promise\Promise->waitIfPending()
#9 /path/to/filesender/optional-dependencies/s3/vendor/guzzlehttp/promises/src/Promise.php(226): GuzzleHttp\Promise\Promise->invokeWaitList()
#10 /path/to/filesender/optional-dependencies/s3/vendor/guzzlehttp/promises/src/Promise.php(269): GuzzleHttp\Promise\Promise->waitIfPending()
#11 /path/to/filesender/optional-dependencies/s3/vendor/guzzlehttp/promises/src/Promise.php(226): GuzzleHttp\Promise\Promise->invokeWaitList()
#12 /path/to/filesender/optional-dependencies/s3/vendor/guzzlehttp/promises/src/Promise.php(62): GuzzleHttp\Promise\Promise->waitIfPending()
#13 /path/to/filesender/optional-dependencies/s3/vendor/aws/aws-sdk-php/src/AwsClientTrait.php(58): GuzzleHttp\Promise\Promise->wait()
#14 /path/to/filesender/optional-dependencies/s3/vendor/aws/aws-sdk-php/src/ResultPaginator.php(127): Aws\AwsClient->execute(Object(Aws\Command))
#15 /path/to/filesender/optional-dependencies/s3/vendor/aws/aws-sdk-php/src/functions.php(52): Aws\ResultPaginator->valid()
#16 /path/to/filesender/optional-dependencies/s3/vendor/aws/aws-sdk-php/src/functions.php(69): Aws\map(Object(Aws\ResultPaginator), Object(Closure))
#17 /path/to/filesender/classes/storage/StorageCloudS3.class.php(231): Aws\flatmap(Object(Aws\ResultPaginator), Object(Closure))
#18 /path/to/filesender/classes/storage/Storage.class.php(238): StorageCloudS3::deleteFile(Object(File))
#19 /path/to/filesender/classes/data/Transfer.class.php(801): Storage::deleteFile(Object(File))
#20 /path/to/filesender/scripts/task/cron.php(107): Transfer->close(false, false)
#21 {main}

Next Aws\S3\Exception\S3Exception: Error executing "ListObjects" on "https://swift-s3-endpoint/c57a9e66-036c-4691-8402-beebca338427?encoding-type=url"; AWS HTTP error: Client error: `GET https://swift-s3-endpoint/c57a9e66-036c-4691-8402-beebca338427?encoding-type=url` resulted in a `404 Not Found` response:
<?xml version='1.0' encoding='UTF-8'?>
<Error><Code>NoSuchBucket</Code><Message>The specified bucket does not exist.</Me (truncated...)
 NoSuchBucket (client): The specified bucket does not exist. - <?xml version='1.0' encoding='UTF-8'?>
<Error><Code>NoSuchBucket</Code><Message>The specified bucket does not exist.</Message><RequestId>txa6dd31f226164aa9a35ff-00658e1f27</RequestId><BucketName>c57a9e66-036c-4691-8402-beebca338427</BucketName></Error> in /path/to/filesender/optional-dependencies/s3/vendor/aws/aws-sdk-php/src/WrappedHttpHandler.php:195
Stack trace:
#0 /path/to/filesender/optional-dependencies/s3/vendor/aws/aws-sdk-php/src/WrappedHttpHandler.php(97): Aws\WrappedHttpHandler->parseError(Array, Object(GuzzleHttp\Psr7\Request), Object(Aws\Command), Array)
#1 /path/to/filesender/optional-dependencies/s3/vendor/guzzlehttp/promises/src/Promise.php(204): Aws\WrappedHttpHandler->Aws\{closure}(Array)
#2 /path/to/filesender/optional-dependencies/s3/vendor/guzzlehttp/promises/src/Promise.php(169): GuzzleHttp\Promise\Promise::callHandler(2, Array, NULL)
#3 /path/to/filesender/optional-dependencies/s3/vendor/guzzlehttp/promises/src/RejectedPromise.php(42): GuzzleHttp\Promise\Promise::GuzzleHttp\Promise\{closure}(Array)
#4 /path/to/filesender/optional-dependencies/s3/vendor/guzzlehttp/promises/src/TaskQueue.php(48): GuzzleHttp\Promise\RejectedPromise::GuzzleHttp\Promise\{closure}()
#5 /path/to/filesender/optional-dependencies/s3/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php(163): GuzzleHttp\Promise\TaskQueue->run()
#6 /path/to/filesender/optional-dependencies/s3/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php(189): GuzzleHttp\Handler\CurlMultiHandler->tick()
#7 /path/to/filesender/optional-dependencies/s3/vendor/guzzlehttp/promises/src/Promise.php(248): GuzzleHttp\Handler\CurlMultiHandler->execute(true)
#8 /path/to/filesender/optional-dependencies/s3/vendor/guzzlehttp/promises/src/Promise.php(224): GuzzleHttp\Promise\Promise->invokeWaitFn()
#9 /path/to/filesender/optional-dependencies/s3/vendor/guzzlehttp/promises/src/Promise.php(269): GuzzleHttp\Promise\Promise->waitIfPending()
#10 /path/to/filesender/optional-dependencies/s3/vendor/guzzlehttp/promises/src/Promise.php(226): GuzzleHttp\Promise\Promise->invokeWaitList()
#11 /path/to/filesender/optional-dependencies/s3/vendor/guzzlehttp/promises/src/Promise.php(269): GuzzleHttp\Promise\Promise->waitIfPending()
#12 /path/to/filesender/optional-dependencies/s3/vendor/guzzlehttp/promises/src/Promise.php(226): GuzzleHttp\Promise\Promise->invokeWaitList()
#13 /path/to/filesender/optional-dependencies/s3/vendor/guzzlehttp/promises/src/Promise.php(62): GuzzleHttp\Promise\Promise->waitIfPending()
#14 /path/to/filesender/optional-dependencies/s3/vendor/aws/aws-sdk-php/src/AwsClientTrait.php(58): GuzzleHttp\Promise\Promise->wait()
#15 /path/to/filesender/optional-dependencies/s3/vendor/aws/aws-sdk-php/src/ResultPaginator.php(127): Aws\AwsClient->execute(Object(Aws\Command))
#16 /path/to/filesender/optional-dependencies/s3/vendor/aws/aws-sdk-php/src/functions.php(52): Aws\ResultPaginator->valid()
#17 /path/to/filesender/optional-dependencies/s3/vendor/aws/aws-sdk-php/src/functions.php(69): Aws\map(Object(Aws\ResultPaginator), Object(Closure))
#18 /path/to/filesender/classes/storage/StorageCloudS3.class.php(231): Aws\flatmap(Object(Aws\ResultPaginator), Object(Closure))
#19 /path/to/filesender/classes/storage/Storage.class.php(238): StorageCloudS3::deleteFile(Object(File))
#20 /path/to/filesender/classes/data/Transfer.class.php(801): Storage::deleteFile(Object(File))
#21 /path/to/filesender/scripts/task/cron.php(107): Transfer->close(false, false)
#22 {main}
[2023-12-29 02:21:43] [cron:error] [cron:error] [StorageFilesystemCannotDeleteException exception uid:658e1f2735bdc] storage_filesystem_cannot_delete
[2023-12-29 02:21:43] [cron:error] [cron:error] [StorageFilesystemCannotDeleteException trace uid:658e1f2735bdc] #0 /path/to/filesender/classes/storage/Storage.class.php(238): StorageCloudS3::deleteFile(Object(File))
[2023-12-29 02:21:43] [cron:error] [cron:error] [StorageFilesystemCannotDeleteException trace uid:658e1f2735bdc] #1 /path/to/filesender/classes/data/Transfer.class.php(801): Storage::deleteFile(Object(File))
[2023-12-29 02:21:43] [cron:error] [cron:error] [StorageFilesystemCannotDeleteException trace uid:658e1f2735bdc] #2 /path/to/filesender/scripts/task/cron.php(107): Transfer->close(false, false)
[2023-12-29 02:21:43] [cron:error] [cron:error] [StorageFilesystemCannotDeleteException trace uid:658e1f2735bdc] #3 {main}
[2023-12-29 02:21:43] [cron:error] [cron:error] [StorageFilesystemCannotDeleteException details uid:658e1f2735bdc] path = "/path/to/filesender/files/c57a9e66-036c-4691-8402-beebca338427"
[2023-12-29 02:21:43] [cron:error] [cron:error] [StorageFilesystemCannotDeleteException details uid:658e1f2735bdc] file = "File#19008402(Filename.xlsx, 13210 bytes)"
[2023-12-29 02:21:43] [cron:error] [cron:error] [StorageFilesystemCannotDeleteException details uid:658e1f2735bdc] transfer = "Transfer#2454024"

What did you expect

We expected the cronjob to just close the transfer, especially since handing the "NoSuchBucket" error already seems to be attempted in StorageCloudS3's deleteFile():

if (preg_match('/NoSuchBucket/', $e)) {

@WebSpider WebSpider changed the title S3: Deleting nonexistant file causes cron to give up on transfer S3: Deleting non-existant file causes cron to give up on transfer Dec 29, 2023
@WebSpider WebSpider added the bug label Dec 29, 2023
@monkeyiq
Copy link
Contributor

monkeyiq commented Jan 1, 2024

Would you like to make a PR?

@WebSpider
Copy link
Collaborator Author

Would you like to make a PR?

I don't see why it's not picking up the NoSuchBucket correctly. I'll be able to look into this next week myself.

@monkeyiq
Copy link
Contributor

monkeyiq commented Jan 2, 2024

Cool :) I should probably dig out the old real s3 credentials and verify them again if folks are using that backend in anger

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants