Skip to content
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]: InvalidArgumentException: X-OC-MTime header must be a valid positive integer #31464

Closed
4 of 8 tasks
biggt opened this issue Mar 5, 2022 · 27 comments
Closed
4 of 8 tasks
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap bug

Comments

@biggt
Copy link

biggt commented Mar 5, 2022

⚠️ This issue respects the following points: ⚠️

  • This is a bug, not a question or a configuration/webserver/proxy issue.
  • This issue is not already reported on Github (I've searched it).
  • Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
  • I agree to follow Nextcloud's Code of Conduct.

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?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

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 biggt added 0. Needs triage Pending check for reproducibility or if it fits our roadmap bug labels Mar 5, 2022
@biggt
Copy link
Author

biggt commented Mar 5, 2022

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
Copy link
Member

solracsf commented Mar 11, 2022

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

@solracsf solracsf mentioned this issue Mar 11, 2022
2 tasks
@biggt
Copy link
Author

biggt commented Mar 14, 2022

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

Looks like this is directly related.

@oculos
Copy link

oculos commented Mar 26, 2022

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
Copy link

platima commented Apr 3, 2022

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

@driehle
Copy link

driehle commented Apr 4, 2022

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
Copy link

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
Copy link

oculos commented Apr 8, 2022 via email

@szaimen
Copy link
Contributor

szaimen commented Apr 9, 2022

@szaimen szaimen closed this as completed Apr 9, 2022
@oculos
Copy link

oculos commented Apr 9, 2022 via email

@ShapeShifter499
Copy link

ShapeShifter499 commented Apr 12, 2022

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
Copy link

oculos commented Apr 24, 2022

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
Copy link

Same problem here since 22.2.9 !

@Haui1112
Copy link

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

@AndyXheli
Copy link

AndyXheli commented Dec 7, 2022

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
Copy link

Peter83 commented Jan 27, 2023

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

@RockyC36
Copy link

RockyC36 commented Feb 6, 2023

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
Copy link

smr99 commented Feb 20, 2023

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
Copy link

Problem persists on next cloud iOS app Mar 2023.

@szaimen
Copy link
Contributor

szaimen commented Mar 19, 2023

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

@platima
Copy link

platima commented Mar 19, 2023 via email

@whitephoenix117
Copy link

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

Also having this issue. Created nextcloud/ios#2390

@hardingt
Copy link

@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
Copy link

@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
Copy link

poeml commented Sep 13, 2023

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

@keomabrun
Copy link

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
Copy link

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"}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap bug
Projects
None yet
Development

No branches or pull requests