[OC 7.0.1] "An exception occurred" error when uploading a file in a share
Steps to reproduce
- User1 create "Folder1"
- User1 share "Folder1" with User2
- User2 upload a file in the share "Folder1"
Expected behaviour
The file is uploaded, and we see the file.
Actual behaviour
An error appear :
An exception occurred while executing 'UPDATE oc_filecache SET mtime = ?, storage_mtime=? WHERE fileid = ?': SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'mtime' at row 1

If we refresh we see the file :

Server configuration
Operating system : Windows Server 2012 R2 Web server : IIS 8.5 Database : MySQL 5.6.19.0 PHP version : 5.5.15 ownCloud version : 7.0.0 Updated from an older ownCloud or fresh install : fresh install List of activated apps : default The content of config/config.php:
<?php
$CONFIG = array (
'datadirectory' => 'E:\\data',
'logtimezone' => 'Europe/Paris',
'loglevel' => '0',
'session_lifetime' => 3600,
'mail_smtpmode' => 'smtp',
'mail_from_address' => 'noreply',
'mail_domain' => '****************',
'mail_smtphost' => '********************',
'mail_smtpport' => '25',
'instanceid' => '*****************',
'passwordsalt' => '***********************',
'trusted_domains' =>
array (
0 => '**********************',
),
'dbtype' => 'mysql',
'version' => '7.0.0.8',
'dbname' => '*******************',
'dbhost' => 'localhost',
'dbtableprefix' => 'oc_',
'dbuser' => 'oc_*************',
'dbpassword' => '*************',
'installed' => true,
);
Are you using external storage, if yes which one : no
Are you using encryption : no
Client configuration
Browser : Firefox 31/ Opera 23 / IE 11 Operating system : Windows 8.1
ownCloud log (data/owncloud.log)
{"reqId":"53d401bf36ccd","app":"OC\\Files\\Cache\\Scanner","message":"!!! No reuse of etag for 'key.txt' !!! \ncache: Array\n(\n [displayname_owner] => user1\n [path] => key.txt\n [uid_owner] => user1\n [permissions] => 31\n)\n \ndata: Array\n(\n [mimetype] => text\/plain\n [mtime] => 1406403007\n [size] => 29\n [etag] => 53d401bf356a8\n [storage_mtime] => 1406403007\n [permissions] => 31\n)\n","level":0,"time":"2014-07-26T21:30:07+02:00","method":"POST","url":"\/index.php\/apps\/files\/ajax\/upload.php"}
{"reqId":"53d401bf36ccd","app":"OC\\Files\\Cache\\Scanner","message":"!!! No reuse of etag for '' !!! \ncache: Array\n(\n [fileid] => 25\n [storage] => home::user1\n [path] => \n [parent] => 14\n [name] => folder1\n [mimetype] => httpd\/unix-directory\n [mimepart] => httpd\n [size] => 29\n [mtime] => 1406402993\n [storage_mtime] => 1406402993\n [encrypted] => \n [unencrypted_size] => 0\n [etag] => 53d401b16b510\n [permissions] => 31\n [displayname_owner] => user1\n [is_share_mount_point] => 1\n [uid_owner] => user1\n)\n \ndata: Array\n(\n [mimetype] => httpd\/unix-directory\n [mtime] => 1406403007\n [size] => -1\n [etag] => 53d401bf3bbe5\n [storage_mtime] => 1406403007\n [permissions] => 31\n)\n","level":0,"time":"2014-07-26T21:30:07+02:00","method":"POST","url":"\/index.php\/apps\/files\/ajax\/upload.php"}
{"reqId":"53d401bf36ccd","app":"PHP","message":"filemtime(): stat failed for E:\\data\/user1\/files\/folder1\/53d400c221f1f at C:\\test\\applications\\owncloud\\lib\\private\\files\\storage\\mappedlocal.php#155","level":3,"time":"2014-07-26T21:30:07+02:00","method":"POST","url":"\/index.php\/apps\/files\/ajax\/upload.php"}
Hi,
have you directly refreshed the page after the upload? I'm wondering because i have seen in your screenshot that the modify time is 13 minutes ago and the user in here reports the same behavior:
https://forum.owncloud.org/viewtopic.php?f=29&t=22485
yes i directly refresh after the upload. I made the screenshot later.
New test (new install without https), same problem :
Actual behaviour
User1 creates "folder1" User1 shares "folder1" with User2 User2 uploads the file "lol.txt" in the share "folder1" : error message
User2 refreshes the browser, the file appears :
then, User2 deletes the file, the loading is stuck :
User2 refreshes the browser, the file is gone :
ownCloud log (data/owncloud.log)
{"reqId":"53d41f6fbdc80","app":"OC\\Files\\Cache\\Scanner","message":"!!! No reuse of etag for 'lol.txt' !!! \ncache: Array\n(\n [displayname_owner] => User1\n [path] => lol.txt\n [uid_owner] => User1\n [permissions] => 31\n)\n \ndata: Array\n(\n [mimetype] => text\/plain\n [mtime] => 1406410607\n [size] => 0\n [etag] => 53d41f6fbcd4f\n [storage_mtime] => 1406410607\n [permissions] => 31\n)\n","level":0,"time":"2014-07-26T23:36:47+02:00","method":"POST","url":"\/index.php\/apps\/files\/ajax\/upload.php"}
{"reqId":"53d41f6fbdc80","app":"OC\\Files\\Cache\\Scanner","message":"!!! No reuse of etag for '' !!! \ncache: Array\n(\n [fileid] => 43\n [storage] => home::User1\n [path] => \n [parent] => 14\n [name] => folder1\n [mimetype] => httpd\/unix-directory\n [mimepart] => httpd\n [size] => 0\n [mtime] => 1406410470\n [storage_mtime] => 1406410470\n [encrypted] => \n [unencrypted_size] => 0\n [etag] => 53d41ee63a5a7\n [permissions] => 31\n [displayname_owner] => User1\n [is_share_mount_point] => 1\n [uid_owner] => User1\n)\n \ndata: Array\n(\n [mimetype] => httpd\/unix-directory\n [mtime] => 1406410607\n [size] => -1\n [etag] => 53d41f6fc1eff\n [storage_mtime] => 1406410607\n [permissions] => 31\n)\n","level":0,"time":"2014-07-26T23:36:47+02:00","method":"POST","url":"\/index.php\/apps\/files\/ajax\/upload.php"}
{"reqId":"53d41f6fbdc80","app":"PHP","message":"filemtime(): stat failed for E:\\data\/User1\/files\/folder1\/53d41bf7cd94a at C:\\test\\applications\\owncloud\\lib\\private\\files\\storage\\mappedlocal.php#155","level":3,"time":"2014-07-26T23:36:47+02:00","method":"POST","url":"\/index.php\/apps\/files\/ajax\/upload.php"}
{"reqId":"53d41f76ea306","app":"OC\\Files\\Cache\\Scanner","message":"!!! Path 'thumbnails\/61' is not readable !!!","level":0,"time":"2014-07-26T23:36:54+02:00","method":"GET","url":"\/index.php\/core\/preview.png?file=%2Ffolder1%2Flol.txt&c=53d41f6fbcd4f&x=36&y=36&forceIcon=0"}
{"reqId":"53d41f76ea306","app":"core","message":"Generating preview for \"\/folder1\/lol.txt\" with \"OC\\Preview\\TXT\"","level":0,"time":"2014-07-26T23:36:54+02:00","method":"GET","url":"\/index.php\/core\/preview.png?file=%2Ffolder1%2Flol.txt&c=53d41f6fbcd4f&x=36&y=36&forceIcon=0"}
{"reqId":"53d41f76ea306","app":"core","message":"Generating preview for \"\/folder1\/lol.txt\" with \"OC\\Preview\\Unknown\"","level":0,"time":"2014-07-26T23:36:54+02:00","method":"GET","url":"\/index.php\/core\/preview.png?file=%2Ffolder1%2Flol.txt&c=53d41f6fbcd4f&x=36&y=36&forceIcon=0"}
{"reqId":"53d41f76ea306","app":"core","message":"OC_Image->loadFromBase64, couldn't load","level":0,"time":"2014-07-26T23:36:54+02:00","method":"GET","url":"\/index.php\/core\/preview.png?file=%2Ffolder1%2Flol.txt&c=53d41f6fbcd4f&x=36&y=36&forceIcon=0"}
{"reqId":"53d41f76ea306","app":"core","message":"OC_Image->fixOrientation() Orientation: -1","level":0,"time":"2014-07-26T23:36:54+02:00","method":"GET","url":"\/index.php\/core\/preview.png?file=%2Ffolder1%2Flol.txt&c=53d41f6fbcd4f&x=36&y=36&forceIcon=0"}
{"reqId":"53d41f782ecc0","app":"OC\\Files\\Cache\\Scanner","message":"!!! Path 'files_versions\/folder1' is not readable !!!","level":0,"time":"2014-07-26T23:36:56+02:00","method":"POST","url":"\/index.php\/apps\/files\/ajax\/delete.php"}
{"reqId":"53d41f782ecc0","app":"OC\\Files\\Cache\\Scanner","message":"!!! No reuse of etag for '' !!! \ncache: Array\n(\n [fileid] => 43\n [storage] => home::User1\n [path] => \n [parent] => 14\n [name] => folder1\n [mimetype] => httpd\/unix-directory\n [mimepart] => httpd\n [size] => 0\n [mtime] => 1406410607\n [storage_mtime] => 1406410607\n [encrypted] => \n [unencrypted_size] => 0\n [etag] => 53d41f6fcb5c6\n [permissions] => 31\n [displayname_owner] => User1\n [is_share_mount_point] => 1\n [uid_owner] => User1\n)\n \ndata: Array\n(\n [mimetype] => httpd\/unix-directory\n [mtime] => 1406410616\n [size] => -1\n [etag] => 53d41f78411ca\n [storage_mtime] => 1406410616\n [permissions] => 31\n)\n","level":0,"time":"2014-07-26T23:36:56+02:00","method":"POST","url":"\/index.php\/apps\/files\/ajax\/delete.php"}
{"reqId":"53d41f782ecc0","app":"PHP","message":"filemtime(): stat failed for E:\\data\/User1\/files\/folder1\/53d41bf7cd94a at C:\\test\\applications\\owncloud\\lib\\private\\files\\storage\\mappedlocal.php#155","level":3,"time":"2014-07-26T23:36:56+02:00","method":"POST","url":"\/index.php\/apps\/files\/ajax\/delete.php"}
{"reqId":"53d41f782ecc0","app":"index","message":"Doctrine\\DBAL\\DBALException: An exception occurred while executing 'UPDATE `oc_filecache` SET `mtime` = ?, `storage_mtime`=? WHERE `fileid` = ?':\n\nSQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'mtime' at row 1","level":4,"time":"2014-07-26T23:36:56+02:00","method":"POST","url":"\/index.php\/apps\/files\/ajax\/delete.php"}
Same issue here with: Operating system : Windows Server 2008 R2 Web server : IIS 7.5 Database : MySQL 5.6.19.0 PHP version : 5.5.11 ownCloud version : 7.0.0
@schiesbn
until now I couldn't reproduce it. What permissions did you used to share the folder? Also this seems more then a file cache issue, the sharing app doesn't write this values to the cache. @icewind1991 do you have any idea what could be wrong?
Full permissions for User2
Same issue here: Operating system : Windows Server 2012 Web server : IIS 8 Database : MySQL 5.6.19 PHP version : 5.5.11 ownCloud version : 7.0.0
when user2 upload a file this is showing in the log:
{"app":"PHP","message":"filemtime(): stat failed for D:\\cloud\/FB7F72A6-30FE-489F-B195\/files\/test\/53d9e4108f99b at C:\\inetpub\\wwwroot\\cloud\\lib\\private\\files\\storage\\mappedlocal.php#155","level":3,"time":"2014-07-31T06:59:13+00:00"}
when user2 delete the file, 2 more rows are added to the log:
{"app":"PHP","message":"filemtime(): stat failed for D:\\cloud\/FB7F72A6-30FE-489F-B195\/files\/test\/53d9e4108f99b at C:\\inetpub\\wwwroot\\cloud\\lib\\private\\files\\storage\\mappedlocal.php#155","level":3,"time":"2014-07-31T07:09:18+00:00"}
{"app":"index","message":"Doctrine\\DBAL\\DBALException: An exception occurred while executing 'UPDATE oc_filecacheSETmtime= ?,storage_mtime=? WHERE fileid = ?':\n\nSQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'mtime' at row 1","level":4,"time":"2014-07-31T07:09:18+00:00"}
I get the same error when I upload/delete a file on a local map attached as an external storage
@nickvergessen you have ownCloud installed on windows - can you please dbug this? THX
update 7.0.1 same error
yes, same error and log with a 7.0.1 fresh install
Same error Operating system : Windows Server 2012 Web server : IIS 8 Database : MySQL 5.6.19 PHP version : 5.5.11 ownCloud version : 7.0.1
I do not get the SQL error message you guys receive,
but I also get the filemtime(): stat failed for ...\\data\/nickvergessen\/files\/neuer-ordner\/woot3\/53e88c2868799 at ...\\lib\\private\\files\\storage\\mappedlocal.php#155 spam in the log, additional to some No reuse of etag messages and can not update etags on \/files\\ for user TestUser1. Path does not exists
So I will investigate this.
Okay, my progress so far:
1. can not update etags on /files\ for user TestUser1. Path does not exists
Can be fixed in the cache/updater.php:
diff --git a/lib/private/files/cache/updater.php b/lib/private/files/cache/updater.php
index f15c203..5890abf 100644
--- a/lib/private/files/cache/updater.php
+++ b/lib/private/files/cache/updater.php
@@ -114,7 +122,7 @@ class Updater {
/**
* get file owner and path
* @param string $filename
- * @return string[] with the oweners uid and the owners path
+ * @return string[] with the owners uid and the owners path
*/
private static function getUidAndFilename($filename) {
@@ -124,12 +132,12 @@ class Updater {
if ($uid != \OCP\User::getUser()) {
$info = \OC\Files\Filesystem::getFileInfo($filename);
if (!$info) {
- return array($uid, '/files/' . $filename);
+ return array($uid, '/files' . $filename);
}
$ownerView = new \OC\Files\View('/' . $uid . '/files');
$filename = $ownerView->getPath($info['fileid']);
}
- return array($uid, '/files/' . $filename);
+ return array($uid, '/files' . $filename);
}
/**
2. The error "filemtime(): stat failed for"
Is caused by a filemtime() call to an invalid directory: TestFolder/. the Slash-Dot should most likely not be there. But they are, resulting in a different md5 hash and therefor the MappedLocal tries to generate a new entry.
Thereby you end up with a second TestFolder in your view and a 2nd entry in the database.
One with path TestFolder (correct) and one with path TestFolder/ (incorrect) ( I guess this leads to the sql error in some other place)
3. The "No reuse of etag"
The problem here is, that we get the item from cache. Thereby no etag is present. Then a new etag is generated and the array is compared to the previous one. So the etag changed (although it got created) and therefor an log entry is generated.
Would be nice if some of you could add https://github.com/owncloud/core/pull/10341/files
And then try the steps (share a folder, upload file) and then can have a look at the owncloud.log whether entries for the app MappedLocalStorage with text like Called filemtime with invalid path: "files/Issue9928/." Result [0] have been created.
If so, please post the complete messages.
- can not update etags on /files\ for user TestUser1. Path does not exists
Can be fixed in the cache/updater.php:
[snip]
Can you see if #10145 also solves the issue
@nickvergessen this change (#10341) resolves the issue : no more error in browser and no more error in owncloud.log.
Thanks a lot!
Yes, the errors are now gone for me as well.
Thank you very much for your effort.