-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[Bug]: files are written twice during upload #43636
Comments
Thanks for your answer! So you mean that the The |
I just found out that the issue also occurs with uploads via the Nextcloud client, which uses chunked uploads iirc. In this case, a This means that an upload is always written to the hard disk twice, especially if the data dir and the Therefore I updated the issue titel. |
This is my current state of knowledge.
The information, which tmp file is used for the upload, is available when using https://www.php.net/manual/en/features.file-upload.post-method.php. We are using another way to process uploads afaik https://www.php.net/manual/en/features.file-upload.put-method.php. |
This issue significantly impacts my system performance. I set upload_tmp_dir to a large tmpfs disk in hopes of speeding up performance. However, what confuses me is that Nextcloud writes upload chunks from upload_tmp_dir to data_dir, then merges them in the data_dir directory before writing them to the target directory. I don't understand why Nextcloud does this, as it renders my upload_tmp_dir setting ineffective. |
Are we sure they are not referring to the same inode and are in fact really two different files? Maybe we can ask @juliushaertl or @icewind1991 if they know more about the handling of upload and if Nextcloud really have any potential impact on how |
checked with
It seems like the inodes differ. This also correlates with the output of |
As far as I digged into this in the past this is expected internal php behaviour. Any access of the php://input stream will create a tmp file if greater than 8k, otherwise the stream data will be hold in memory. There is no way to avoid this as far as I know. PHP is also not exposing the file itself, so we can't work with that. |
Closing then, unless someone is able to prove we can control this behaviour, this is a wontfix :( |
Bug description
I have encountered the issue that files uploaded via WebDAV are written twice by Nextcloud.
The first version is stored in php's
upload_tmp_dir
and is namedphpXXXXXX
.The second version is stored in the files target directory and is named
$filename.ocTransferId$ID.part
.According to
iotop
the file is actually written twice, because the write speed to the storage is approximately twice the upload speed.Steps to reproduce
upload_tmp_dir
and file target directory for duplicate fileExpected behavior
File is either written to the target directory and gets renamed to the target filename after successful upload or file is written to php's
upload_tmp_dir
and moved to target folder after successful upload.Installation method
Community Manual installation with Archive
Nextcloud Server version
28
Operating system
Debian/Ubuntu
PHP engine version
PHP 8.2
Web server
Apache (supported)
Database engine version
MariaDB
Is this bug present after an update or on a fresh install?
Updated from a MINOR version (ex. 22.1 to 22.2)
Are you using the Nextcloud Server Encryption module?
Encryption is Disabled
What user-backends are you using?
Configuration report
List of activated Apps
Nextcloud Signing status
Nextcloud Logs
Additional info
The Nextcloud data directory is located on another partition and not directly in the web directory.
The text was updated successfully, but these errors were encountered: