-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Possible data corruption using the AwsS3 driver #37844
Comments
Hi @ImanuelBertrand. Thank you for your report.
Join Magento Community Engineering Slack and ask your questions in #github channel. |
@magento I am working on this |
Hi @ImanuelBertrand! 👋 |
@magento add to contributors team |
Hi @ImanuelBertrand! 👋 |
Adobe Commerce support developers have confirmed this issue (ticket #647575):
|
Hi @engcom-Hotel. Thank you for working on this issue.
|
Hello @ImanuelBertrand, Thanks for the report and collaboration! Can you please let us know if you are using a custom module or any third-party extension to write the files on S3, if possible please share this information with us. Thanks |
Hi @engcom-Hotel, I came across the issue while testing the S3 storage for a client, using a custom Google product feed module. Depending on whether new file was smaller than the previous one, this would result in a broken XML file. Regards |
@magento I am working on this |
An internal team is working on this issue right now (as Jira ticket |
Hello, As I can see this issue got fixed in the scope of the internal Jira ticket ACP2E-2147 by the internal team Based on the Jira ticket, the target version is 2.4.7-beta3. Thanks |
Preconditions and environment
Steps to reproduce
AAAAA
to it and close it.w
, and writeBB
to it.Expected result
The expected result is that the AwsS3 driver works as a replacement for the base default implementation (File driver).
As documented by
fopen
for modew
is that the file should truncated and thus would now containBB
.Actual result
The file contains
BBAAA
Additional information
The root cause is that
\Magento\AwsS3\Driver\AwsS3::fileOpen($path, $mode)
does not check the$mode
when opening the temporary stream.It will always fetch the current contents of the object in S3, write it to the stream and then rewind the stream.
This effectively opens all files with mode
r+
, which is unexpected.The impact of this is somehat migitated by the fact that the most common use of the adapter is saving image files, which are only written once and never directly overwritten.
Still, for any files that are updated (like product feeds), this can and will lead to data corruption.
Release note
No response
Triage and priority
The text was updated successfully, but these errors were encountered: