You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a feature required to have reliable upload of big files. Sometimes, the server might take a while to assemble chunks or to put them in their final destination, and the client times out which causes the file to be downloaded again.
( owncloud/client#2074 )
The solution to this problem is Asynchronous PUT via a poll URL.
This is already implemented on the client and will be part of the 1.8 release.
It is working successfully in a proprietary deployment (with a custom app on the server).
The client send with the PUT a "OC-Async:1" header, indicating it supports that feature.
The idea is that, for the last chunk, if the server has reason to believe that assembling the chunk may take more than a few seconds, it may return "202 Try LAter" instead of the usual "201 Created". Also in the response there is a header "OC-Finish-Poll" with a path to the poll url.
Example: OC-Finish-Poll: /remote.php/poll?pollId=123456
The client will then query this URL, which can write some spaces on the wire to avoid timeout, and when it is finaly finished, it can leave the JSON with "etag", and "fileid" property incase of success, or an "error" property in case of failure.
why would polling make anything easier/more performant?
The server side change is not trivial and introduces another piece of no-standard webdav api - just like my idea in #12001 - I really question if we should not skip webdav then and rely on our own protocol?
I believe this might not be possible with PHP, as PHP doesn't support multi-threads (except using hacks like spawning processes with popen())
One idea would be to make the PHP code return an XML response with maybe a transaction id or something, but then continue processing. This means the network connection will still remain open and the client must manually close the connection after receiving the response.
The PHP process might continue running in the background after the network connection is closed, but I'm not 100% sure of that. Some PHP handlers might decide to kill the connection.
Another issue: the PHP process itself might time out if assembling chunks thakes more than an hour for any reason.
It's all quite hacky. And as @DeepDiver1975 said it's no standard WebDAV.
I forgot to mention that the json can also contains { "unfinished": 1 } and the client will retry the same poll URL.
This is not about performence, it is about reliability.
note that the PUT request with 202 Try later might also contains the json reply. So you can leave the script running after sending the headers. You can also finish the processing in the poll url request.
From a server side implementation point of view something like this requires an architectural change where we have true server side processing within a daemon/worker.
In order to build a reliable and scaleable infrastructure job queueing systems come to my mind.
Something to be discussed very carefully because this has a lot of implications.
We also have to investigate if this can´t be fixed on the server side only without changing the protocol by doing some of the more expensive operations asynchronously on the server only.
@butonic Hmmm. Range Headers are not part of the official http spec for PUT and POST and we also were not aware of that fact that others are bending the standard like that at the time we implemented our big file chunking.
need to take care of the case where files get overwritten, might still need part files... The advantage of part files is that it reduces the time window of locking, else the file might be locked during an hour long upload.
Activity
DeepDiver1975 commentedon Nov 11, 2014
why would polling make anything easier/more performant?
The server side change is not trivial and introduces another piece of no-standard webdav api - just like my idea in #12001 - I really question if we should not skip webdav then and rely on our own protocol?
PVince81 commentedon Nov 11, 2014
I believe this might not be possible with PHP, as PHP doesn't support multi-threads (except using hacks like spawning processes with popen())
One idea would be to make the PHP code return an XML response with maybe a transaction id or something, but then continue processing. This means the network connection will still remain open and the client must manually close the connection after receiving the response.
The PHP process might continue running in the background after the network connection is closed, but I'm not 100% sure of that. Some PHP handlers might decide to kill the connection.
Another issue: the PHP process itself might time out if assembling chunks thakes more than an hour for any reason.
It's all quite hacky. And as @DeepDiver1975 said it's no standard WebDAV.
ogoffart commentedon Nov 11, 2014
I forgot to mention that the json can also contains
{ "unfinished": 1 }and the client will retry the same poll URL.This is not about performence, it is about reliability.
note that the PUT request with
202 Try latermight also contains the json reply. So you can leave the script running after sending the headers. You can also finish the processing in the poll url request.PVince81 commentedon Nov 11, 2014
Is reliability something that could otherwise be achieved with checksums ? ducks
DeepDiver1975 commentedon Nov 11, 2014
From a server side implementation point of view something like this requires an architectural change where we have true server side processing within a daemon/worker.
In order to build a reliable and scaleable infrastructure job queueing systems come to my mind.
e.g. something like
DeepDiver1975 commentedon Nov 11, 2014
refs #12052 (comment)
DeepDiver1975 commentedon Nov 11, 2014
if we really want to walk this path - this is a new api - no webdav mangling please
karlitschek commentedon Nov 11, 2014
Something to be discussed very carefully because this has a lot of implications.
We also have to investigate if this can´t be fixed on the server side only without changing the protocol by doing some of the more expensive operations asynchronously on the server only.
Frank
guruz commentedon Nov 18, 2014
Linking some other issues which might be fixed by implementing this task or a similar solution with the same goal:
owncloud/client#2260
owncloud/client#1425
owncloud/client#2284
cdamken commentedon Nov 24, 2014
Could be checksum another option to avoid upload or download the exiting files?
guruz commentedon Nov 24, 2014
Related: http://php.net/manual/de/function.fastcgi-finish-request.php
(Yes I undestand that this is not a general solution and can be prone to other issues like max_execution_time)
butonic commentedon Nov 26, 2014
Hm, others seem to have gone the way of supporting the Content Range Header in webdav PUT and POST requests:
https://code.google.com/p/gears/wiki/ContentRangePostProposal
http://www.webdavsystem.com/javaserver/doc/resumable_upload/how_it_works
http://curl.haxx.se/mail/lib-2001-01/0049.html
we had a request for this once #1051
which moved discussion to sabredav https://github.com/fruux/sabre-dav/pull/20
which in turn points to http://sabre.io/dav/http-patch/, the PATCH plugin for sabredav.
@ogoffart Are there any special reasons why you did not choose to go down that road?
karlitschek commentedon Nov 26, 2014
@butonic Hmmm. Range Headers are not part of the official http spec for PUT and POST and we also were not aware of that fact that others are bending the standard like that at the time we implemented our big file chunking.
butonic commentedon Nov 26, 2014
@karlitschek which is why sabredav uses PATCH for that.
30 remaining items
PVince81 commentedon May 9, 2016
@butonic
need to take care of the case where files get overwritten, might still need part files... The advantage of part files is that it reduces the time window of locking, else the file might be locked during an hour long upload.
PVince81 commentedon May 9, 2016
Raised #24509 for more generic async file operations (also DELETE, etc).
kubco2 commentedon Aug 13, 2019
What about this please?
micbar commentedon Sep 16, 2021
This topic will be adressed in ownCloud infinite scale.