nextcloud / server

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

WebDav connection having massive issues with Guzzle after previously have no issues. #12296

Closed jcklpe closed 4 years ago

jcklpe commented 5 years ago

Steps to reproduce

I set up a folder sync connection for my phone and my nextcloud server using the app FolderSync. It worked fine. Now it is unable to connect, but I am able to reach my nextcloud connection through my browser and desktop client no problems. I am unable to access it through the webdav connection I have on my phone through Solid Explorer or the FolderSync connection. Also I should note that earlier today I did misconfigure my first foldersync and that lead to my IP getting banned by fail2ban but I fixed that and just checked my fail2ban status and it is totally clear.

Expected behaviour

I would expect it to connect no issue.

Actual behaviour

It does not connection

Server configuration detail

Operating system: Linux 4.15.0-38-generic #41-Ubuntu SMP Wed Oct 10 10:59:38 UTC 2018 x86_64

Webserver: nginx/1.14.0 (fpm-fcgi)

Database: mysql 10.1.34

PHP version:

7.2.11-4+ubuntu18.04.1+deb.sury.org+1 Modules loaded: Core, date, libxml, openssl, pcre, zlib, filter, hash, Reflection, SPL, sodium, session, standard, cgi-fcgi, mysqlnd, PDO, xml, apcu, bz2, calendar, ctype, curl, dom, mbstring, fileinfo, ftp, gd, gettext, iconv, igbinary, imagick, intl, json, exif, mysqli, pdo_mysql, apc, posix, readline, redis, shmop, SimpleXML, smbclient, sockets, sysvmsg, sysvsem, sysvshm, tokenizer, wddx, xmlreader, xmlwriter, xsl, zip, Phar, libsmbclient, Zend OPcache

Nextcloud version: 14.0.3 - 14.0.3.0

Updated from an older Nextcloud/ownCloud or fresh install:

Where did you install Nextcloud from: official website using Reiner Nippes ansible script

Signing status Array ( )
List of activated apps ``` Enabled: - accessibility: 1.0.1 - activity: 2.7.0 - admin_audit: 1.4.0 - admin_notifications: 1.0.2 - audioplayer: 2.4.1 - bruteforcesettings: 1.1.0 - cloud_federation_api: 0.0.1 - cms_pico: 0.9.7 - comments: 1.4.0 - dav: 1.6.0 - dropit: 0.1.1 - federatedfilesharing: 1.4.0 - federation: 1.4.0 - files: 1.9.0 - files_accesscontrol: 1.4.0 - files_automatedtagging: 1.4.0 - files_external: 1.5.0 - files_external_gdrive: 0.2.8 - files_pdfviewer: 1.3.2 - files_rightclick: 0.8.4 - files_sharing: 1.6.2 - files_texteditor: 2.6.0 - files_trashbin: 1.4.1 - files_versions: 1.7.1 - files_videoplayer: 1.3.0 - gallery: 18.1.0 - groupfolders: 1.3.3 - impersonate: 1.1.0 - issuetemplate: 0.4.0 - logreader: 2.0.0 - lookup_server_connector: 1.2.0 - music: 0.9.2 - nextcloud_announcements: 1.3.0 - notifications: 2.2.1 - oauth2: 1.2.1 - onlyoffice: 2.0.4 - password_policy: 1.4.0 - provisioning_api: 1.4.0 - quota_warning: 1.3.0 - ransomware_protection: 1.2.0 - serverinfo: 1.4.0 - sharebymail: 1.4.0 - sharerenamer: 2.2.0 - spreed: 4.0.0 - support: 1.0.0 - survey_client: 1.2.0 - systemtags: 1.4.0 - theming: 1.5.0 - theming_customcss: 1.1.0 - twofactor_backupcodes: 1.3.1 - updatenotification: 1.4.1 - workflowengine: 1.4.0 Disabled: - encryption - end_to_end_encryption - firstrunwizard - richdocuments - user_external - user_ldap ```
Configuration (config/config.php) ``` { "passwordsalt": "***REMOVED SENSITIVE VALUE***", "secret": "***REMOVED SENSITIVE VALUE***", "trusted_domains": [ "localhost", "cloud.jackalope.tech", "wiki.jackalope.tech" ], "datadirectory": "***REMOVED SENSITIVE VALUE***", "overwrite.cli.url": "https:\/\/cloud.jackalope.tech", "dbtype": "mysql", "version": "14.0.3.0", "dbname": "***REMOVED SENSITIVE VALUE***", "dbhost": "***REMOVED SENSITIVE VALUE***", "dbport": "", "dbtableprefix": "oc_", "mysql.utf8mb4": true, "dbuser": "***REMOVED SENSITIVE VALUE***", "dbpassword": "***REMOVED SENSITIVE VALUE***", "installed": true, "instanceid": "***REMOVED SENSITIVE VALUE***", "mail_from_address": "***REMOVED SENSITIVE VALUE***", "mail_smtpmode": "smtp", "mail_smtpauthtype": "LOGIN", "mail_domain": "***REMOVED SENSITIVE VALUE***", "mail_smtpname": "***REMOVED SENSITIVE VALUE***", "mail_smtpsecure": "tls", "mail_smtpauth": "1", "mail_smtphost": "***REMOVED SENSITIVE VALUE***", "mail_smtpport": "587", "mail_smtppassword": "***REMOVED SENSITIVE VALUE***", "memcache.local": "\\OC\\Memcache\\APCu", "redis": { "host": "***REMOVED SENSITIVE VALUE***", "port": "0", "timeout": "0.0" }, "memcache.locking": "\\OC\\Memcache\\Redis", "filelocking.enabled": "true", "enable_previews": "true", "enabledPreviewProviders": [ "OC\\Preview\\PNG", "OC\\Preview\\JPEG", "OC\\Preview\\GIF", "OC\\Preview\\BMP", "OC\\Preview\\XBitmap", "OC\\Preview\\Movie", "OC\\Preview\\PDF", "OC\\Preview\\MP3", "OC\\Preview\\TXT", "OC\\Preview\\MarkDown" ], "preview_max_x": "1024", "preview_max_y": "768", "preview_max_scale_factor": "1", "auth.bruteforce.protection.enabled": "true", "trashbin_retention_obligation": "auto,7", "skeletondirectory": "", "defaultapp": "file", "activity_expire_days": "14", "integrity.check.disabled": "false", "updater.release.channel": "stable", "loglevel": 2, "maintenance": false, "theme": "" } ```

Are you using external storage, if yes which one: local/smb/sftp/...

Are you using encryption:

Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/...

Client configuration

Browser: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0

Operating system: Ubuntu 18.04

Logs

Browser log ``` ```
Nextcloud log ``` Far too much to include the entire file but here's a small part: {"reqId":"ShEYFQZVHufZEuxJVfxs","level":2,"time":"2018-10-29T06:15:01+00:00","remoteAddr":"","user":"--","app":"OC\\Log\\Rotate","method":"","url":"--","message":"Log file \"\/var\/nc-data\/nextcloud.log\" was over 104857600 bytes, moved to \"\/var\/nc-data\/nextcloud.log.1\"","userAgent":"--","version":"14.0.3.0"} {"reqId":"nXHYVNnKIJC6O6MNi9B6","level":3,"time":"2018-10-29T17:24:42+00:00","remoteAddr":"192.168.1.1","user":"david","app":"no app in context","method":"PUT","url":"\/remote.php\/dav\/files\/david\/Documents\/Configs\/VScode\/.vscode\/extensions\/ms-vsliveshare.vsliveshare-0.3.869\/modifiedInternalSettings.json","message":{"Exception":"Doctrine\\DBAL\\Exception\\DriverException","Message":"An exception occurred while executing 'INSERT INTO `oc_filecache` (`mimepart`,`mimetype`,`mtime`,`size`,`etag`,`storage_mtime`,`permissions`,`parent`,`checksum`,`path_hash`,`path`,`name`,`storage`) SELECT ?,?,?,?,?,?,?,?,?,?,?,?,? FROM `oc_filecache` WHERE `storage` = ? AND `path_hash` = ? HAVING COUNT(*) = 0' with params [\"5\", \"12\", 1540833882, 79, \"1ca9218a7b9fa893e56f4836243d501b\", 1540833882, 27, 3304356, \"\", \"094d59cdb13f5ae1fda3de37ce5f24f5\", \"files_versions\\\/Documents\\\/Configs\\\/VScode\\\/.vscode\\\/extensions\\\/ms-vsliveshare.vsliveshare-0.3.869\\\/modifiedInternalSettings.json.v1540754049\", \"modifiedInternalSettings.json.v1540754049\", 3, 3, \"094d59cdb13f5ae1fda3de37ce5f24f5\"]:\n\nSQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction","Code":0,"Trace":[{"file":"\/var\/www\/nextcloud\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/DBALException.php","line":128,"function":"convertException","class":"Doctrine\\DBAL\\Driver\\AbstractMySQLDriver","type":"->","args":["An exception occurred while executing 'INSERT INTO `oc_filecache` (`mimepart`,`mimetype`,`mtime`,`size`,`etag`,`storage_mtime`,`permissions`,`parent`,`checksum`,`path_hash`,`path`,`name`,`storage`) SELECT ?,?,?,?,?,?,?,?,?,?,?,?,? FROM `oc_filecache` WHERE `storage` = ? AND `path_hash` = ? HAVING COUNT(*) = 0' with params [\"5\", \"12\", 1540833882, 79, \"1ca9218a7b9fa893e56f4836243d501b\", 1540833882, 27, 3304356, \"\", \"094d59cdb13f5ae1fda3de37ce5f24f5\", \"files_versions\\\/Documents\\\/Configs\\\/VScode\\\/.vscode\\\/extensions\\\/ms-vsliveshare.vsliveshare-0.3.869\\\/modifiedInternalSettings.json.v1540754049\", \"modifiedInternalSettings.json.v1540754049\", 3, 3, \"094d59cdb13f5ae1fda3de37ce5f24f5\"]:\n\nSQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction",{"errorInfo":["40001",1213,"Deadlock found when trying to get lock; try restarting transaction"],"__class__":"Doctrine\\DBAL\\Driver\\PDOException"}]},{"file":"\/var\/www\/nextcloud\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Connection.php","line":1015,"function":"driverExceptionDuringQuery","class":"Doctrine\\DBAL\\DBALException","type":"::","args":[{"__class__":"Doctrine\\DBAL\\Driver\\PDOMySql\\Driver"},{"errorInfo":["40001",1213,"Deadlock found when trying to get lock; try restarting transaction"],"__class__":"Doctrine\\DBAL\\Driver\\PDOException"},"INSERT INTO `oc_filecache` (`mimepart`,`mimetype`,`mtime`,`size`,`etag`,`storage_mtime`,`permissions`,`parent`,`checksum`,`path_hash`,`path`,`name`,`storage`) SELECT ?,?,?,?,?,?,?,?,?,?,?,?,? FROM `oc_filecache` WHERE `storage` = ? AND `path_hash` = ? HAVING COUNT(*) = 0",{"1":"5","2":"12","3":1540833882,"4":79,"5":"1ca9218a7b9fa893e56f4836243d501b","6":1540833882,"7":27,"8":3304356,"9":"","10":"094d59cdb13f5ae1fda3de37ce5f24f5","11":"files_versions\/Documents\/Configs\/VScode\/.vscode\/extensions\/ms-vsliveshare.vsliveshare-0.3.869\/modifiedInternalSettings.json.v1540754049","12":"modifiedInternalSettings.json.v1540754049","13":3,"14":3,"15":"094d59cdb13f5ae1fda3de37ce5f24f5"}]},{"file":"\/var\/www\/nextcloud\/lib\/private\/DB\/Connection.php","line":216,"function":"executeUpdate","class":"Doctrine\\DBAL\\Connection","type":"->","args":["INSERT INTO `oc_filecache` (`mimepart`,`mimetype`,`mtime`,`size`,`etag`,`storage_mtime`,`permissions`,`parent`,`checksum`,`path_hash`,`path`,`name`,`storage`) SELECT ?,?,?,?,?,?,?,?,?,?,?,?,? FROM `oc_filecache` WHERE `storage` = ? AND `path_hash` = ? HAVING COUNT(*) = 0",["5","12",1540833882,79,"1ca9218a7b9fa893e56f4836243d501b",1540833882,27,3304356,"","094d59cdb13f5ae1fda3de37ce5f24f5","files_versions\/Documents\/Configs\/VScode\/.vscode\/extensions\/ms-vsliveshare.vsliveshare-0.3.869\/modifiedInternalSettings.json.v1540754049","modifiedInternalSettings.json.v1540754049",3,3,"094d59cdb13f5ae1fda3de37ce5f24f5"],[]]},{"file":"\/var\/www\/nextcloud\/lib\/private\/DB\/Adapter.php","line":114,"function":"executeUpdate","class":"OC\\DB\\Connection","type":"->","args":["INSERT INTO `oc_filecache` (`mimepart`,`mimetype`,`mtime`,`size`,`etag`,`storage_mtime`,`permissions`,`parent`,`checksum`,`path_hash`,`path`,`name`,`storage`) SELECT ?,?,?,?,?,?,?,?,?,?,?,?,? FROM `oc_filecache` WHERE `storage` = ? AND `path_hash` = ? HAVING COUNT(*) = 0",["5","12",1540833882,79,"1ca9218a7b9fa893e56f4836243d501b",1540833882,27,3304356,"","094d59cdb13f5ae1fda3de37ce5f24f5","files_versions\/Documents\/Configs\/VScode\/.vscode\/extensions\/ms-vsliveshare.vsliveshare-0.3.869\/modifiedInternalSettings.json.v1540754049","modifiedInternalSettings.json.v1540754049",3,3,"094d59cdb13f5ae1fda3de37ce5f24f5"]]},{"file":"\/var\/www\/nextcloud\/lib\/private\/DB\/Connection.php","line":254,"function":"insertIfNotExist","class":"OC\\DB\\Adapter","type":"->","args":["*PREFIX*filecache",{"mimepart":"5","mimetype":"12","mtime":1540833882,"size":79,"etag":"1ca9218a7b9fa893e56f4836243d501b","storage_mtime":1540833882,"permissions":27,"parent":3304356,"checksum":"","path_hash":"094d59cdb13f5ae1fda3de37ce5f24f5","path":"files_versions\/Documents\/Configs\/VScode\/.vscode\/extensions\/ms-vsliveshare.vsliveshare-0.3.869\/modifiedInternalSettings.json.v1540754049","name":"modifiedInternalSettings.json.v1540754049","storage":3},["storage","path_hash"]]},{"file":"\/var\/www\/nextcloud\/lib\/private\/Files\/Cache\/Cache.php","line":272,"function":"insertIfNotExist","class":"OC\\DB\\Connection","type":"->","args":["*PREFIX*filecache",{"mimepart":"5","mimetype":"12","mtime":1540833882,"size":79,"etag":"1ca9218a7b9fa893e56f4836243d501b","storage_mtime":1540833882,"permissions":27,"parent":3304356,"checksum":"","path_hash":"094d59cdb13f5ae1fda3de37ce5f24f5","path":"files_versions\/Documents\/Configs\/VScode\/.vscode\/extensions\/ms-vsliveshare.vsliveshare-0.3.869\/modifiedInternalSettings.json.v1540754049","name":"modifiedInternalSettings.json.v1540754049","storage":3},["storage","path_hash"]]},{"file":"\/var\/www\/nextcloud\/apps\/files_automatedtagging\/lib\/CacheWrapper.php","line":62,"function":"insert","class":"OC\\Files\\Cache\\Cache","type":"->","args":["files_versions\/Documents\/Configs\/VScode\/.vscode\/extensions\/ms-vsliveshare.vsliveshare-0.3.869\/modifiedInternalSettings.json.v1540754049",{"mimetype":"application\/json","mtime":1540833882,"size":79,"etag":"1ca9218a7b9fa893e56f4836243d501b","storage_mtime":1540833882,"permissions":27,"parent":3304356,"checksum":"","path":"files_versions\/Documents\/Configs\/VScode\/.vscode\/extensions\/ms-vsliveshare.vsliveshare-0.3.869\/modifiedInternalSettings.json.v1540754049","name":"modifiedInternalSettings.json.v1540754049"}]},{"file":"\/var\/www\/nextcloud\/lib\/private\/Files\/Cache\/Wrapper\/CacheWrapper.php","line":128,"function":"insert","class":"OCA\\FilesAutomatedTagging\\CacheWrapper","type":"->","args":["files_versions\/Documents\/Configs\/VScode\/.vscode\/extensions\/ms-vsliveshare.vsliveshare-0.3.869\/modifiedInternalSettings.json.v1540754049",{"mimetype":"application\/json","mtime":1540833882,"size":79,"etag":"1ca9218a7b9fa893e56f4836243d501b","storage_mtime":1540833882,"permissions":27,"parent":3304356,"checksum":""}]},{"file":"\/var\/www\/nextcloud\/lib\/private\/Files\/Cache\/Wrapper\/CacheWrapper.php","line":128,"function":"insert","class":"OC\\Files\\Cache\\Wrapper\\CacheWrapper","type":"->","args":["files_versions\/Documents\/Configs\/VScode\/.vscode\/extensions\/ms-vsliveshare.vsliveshare-0.3.869\/modifiedInternalSettings.json.v1540754049",{"mimetype":"application\/json","mtime":1540833882,"size":79,"etag":"1ca9218a7b9fa893e56f4836243d501b","storage_mtime":1540833882,"permissions":27,"parent":3304356,"checksum":""}]}, ```
Browser log

EDIT: I have additional information! It appears to be related to an inability to log in under my normal user name?

When I try to login under my non-admin user through a browser I get blocked! This is the same user being used by the client too. Perhaps the web dav folder sync sent so many requests that it got flagged as spam or ddos or something? I'm going to try and creating a new user with the same privileges and see what that does.

The server was unable to complete your request.

If this happens again, please send the technical details below to the server administrator.

More details can be found in the server log.
Technical details

    Remote Address: 192.168.1.1
    Request ID: wWNRQokPpmcft2WBcWUj

EDIT2: It started working again? I created a new user and then I needed to impersonate my non-admin user to share their folders over with the new fake user and when I did I was like "huh... this is just like logging in. Is impersonating just logging in? Can I now log in?" so I opened an incognito tab in my browser and now I can log in and the folder sync works! WHY????

Here's the latest logs. Maybe they shed light on this:


Warning | core | Login failed: '' (Remote IP: '192.168.1.1') | 2018-11-05T19:22:09-0600
-- | -- | -- | --
Warning | impersonate | Changing to user david | 2018-11-05T19:21:17-0600
Warning | impersonate | User admin trying to impersonate user david | 2018-11-05T19:21:17-0600
Error | PHP | TypeError:  Argument 1 passed to GuzzleHttp\Exception\RequestException::create()  must be an instance of GuzzleHttp\Message\RequestInterface, instance of  GuzzleHttp\Psr7\Request given, called in  /var/www/nextcloud/3rdparty/guzzlehttp/guzzle/src/Middleware.php on line  65 at  /var/www/nextcloud/apps/files_external_gdrive/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php#64
nextcloud-bot commented 5 years ago

GitMate.io thinks possibly related issues are https://github.com/nextcloud/server/issues/3738 (Webdav), https://github.com/nextcloud/server/issues/12042 (WebDav issue with One Drive), https://github.com/nextcloud/server/issues/11804 (https windows webdav issue ), https://github.com/nextcloud/server/issues/8570 (Activation of server side end-to-end encryption creates issue for webdav connection with Cryptomator), and https://github.com/nextcloud/server/issues/7964 (Performance issues with WebDav (remote.php)).

rullzer commented 5 years ago

It could be that you are banned by our bruteforce protection. Check the oc_bruteforce_attempts table.

Also the guzzle exception comes from the grdive app not being properly compatible with NC14. Disable it and it should go away.

jcklpe commented 5 years ago

@rullzer I don't have gdrive on my server. You can see that from the list of enabled apps in my issue report.

I also tried turning off bruteforce protection and that did not fix it.

It's fixed now but whatever happened wasn't either of those things.

rullzer commented 5 years ago

Yes you do: files_external_gdrive

jcklpe commented 5 years ago

@rullzer Ah dang, whoops. Missed that. Apologies.

Also it just did it again. I found a way to fix it though. I just login through an icognito browser and suddenly it works fine? Could that be related to the bruteforce thing?

skjnldsv commented 4 years ago

SHould be fixed nowadays, the lib received lots of fixes and update As I cannot reproduce the original issue anymore, I will close this ticket. If this is still happening please make sure to upgrade to the latest version. After that, feel free to reopen.