mnutt / davros

Personal file storage server
Apache License 2.0
298 stars 35 forks source link

"Server do not support X-OC-MTime" from owncloudcmd #16

Closed paulproteus closed 8 years ago

paulproteus commented 8 years ago

While using owncloudcmd to sync files to a Davros grain, I get a message in my owncloudcmd log that says:

Server do not support X-OC-MTime ""

I suspect it would be wise for us to add support to this to Sandstorm. Presumably my client is going to submit duplicated requests to Davros based on not having access to remote mtimes, so I thought I should file this.

Slightly longer log snippet:

!!! OCC::PUTFileJob created for "https://api.rose.sandcats.io/" + "/pub/pub/scrapy-talk/_static/up.png"
void OCC::PropagateUploadFileQNAM::slotPutFinished() QUrl("https://sandstorm@api.rose.sandcats.io/remote.php/webdav/pub/pub/scrapy-talk/_static/up.png") FINISHED WITH STATUS QNetworkReply::NetworkError(NoError) "" QVariant(int, 201) QVariant(QString, "Created")
Server do not support X-OC-MTime ""
*==* duration UPLOAD 363 0 1166
OCC::SyncJournalFileRecord::SyncJournalFileRecord(const OCC::SyncFileItem&, const QString&) "./pub/pub/scrapy-talk/_static/up.png" Retrieved inode  331892 (previous item inode:  331892 )
"INSERT OR REPLACE INTO metadata (phash, pathlen, path, inode, uid, gid, mode, modtime, type, md5, fileid, remotePerm, filesize, ignoredChildrenRemote) VALUES (?1 , ?2, ?3 , ?4 , ?5 , ?6 , ?7,  ?8 , ?9 , ?10, ?11, ?12, ?13, ?14);" -1275537046966359755 34 "pub/pub/scrapy-talk/_static/up.png" 331892 0 "1374686074" "0" "e06a5c2d79aa917614dcd2977bbbd27c" "" "" 363 0
"DELETE FROM uploadinfo WHERE path=?1" "pub/pub/scrapy-talk/_static/up.png"
void OCC::SyncJournalDb::commitInternal(const QString&, bool) Transaction commit  "upload file start" and starting new transaction
void OCC::SyncEngine::slotItemCompleted(const OCC::SyncFileItem&, const OCC::PropagatorJob&) "pub/pub/scrapy-talk/_static/up.png" INSTRUCTION_NEW 4 ""
!!! OCC::PUTFileJob created for "https://api.rose.sandcats.io/" + "/pub/pub/scrapy-talk/_static/view-source.img"
paulproteus commented 8 years ago

Moving here from https://github.com/sandstorm-io/sandstorm/issues/1205

mnutt commented 8 years ago

Funny enough, the first search result for "x-oc-mtime" is now this github issue. In digging around in the owncloud source, it seems that x-oc-mtime is actually just a piece of metadata the server is expected to hold onto.

Unfortunately right now Davros' storage is just the filesystem, so I'm not sure there's an easy way to keep these around. At some point in the mid-term future I'd like to revamp the storage layer to add things like metadata and versioning, and at that point it would be a lot easier to support this.

paulproteus commented 8 years ago

FWIW, since Davros uses the filesystem, and the x-oc-mtime seems to mirror the filesystem's concept of "modified time" aka "mtime", it seems to me that Davros can use https://nodejs.org/api/fs.html#fs_fs_futimes_fd_atime_mtime_callback fs.futimes() to change the mtime.

Other reference:

mnutt commented 8 years ago

I have a partially working implementation of this, but it turns out that X-OC-MTime needs both a request and response header in order to work. (client sends X-OC-MTime: 123456789, server sends X-OC-MTime: accepted) So I think the best bet is to wait on https://github.com/sandstorm-io/sandstorm/pull/1202 to be merged.

ovizii commented 8 years ago

Just wanted to add I saw this error today too in this constellation:

Installed owncloud client on my MACbook, copied a folder with some 20 files or so into it, then installed the client on Windows 10 and about 6 files or so were giving this error and had not been synced to the Win10 machine. I then quit/restarted the client on the MAC and the files were synced to my sandstorm instance. Once I quit and restarted the Win10 client the changes were synced there too.No more X-OC-Time errors.

No idea what went on here but there you go.

ovizii commented 8 years ago

So if davros gives me this mtime error, that does mean those files have not been synced, right?

mnutt commented 8 years ago

Unfortunately it looks like we're still stuck on https://github.com/sandstorm-io/sandstorm/pull/1202, but I don't believe the x-oc-mtime warning should hurt anything. It may just involve an extra request as the client verifies its version matches the server's.

mnutt commented 8 years ago

I had believed that this was just a warning, but it appears that there may be some mysterious off-by-one error in the Owncloud client which causes crashes relating to this header. smashbox (the owncloud acceptance test suite) fails hard when no X-OC-MTime: accepted header is sent, but works when it is.

It's doubly unfortunate since mtime is a totally unreliable thing to sync across machines due to clock differences, etc.

mnutt commented 8 years ago

This is now fixed.