nextcloud / server

☁️ Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
27.42k stars 4.07k forks source link

[Bug]: InvalidArgumentException: X-OC-MTime header must be a valid positive integer #31464

Closed biggt closed 2 years ago

biggt commented 2 years ago

⚠️ This issue respects the following points: ⚠️

Bug description

Today I had opened my Nextcloud Windows Desktop app and found that there were a ton of errors coming up relating to the modified time stamp of files. It doesn't seem to matter what type of file, as I'm seeing this for jpg, psd, ai, pdf, js, you name it...

Desktop app version 3.3.6... however, this is the same behavior up to 3.4.3. (I reverted back to 3.3.6 after finding that there may be some issues with the desktop app, but think they may be misguided about the source of the issue.) Desktop app errors: "Server replied '500 Internal Server Error' to 'PUT https://cloud.[domain].com/remote.php/dav/files/[user]....file.ext' (X-OC-MTime header must be a valid positive integer)."

When I look at the Nextcloud server logging, I see the following types of errors just scrolling past like a waterfall:

[webdav] Fatal: X-OC-MTime header must be a valid positive integer. PUT /remote.php/dav/files/[user]/aWeb/Project%2024%20Timeline.docx from 10.0.10.1 by [user] at 2022-03-05T03:37:54+00:00

I just updated the official Docker image to be running Nextcloud Hub II (23.0.2) after seeing these issues and they still persist. It seems that because of these errors, the uploads are taking a VERY long time, if they complete at all.

Please note, the server logs posted below are not complete. I had not thought about setting up any sort of log rotate. As such, they span back nearly six months with errors of various things that I've resolved over time. I have attached a smaller section of the logs that most accurately reflect the issues I am seeing right now instead of posting them in the body of the issue. GitHub is restricting body length to 65536 characters. Nextcloud Server Errors.txt

Steps to reproduce

  1. Attempt to add files to Nextcloud through the desktop app. (unsure whether this is also occurring with the files being uploaded from mobile clients.

Expected behavior

I should be seeing regular progress in my desktop app and in my server logging, instead of having hundreds of thousands of errors.

Installation method

No response

Operating system

No response

PHP engine version

No response

Web server

No response

Database engine version

No response

Is this bug present after an update or on a fresh install?

No response

Are you using the Nextcloud Server Encryption module?

No response

What user-backends are you using?

Configuration report

docker exec -it  -u www-data nextcloud_app php occ config:list system
{
    "system": {
        "htaccess.RewriteBase": "\/",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "apps_paths": [
            {
                "path": "\/var\/www\/html\/apps",
                "url": "\/apps",
                "writable": false
            },
            {
                "path": "\/var\/www\/html\/custom_apps",
                "url": "\/custom_apps",
                "writable": true
            }
        ],
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "password": "***REMOVED SENSITIVE VALUE***",
            "port": 6379
        },
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "cloud.theharthaven.com",
            "10.0.100.15:8045"
        ],
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "23.0.2.1",
        "overwrite.cli.url": "http:\/\/cloud.theharthaven.com",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpmode": "smtp",
        "mail_sendmailmode": "smtp",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpsecure": "ssl",
        "mail_smtpauthtype": "LOGIN",
        "mail_smtpauth": 1,
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "465",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "maintenance": false,
        "theme": "",
        "loglevel": 2,
        "default_phone_region": "US"
    }
}

List of activated Apps

docker exec -it  -u www-data nextcloud_app php occ app:list
Enabled:
  - admin_audit: 1.13.0
  - bruteforcesettings: 2.3.0
  - calendar: 3.0.6
  - cloud_federation_api: 1.6.0
  - dashboard: 7.3.0
  - dav: 1.21.0
  - extract: 1.3.3
  - federatedfilesharing: 1.13.0
  - files: 1.18.0
  - files_pdfviewer: 2.4.0
  - files_rightclick: 1.2.0
  - files_sharing: 1.15.0
  - files_texteditor: 2.14.0
  - files_trashbin: 1.13.0
  - files_versions: 1.16.0
  - files_videoplayer: 1.12.0
  - geoblocker: 0.5.4
  - logreader: 2.8.0
  - lookup_server_connector: 1.11.0
  - notes: 4.3.0
  - notifications: 2.11.1
  - oauth2: 1.11.0
  - password_policy: 1.13.0
  - photos: 1.5.0
  - provisioning_api: 1.13.0
  - quota_warning: 1.13.0
  - ransomware_protection: 1.12.0
  - serverinfo: 1.13.0
  - settings: 1.5.0
  - suspicious_login: 4.1.0
  - twofactor_admin: 3.2.0
  - twofactor_backupcodes: 1.12.0
  - twofactor_email: 2.1.1
  - twofactor_nextcloud_notification: 3.3.1
  - twofactor_totp: 6.2.0
  - viewer: 1.7.0
  - webapppassword: 21.12.0
  - workflowengine: 2.5.0
Disabled:
  - accessibility: 1.8.0
  - activity: 2.15.0
  - circles: 22.1.1
  - comments: 1.12.0
  - contactsinteraction: 1.3.0
  - encryption
  - federation: 1.12.0
  - files_antivirus: 3.2.2
  - files_external
  - files_fulltextsearch: 23.0.0
  - files_trackdownloads: 1.11.0
  - firstrunwizard: 2.11.0
  - fulltextsearch: 23.0.0
  - nextcloud_announcements: 1.11.0
  - privacy: 1.6.0
  - recommendations: 1.1.0
  - sharebymail: 1.13.0
  - support: 1.5.0
  - survey_client: 1.10.0
  - systemtags: 1.12.0
  - text: 3.3.0
  - theming: 1.13.0
  - updatenotification: 1.12.0
  - user_ldap
  - user_status: 1.2.0
  - weather_status: 1.2.0

Nextcloud Signing status

No errors have been found.

Nextcloud Logs

No response

Additional info

No response

biggt commented 2 years ago

Looks like after trying to correct the logging issues I lost some of the drop down responses... here they are:

Installation Method: Official Docker image Operating system: Debian/Ubuntu PHP engine version: PHP 8.0 Web server: Apache (supported) Database engine version: MariaDB Is this bug present after an update or on a fresh install? Updated to a major version (ex. 22.2.3 to 23.0.1) Are you using the Nextcloud Server Encryption module? Encryption is Disabled. What user-backends are you using? Default user-backend (database)

solracsf commented 2 years ago

@artonge could this be related to https://github.com/nextcloud/server/pull/30485 / https://github.com/nextcloud/server/commit/69b8044b8f957c5a74396025608dd513c8f7ff7d?

biggt commented 2 years ago

@artonge could this be related to #30485 / 69b8044?

Looks like this is directly related.

oculos commented 2 years ago

I am having the same problem:

{"Exception":"InvalidArgumentException","Message":"X-OC-MTime header must be a valid positive integer","Code":0,"Trace":[{"file":"/var/www/nextcloud/apps/dav/lib/Connector/Sabre/Node.php","line":407,"function":"sanitizeMtime","class":"OCA\\DAV\\Connector\\Sabre\\MtimeSanitizer","type":"::"},{"file":"/var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php","line":319,"function":"sanitizeMtime","class":"OCA\\DAV\\Connector\\Sabre\\Node","type":"->"},{"file":"/var/www/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php","line":155,"function":"put","class":"OCA\\DAV\\Connector\\Sabre\\File","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":1098,"function":"createFile","class":"OCA\\DAV\\Connector\\Sabre\\Directory","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":504,"function":"createFile","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php","line":89,"function":"httpPut","class":"Sabre\\DAV\\CorePlugin","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":472,"function":"emit","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":253,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":321,"function":"start","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/apps/dav/lib/Server.php","line":339,"function":"exec","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/apps/dav/appinfo/v2/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/remote.php","line":166,"args":["/var/www/nextcloud/apps/dav/appinfo/v2/remote.php"],"function":"require_once"}],"File":"/var/www/nextcloud/apps/dav/lib/Connector/Sabre/MtimeSanitizer.php","Line":37,"CustomMessage":"--"}}

Nextcloud 23.0.3

platima commented 2 years ago

Yep getting this same error, and it's stopped me being able to use the desktop client at all

driehle commented 2 years ago

Occuring with virtual folders on Windows 10, server 23.0.3 and client 3.4.4:

Unbenannt

In #30473, over ten people have reported problems after the issue was closed.

ShapeShifter499 commented 2 years ago

Is nextcloud supposed to handle this? I'm noticing that all of my files appear new whether or not I upload on the website or use webdav.

Something like haproxy wouldn't be stripping timestamping would it?

oculos commented 2 years ago

This is really a problem. My iOS client seems to be crashing a lot because of this.

On 8 Apr 2022, at 15:40, Lance @.***> wrote:

 Is nextcloud supposed to handle this? I'm noticing that all of my files appear new whether or not I upload on the website or use webdav.

Something like haproxy wouldn't be stripping timestamping would it?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.

szaimen commented 2 years ago

Hi, please see this: https://github.com/nextcloud/desktop/wiki/How-to-fix-the-error-invalid-or-negative-modification-date

oculos commented 2 years ago

This happens mostly on the mobile client in my case.

On 9 Apr 2022, at 13:17, Simon L. @.***> wrote:

 Hi, please see this: https://github.com/nextcloud/desktop/wiki/How-to-fix-the-error-invalid-or-negative-modification-date

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.

ShapeShifter499 commented 2 years ago

Is nextcloud supposed to handle this? I'm noticing that all of my files appear new whether or not I upload on the website or use webdav.

Something like haproxy wouldn't be stripping timestamping would it?

Ok so I have determined my issue only lies with the WebDav client I use, it seems that Nautilus doesn't send X-OC-Mtime in it's implimentation of WebDav at the time of writing. Uploading in WebUI through Firefox and using the Nextcloud desktop/phone apps work fine for me.

oculos commented 2 years ago

Hi, please see this: https://github.com/nextcloud/desktop/wiki/How-to-fix-the-error-invalid-or-negative-modification-date

Sorry @szaimen, but why is this closed? The script does not seem to address the problem when the iOS client uploads photos to NC.

julian70400 commented 2 years ago

Same problem here since 22.2.9 !

Haui1112 commented 2 years ago

This is still an issue in 22/10 for some reason. iOS client.

AndyXheli commented 1 year ago

Still an issue on NC 25.0.1 Can we please reopen this issue ?

Signal app dose backups into nextcloud Android app dir and everytime it creates the backups this error is triggered.

{"reqId":"u0zADMX60n9vV7B3ZLLu","level":3,"time":"2022-12-07T10:26:17-06:00","remoteAddr":"7.9.5.1","user":"axheli","app":"webdav","method":"PUT","url":"/remote.php/dav/files/axheli/Documents/Backups/.backup492a7f0e-b1b4-4b21-9829-4175b963923b.tmp","message":"X-OC-MTime header must be a valid positive integer","userAgent":"Mozilla/5.0 (Android) Nextcloud-android/3.23.0","version":"25.0.1.1","exception":{"Exception":"InvalidArgumentException","Message":"X-OC-MTime header must be a valid positive integer","Code":0,"Trace":[{"file":"/var/www/nextcloud/apps/dav/lib/Connector/Sabre/Node.php","line":424,"function":"sanitizeMtime","class":"OCA\\DAV\\Connector\\Sabre\\MtimeSanitizer","type":"::"},{"file":"/var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php","line":378,"function":"sanitizeMtime","class":"OCA\\DAV\\Connector\\Sabre\\Node","type":"->"},{"file":"/var/www/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php","line":151,"function":"put","class":"OCA\\DAV\\Connector\\Sabre\\File","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":1098,"function":"createFile","class":"OCA\\DAV\\Connector\\Sabre\\Directory","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":504,"function":"createFile","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php","line":89,"function":"httpPut","class":"Sabre\\DAV\\CorePlugin","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":472,"function":"emit","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":253,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":321,"function":"start","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/apps/dav/lib/Server.php","line":360,"function":"exec","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/apps/dav/appinfo/v2/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/remote.php","line":171,"args":["/var/www/nextcloud/apps/dav/appinfo/v2/remote.php"],"function":"require_once"}],"File":"/var/www/nextcloud/apps/dav/lib/Connector/Sabre/MtimeSanitizer.php","Line":37,"message":"X-OC-MTime header must be a valid positive integer","exception":[],"CustomMessage":"X-OC-MTime header must be a valid positive integer"},"id":"6390beaf5f115"}
Peter83 commented 1 year ago

I'm having the same issue with iOS app and a fresh install of latest server version.

RockyC36 commented 1 year ago

I'm having this issue on a fresh install of Nextcloud Docker on Ubuntu Server 22.04 and iOS/iPadOS 16.2. Additionally, none of the time/date stamps on my uploaded photos are correct. I created a new user account to test and the problem persists.

smr99 commented 1 year ago

I'm having the same issue with iOS app and a fresh install of latest server version.

Ditto. Just installed nextcloud AIO docker last night and the iOS app. All files transferred but one that is giving me this error.

GefeiSHEN commented 1 year ago

Problem persists on next cloud iOS app Mar 2023.

szaimen commented 1 year ago

Please report this to https://github.com/nextcloud/ios/issues

platima commented 1 year ago

It's not just iOS - I've had it on Desktop for months, so barely using Nextcloud any more as more and more files just won't sync.

Was 6 to start with. Over 70 now, and these are old files that just stop syncing one day.

------ Original Message ------ From "Simon L." @.> To "nextcloud/server" @.> Cc "platima" @.>; "Comment" @.> Date 19/03/2023 8:27:58 AM Subject Re: [nextcloud/server] [Bug]: InvalidArgumentException: X-OC-MTime header must be a valid positive integer (Issue #31464)

Please report this to https://github.com/nextcloud/ios/issues

— Reply to this email directly, view it on GitHub https://github.com/nextcloud/server/issues/31464#issuecomment-1475046585, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADIYAQENDXAI2QKJHYDQIOTW4ZHI5ANCNFSM5P7EQ6NQ. You are receiving this because you commented.Message ID: @.***>

whitephoenix117 commented 1 year ago

Please report this to https://github.com/nextcloud/ios/issues

Also having this issue. Created https://github.com/nextcloud/ios/issues/2390

hardingt commented 1 year ago

@whitephoenix117 I noticed your 2390 was closed, not sure if the problem was actually fixed, because I've still got it with the iOS app.

@szaimen it seems an awful lot of folks still have this issue and it isn't isolated to one client. My photos used to sync with no problem and stopped about a year ago, similar timing to this ticket.

https://github.com/nextcloud/desktop/wiki/How-to-fix-the-error-invalid-or-negative-modification-date isn't super helpful in my case, although I'm certain it has helped others, because this appears to address issues in the NC database, rather than files themselves.

Is it possible that these clients aren't seeing a X-OC-MTime information so the corresponding header value is 0, null, or just not there? In that case, it looks like a great candidate to just ignore this or set it to some value indexed from another header.

whitephoenix117 commented 1 year ago

@whitephoenix117 I noticed your 2390 was closed, not sure if the problem was actually fixed, because I've still got it with the iOS app.

I no longer have the iOS device so i don't know if it's actually fixed

poeml commented 1 year ago

Still there, bulk upload from iOS Leads to tons of errors, i.e. unsynced photos. I see it only for photos, though.

keomabrun commented 8 months ago

hello, I am having the same issue when transferring files from Google Drive to Nextcloud (v27.1.7) using rclone (v1.66). My Nextcloud is hosted on a Debian Bookworm behind Nginx. I can provide more logs or perform some tests if needed.

bigretromike commented 4 months ago

29.0.3 with windows client 3.13.1

{"reqId":"vX5BLR8uJlWJybtny52Q","level":3,"time":"2024-07-06T16:00:01+00:00","remoteAddr":"10.29.9.10","user":"smieci","app":"webdav","method":"PUT","url":"/remote.php/dav/files/smieci/dell/AppData/Roaming/Microsoft/InputMethod/Chs/ChsPinyinEUDP_RoamUp.lex","message":"X-OC-MTime header must be a valid positive integer","userAgent":"Mozilla/5.0 (Windows) mirall/3.13.1stable-Win64 (build 20240701) (Nextcloud, windows-10.0.19045 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"29.0.3.4","exception":{"Exception":"InvalidArgumentException","Message":"X-OC-MTime header must be a valid positive integer","Code":0,"Trace":[{"file":"/var/www/nextcloud/apps/dav/lib/Connector/Sabre/Node.php","line":425,"function":"sanitizeMtime","class":"OCA\\DAV\\Connector\\Sabre\\MtimeSanitizer","type":"::"},{"file":"/var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php","line":383,"function":"sanitizeMtime","class":"OCA\\DAV\\Connector\\Sabre\\Node","type":"->"},{"file":"/var/www/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php","line":148,"function":"put","class":"OCA\\DAV\\Connector\\Sabre\\File","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":1098,"function":"createFile","class":"OCA\\DAV\\Connector\\Sabre\\Directory","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":504,"function":"createFile","class":"Sabre\\DAV\\Server","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php","line":89,"function":"httpPut","class":"Sabre\\DAV\\CorePlugin","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":472,"function":"emit","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":253,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":321,"function":"start","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/apps/dav/lib/Server.php","line":379,"function":"exec","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/apps/dav/appinfo/v2/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/remote.php","line":172,"args":["/var/www/nextcloud/apps/dav/appinfo/v2/remote.php"],"function":"require_once"}],"File":"/var/www/nextcloud/apps/dav/lib/Connector/Sabre/MtimeSanitizer.php","Line":37,"message":"X-OC-MTime header must be a valid positive integer","exception":[],"CustomMessage":"X-OC-MTime header must be a valid positive integer"},"id":"668a985c3618c"}