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

Sabre\DAV\Exception\BadRequest: expected filesize 1024000 got 552960 #1450

Closed
enoch85 opened this issue Aug 27, 2017 · 24 comments
Closed

Sabre\DAV\Exception\BadRequest: expected filesize 1024000 got 552960 #1450

enoch85 opened this issue Aug 27, 2017 · 24 comments

Comments

@enoch85
Copy link
Member

enoch85 commented Aug 27, 2017

Steps to reproduce

  1. Take a photo (AutoUpload turned on)
  2. Check the log

Expected behavior

No error

Actual behavior

Since I upgraded to 2.0.0RC4 I see this behavior. I can't say exactly which version that triggered it, but it happens like every time (not investigated further) I take a photo that gets AutoUploaded.

Using Android 7.1.2 on a Nexus 5x + Huawei P10 (don't know Android version but I think it's 7.0)

See log for more info.

General server configuration

Operating system: Linux techandme.se 4.4.0-92-generic #115-Ubuntu SMP Thu Aug 10 09:04:33 UTC 2017 x86_64

Web server: Apache/2.4.18 (Ubuntu) (apache2handler)

Database: pgsql PostgreSQL 9.6.4 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609, 64-bit

PHP version: 7.0.22-0ubuntu0.16.04.1

PHP-modules loaded
 - Core
 - date
 - libxml
 - openssl
 - pcre
 - zlib
 - filter
 - hash
 - Reflection
 - SPL
 - session
 - standard
 - apache2handler
 - PDO
 - xml
 - calendar
 - ctype
 - curl
 - dom
 - mbstring
 - fileinfo
 - ftp
 - gd
 - gettext
 - iconv
 - imap
 - intl
 - json
 - ldap
 - exif
 - mcrypt
 - pdo_pgsql
 - pdo_sqlite
 - pgsql
 - Phar
 - posix
 - readline
 - redis
 - shmop
 - SimpleXML
 - smbclient
 - sockets
 - sqlite3
 - sysvmsg
 - sysvsem
 - sysvshm
 - tokenizer
 - wddx
 - xmlreader
 - xmlwriter
 - xsl
 - zip
 - libsmbclient
 - Zend OPcache

Nextcloud configuration

Nextcloud version: 12.0.2 - 12.0.2.0

Updated from an older Nextcloud/ownCloud or fresh install: Updated since back in the ownCloud days (5.0 I think it was hehe)

Where did you install Nextcloud from: Nextcloud VM

Are you using external storage, if yes which one: no

Are you using encryption: no

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

Signing status
[]
Enabled apps
 - activity: 2.5.2
 - admin_notifications: 1.0.0
 - bruteforcesettings: 1.0.2
 - calendar: 1.5.3
 - checksum: 0.3.5
 - comments: 1.2.0
 - contacts: 1.5.3
 - dav: 1.3.0
 - federatedfilesharing: 1.2.0
 - federation: 1.2.0
 - files: 1.7.2
 - files_downloadactivity: 1.1.1
 - files_external: 1.3.0
 - files_pdfviewer: 1.1.1
 - files_sharing: 1.4.0
 - files_texteditor: 2.4.1
 - files_trashbin: 1.2.0
 - files_versions: 1.5.0
 - files_videoplayer: 1.1.0
 - firstrunwizard: 2.1
 - gallery: 17.0.0
 - impersonate: 1.0.1
 - issuetemplate: 0.2.2
 - logreader: 2.0.0
 - lookup_server_connector: 1.0.0
 - mail: 0.6.4
 - nextcloud_announcements: 1.1
 - notes: 2.3.1
 - notifications: 2.0.0
 - oauth2: 1.0.5
 - ocsms: 1.12.1
 - password_policy: 1.2.2
 - previewgenerator: 1.0.6
 - provisioning_api: 1.2.0
 - qownnotesapi: 17.5.0
 - richdocuments: 1.12.34
 - serverinfo: 1.2.0
 - sharebymail: 1.2.0
 - socialsharing_diaspora: 1.0.1
 - socialsharing_email: 1.0.1
 - socialsharing_facebook: 1.0.1
 - socialsharing_googleplus: 1.0.1
 - socialsharing_twitter: 1.0.1
 - spreed: 2.0.1
 - survey_client: 1.0.0
 - systemtags: 1.2.0
 - theming: 1.3.0
 - twofactor_backupcodes: 1.1.1
 - twofactor_totp: 1.3.1
 - updatenotification: 1.2.0
 - workflowengine: 1.2.0
Disabled apps
 - admin_audit
 - encryption
 - user_external
 - user_ldap
Content of config/config.php
{
    "updatechecker": false,
    "passwordsalt": "***REMOVED SENSITIVE VALUE***",
    "secret": "***REMOVED SENSITIVE VALUE***",
    "trusted_domains": [
        "localhost",
        "192.168.4.111",
        "sub.techandme.se",
        "sub2.techandme.se"
    ],
    "datadirectory": "\/var\/ncdata",
    "overwrite.cli.url": "https:\/\/sub.techandme.se\/",
    "dbtype": "pgsql",
    "version": "12.0.2.0",
    "dbname": "nextcloud",
    "dbhost": "127.0.0.1",
    "dbtableprefix": "oc_",
    "dbuser": "***REMOVED SENSITIVE VALUE***",
    "dbpassword": "***REMOVED SENSITIVE VALUE***",
    "logtimezone": "Europe\/Stockholm",
    "installed": true,
    "instanceid": "oc7aii0tkiol",
    "mail_smtpmode": "smtp",
    "mail_smtpauth": 1,
    "mail_smtpport": "587",
    "mail_smtphost": "mail.citynetwork.se",
    "mail_smtpauthtype": "LOGIN",
    "mail_from_address": "no-reply",
    "mail_domain": "techandme.se",
    "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
    "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
    "allowZipDownload": true,
    "session_lifetime": 1800,
    "forcessl": true,
    "logfile": "\/var\/log\/nfs-share\/nextcloud.log",
    "loglevel": 2,
    "memcache.local": "\\OC\\Memcache\\Redis",
    "filelocking.enabled": true,
    "memcache.distributed": "\\OC\\Memcache\\Redis",
    "memcache.locking": "\\OC\\Memcache\\Redis",
    "redis": {
        "host": "\/var\/run\/redis\/redis.sock",
        "port": 0,
        "timeout": 0,
        "dbindex": 0
    },
    "trusted_proxies": [
        [
            "192.168.209.201"
        ]
    ],
    "forwarded_for_headers": [
        "HTTP_X_FORWARDED",
        "HTTP_FORWARDED_FOR"
    ],
    "maintenance": false,
    "mail_smtpsecure": "tls",
    "htaccess.RewriteBase": "\/",
    "theme": "",
    "updater.release.channel": "stable",
    "trashbin_retention_obligation": "auto, 30",
    "activity_expire_days": 60
}

Client configuration

Browser: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/60.0.3112.78 Chrome/60.0.3112.78 Safari/537.36

Operating system: Ubuntu 17.10 (Budgie)

Logs

Web server error log
[Sun Aug 27 06:25:11.385121 2017] [mpm_prefork:notice] [pid 1399] AH00163: Apache/2.4.18 (Ubuntu) OpenSSL/1.0.2g configured -- resuming normal operations
[Sun Aug 27 06:25:11.385146 2017] [core:notice] [pid 1399] AH00094: Command line: '/usr/sbin/apache2'
[Sun Aug 27 19:21:56.546585 2017] [core:notice] [pid 1399] AH00051: child pid 2965 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sun Aug 27 19:21:58.573256 2017] [core:warn] [pid 1399] AH00045: child process 9360 still did not exit, sending a SIGTERM
[Sun Aug 27 19:21:59.574424 2017] [core:notice] [pid 1399] AH00051: child pid 9360 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sun Aug 27 19:21:59.574524 2017] [mpm_prefork:notice] [pid 1399] AH00169: caught SIGTERM, shutting down
[Sun Aug 27 19:22:00.393604 2017] [mpm_prefork:notice] [pid 14442] AH00163: Apache/2.4.18 (Ubuntu) OpenSSL/1.0.2g configured -- resuming normal operations
[Sun Aug 27 19:22:00.393654 2017] [core:notice] [pid 14442] AH00094: Command line: '/usr/sbin/apache2
Nextcloud log (data/nextcloud.log)

Sabre\DAV\Exception\BadRequest: expected filesize 1024000 got 552960/var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php - line 105: OCA\DAV\Connector\Sabre\File->createFileChunked(Resource id #20)/var/www/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php - line 151: OCA\DAV\Connector\Sabre\File->put(Resource id #20)/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 1096: OCA\DAV\Connector\Sabre\Directory->createFile('IMG_20170827_20...', Resource id #20)/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php - line 525: Sabre\DAV\Server->createFile('AutomatiskUppla...', Resource id #20, NULL)[internal function] Sabre\DAV\CorePlugin->httpPut(Object(Sabre\HTTP\Request), Object(Sabre\HTTP\Response))/var/www/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php - line 105: call_user_func_array(Array, Array)/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 479: Sabre\Event\EventEmitter->emit('method PUT', Array)/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 254: Sabre\DAV\Server->invokeMethod(Object(Sabre\HTTP\Request), Object(Sabre\HTTP\Response))/var/www/nextcloud/apps/dav/appinfo/v1/webdav.php - line 71: Sabre\DAV\Server->exec()/var/www/nextcloud/remote.php - line 162: require_once('/var/www/nextcl...'){main}
--

Sabre\DAV\Exception\BadRequest: expected filesize 1024000 got 610304
/var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php - line 105: OCA\DAV\Connector\Sabre\File->createFileChunked(Resource id #8)
/var/www/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php - line 151: OCA\DAV\Connector\Sabre\File->put(Resource id #8)
/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 1096: OCA\DAV\Connector\Sabre\Directory->createFile('IMG_20170827_21...', Resource id #8)
/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php - line 525: Sabre\DAV\Server->createFile('AutomatiskUppla...', Resource id #8, NULL)
[internal function] Sabre\DAV\CorePlugin->httpPut(Object(Sabre\HTTP\Request), Object(Sabre\HTTP\Response))
/var/www/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php - line 105: call_user_func_array(Array, Array)
/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 479: Sabre\Event\EventEmitter->emit('method PUT', Array)
/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 254: Sabre\DAV\Server->invokeMethod(Object(Sabre\HTTP\Request), Object(Sabre\HTTP\Response))
/var/www/nextcloud/apps/dav/appinfo/v1/webdav.php - line 71: Sabre\DAV\Server->exec()
/var/www/nextcloud/remote.php - line 162: require_once('/var/www/nextcl...')
{main}


imagecreatefromjpeg(): gd-jpeg: JPEG library reports unrecoverable error: Invalid JPEG file structure: two SOF markers at /var/www/nextcloud/lib/private/legacy/image.php#566
--



Browser log
Insert your browser log here, this could for example include:

a) The javascript console log
b) The network log
c) ...
@AndyScherzinger
Copy link
Member

cc @mario @tobiasKaminsky

@AndyScherzinger AndyScherzinger mentioned this issue Aug 29, 2017
57 tasks
@mario
Copy link
Contributor

mario commented Aug 29, 2017

@enoch85 are you uploading files from external storage (sd card) or internal?

@mario
Copy link
Contributor

mario commented Aug 29, 2017

Also, are the files ok after being uploaded?

@enoch85
Copy link
Member Author

enoch85 commented Aug 29, 2017

@mario The files are automatically uploaded from the Camera Roll with AutoUpload from the internal storage. And yes, the files are OK after upload.

EDIT: No more .thumbnail for example.

@enoch85
Copy link
Member Author

enoch85 commented Aug 29, 2017

Spams my log pretty much:

screenshot from 2017-08-29 20 55 23

@enoch85
Copy link
Member Author

enoch85 commented Sep 4, 2017

Just tested dev 20170818 and it doesn't happen on my Nexus 5. Seems to be the P10 only.

@AndyScherzinger
Copy link
Member

postponing to post-2.0.0 then :)

@mario
Copy link
Contributor

mario commented Sep 6, 2017

Or it got fixed with soon-to-be-released RC6. We'll never know xD

@AndyScherzinger
Copy link
Member

Yeah, probably... @enoch85 would you mind providing an update to this issue for RC6 whenever it will be released? :)

@enoch85
Copy link
Member Author

enoch85 commented Sep 11, 2017

Seems like the error is gone in RC6, need to confirm a few more days before I can say certain. But initial tests didn't produce this error.

@mario
Copy link
Contributor

mario commented Sep 12, 2017 via email

@mario
Copy link
Contributor

mario commented Sep 12, 2017

@enoch85 still ok? :)

@enoch85
Copy link
Member Author

enoch85 commented Sep 12, 2017

Forgot to put this on my todo-list and forgot about checking actually. Sorry.

I checked now and I'm sad to say, it's still there.

Sabre\DAV\Exception\BadRequest: expected filesize 1024000 got 204800/var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php - line 105: OCA\DAV\Connector\Sabre\File->createFileChunked(Resource id #8)/var/www/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php - line 151: OCA\DAV\Connector\Sabre\File->put(Resource id #8)/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 1096: OCA\DAV\Connector\Sabre\Directory->createFile('IMG_20170912_19...', Resource id #8)/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php - line 525: Sabre\DAV\Server->createFile('AutomatiskUppla...', Resource id #8, NULL)[internal function] Sabre\DAV\CorePlugin->httpPut(Object(Sabre\HTTP\Request), Object(Sabre\HTTP\Response))/var/www/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php - line 105: call_user_func_array(Array, Array)/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 479: Sabre\Event\EventEmitter->emit('method PUT', Array)/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 254: Sabre\DAV\Server->invokeMethod(Object(Sabre\HTTP\Request), Object(Sabre\HTTP\Response))/var/www/nextcloud/apps/dav/appinfo/v1/webdav.php - line 71: Sabre\DAV\Server->exec()/var/www/nextcloud/remote.php - line 162: require_once('/var/www/nextcl...'){main}
--

Not as frequent as in the passed though.

@mario
Copy link
Contributor

mario commented Sep 13, 2017

Did you check if upload gets stopped/paused during the upload? Because this would imply that not all data got uploaded which is strange if the file works, like you mentioned?

@enoch85
Copy link
Member Author

enoch85 commented Sep 13, 2017

I can do some more tests tonight. I work like 12 hour days now, it's crazy. One full-time job plus Tech and Me and Nextcloud = no spare time plus no sleep.

I'll do my best. :)

@mario
Copy link
Contributor

mario commented Sep 13, 2017

@enoch85 that's awesome, I appreciate it very much!

@enoch85
Copy link
Member Author

enoch85 commented Sep 13, 2017

OK, tested to take like 5 pictures in a row on both 4G and WiFi, no errors on RC6. Let's close this one.

BAM

@enoch85 enoch85 closed this as completed Sep 13, 2017
@B5r1oJ0A9G
Copy link

I think to experience the same issue with Auto uploads failing.

  • Nextcloud Android app 3.1.0
  • Nextcloud 13.0.2

Sabre\DAV\Exception\BadRequest: expected filesize 1024000 got 765952

/var/www/html/apps/dav/lib/Connector/Sabre/File.php - line 132: OCA\DAV\Connector\Sabre\File->createFileChunked(Resource id #9)
/var/www/html/apps/dav/lib/Connector/Sabre/Directory.php - line 151: OCA\DAV\Connector\Sabre\File->put(Resource id #9)
/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php - line 1096: OCA\DAV\Connector\Sabre\Directory->createFile('IMG_20180510_10...', Resource id #9)
/var/www/html/3rdparty/sabre/dav/lib/DAV/CorePlugin.php - line 525: Sabre\DAV\Server->createFile('InstantUpload/C...', Resource id #9, NULL)
[internal function] Sabre\DAV\CorePlugin->httpPut(Object(Sabre\HTTP\Request), Object(Sabre\HTTP\Response))
/var/www/html/3rdparty/sabre/event/lib/EventEmitterTrait.php - line 105: call_user_func_array(Array, Array)
/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php - line 479: Sabre\Event\EventEmitter->emit('method PUT', Array)
/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php - line 254: Sabre\DAV\Server->invokeMethod(Object(Sabre\HTTP\Request), Object(Sabre\HTTP\Response))
/var/www/html/apps/dav/appinfo/v1/webdav.php - line 80: Sabre\DAV\Server->exec()
/var/www/html/remote.php - line 164: require_once('/var/www/html/a...')
{main}

@Thorbinjho
Copy link

Thorbinjho commented Jun 20, 2018

I am seeing this behaviour as well. Using the official and up-to-date nextcloud app from the F-Droid store, I cannot upload any files bigger than 1MB. Smaller files do not raise any issues and downloading works for files of any size (tested with 50kB-100MB).
When utilizing the webinterface from my personal computer, I can upload and download files of up to 100MB (bigger files not tested)

Sabre\DAV\Exception\BadRequest: expected filesize 1024000 got 466944

/usr/share/webapps/nextcloud/apps/dav/lib/Connector/Sabre/File.php - line 132: OCA\DAV\Connector\Sabre\File->createFileChunked(Resource id #18)
/usr/share/webapps/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php - line 151: OCA\DAV\Connector\Sabre\File->put(Resource id #18)
/usr/share/webapps/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 1096: OCA\DAV\Connector\Sabre\Directory->createFile('IMG_20180614_12...', Resource id #18)
/usr/share/webapps/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php - line 525: Sabre\DAV\Server->createFile('Handy/Handykame...', Resource id #18, NULL)
[internal function] Sabre\DAV\CorePlugin->httpPut(Object(Sabre\HTTP\Request), Object(Sabre\HTTP\Response))
/usr/share/webapps/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php - line 105: call_user_func_array(Array, Array)
/usr/share/webapps/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 479: Sabre\Event\EventEmitter->emit('method PUT', Array)
/usr/share/webapps/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 254: Sabre\DAV\Server->invokeMethod(Object(Sabre\HTTP\Request), Object(Sabre\HTTP\Response))
/usr/share/webapps/nextcloud/apps/dav/appinfo/v1/webdav.php - line 80: Sabre\DAV\Server->exec()
/usr/share/webapps/nextcloud/remote.php - line 164: require_once('/usr/share/weba...')
{main}

@tobiasKaminsky
Copy link
Member

@nextcloud/server-triage does this mean that a wrong chunk was sent? Or that something during transmission broke?

@nickvergessen
Copy link
Member

It means CONTENT_LENGTH does not match the number of bytes we wrote after receiving the chunk

@tobiasKaminsky
Copy link
Member

Can we figure out when and/or why this is happening?
For me it sounds like a transmission problem?

@Thorbinjho
Copy link

Thorbinjho commented Jun 22, 2018

So, I found the reason for my issues although I don't understand the strange behaviour. I have NetGuard installed which creates a VPN and blocks undesired internet access by apps. What I did is to use a whitelist for apps (which obviously included the nextcloud app) and I did not see any issues that I would have thought of to be firewall related. But: When I disable NetGuard, the upload from the nextcloud app works fine for images >1MB. I did not test bigger files but I expect the issue to be resolved for me - more or less.

What I don't understand is, why the upload is working for smaller files with the enabled firewall while it fails for bigger files and where the downloads don't seem to care about the enabled firewall for any filesize... Also, I would guess that there is some kind of data transmission (so not all data is being blocked) as the logs state "expected x byte/got y byte", where x>y>0. Calendar/Contact Sync via DavDroid have been working with the enabled firewall as well... So, I dont know what makes the difference between chunked and non-chunked file uploads from the perspective of a firewall.

So, my next question is: Does anybody have a clue what I need to whitelist in my firewall in order to have a proper functioning of the nextcloud app with an enabled firewall on my mobile?

@WRobertson2
Copy link

@Thorbinjho I've encountered the same problem, and in circumstances similar to yours: I have an OpenVPN tunnel from my home router to the private network where my Nextcloud server lives. Now, I can also connect to this VPN via the OpenVPN for Android app. What's interesting is, I only encounter the "expected x got y" error under two conditions:
1.) the file is somewhat large (e.g. large JPGs or RAW images, as opposed to a .txt file which is fine)
2.) I am uploading from within my home network, via the OpenVPN tunnel.

It's weird, because if I'm on my home network, but use the OpenVPN for Android app instead of routing through an OpenVPN server then everything works as expected.

I'm at a loss, unless there's something wrong with my OpenVPN configuration. But the web UI works fine in all situations...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants