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

Problem to download big file with php7 and owncloud 9 #23788

Closed
Diak opened this issue Apr 4, 2016 · 16 comments
Closed

Problem to download big file with php7 and owncloud 9 #23788

Diak opened this issue Apr 4, 2016 · 16 comments

Comments

@Diak
Copy link

Diak commented Apr 4, 2016

Steps to reproduce

  1. Pick a big file (mine is 3,1 GB)
  2. Download it

Expected behaviour

It should download the file

Actual behaviour

The download doesn't start and after about 1 minute Chrome stops the download which has never stared --> empty temporary file

Server configuration

Operating system:
Raspbian last update on a raspberry Pi 3

Web server:
Nginx 1.6.2

Database:
MySQL 5.5.44

PHP version:
PHP 7.0.3-3~bpo8+1

ownCloud version: (see ownCloud admin page)
Owncloud 9.0.0 (stable)

Updated from an older ownCloud or fresh install:
Updated manually from Owncloud 8.2.3

Where did you install ownCloud from:
I downloaded the tarball from Owncloud download page

Signing status (ownCloud 9.0 and above):
No errors have been found.

List of activated apps:
Enabled:

  • activity: 2.2.1
  • comments: 0.2
  • dav: 0.1.5
  • direct_menu: 0.7.1
  • external: 1.2
  • federatedfilesharing: 0.1.0
  • federation: 0.0.4
  • files: 1.4.4
  • files_external: 0.5.2
  • files_pdfviewer: 0.8
  • files_sharing: 0.9.1
  • files_trashbin: 0.8.0
  • files_versions: 1.2.0
  • files_videoplayer: 0.9.8
  • notifications: 0.2.3
  • systemtags: 0.2
  • updatenotification: 0.1.0
    Disabled:
  • encryption
  • files_texteditor
  • firstrunwizard
  • gallery
  • provisioning_api
  • templateeditor
  • user_external
  • user_ldap

The content of config/config.php:
{
"system": {
"instanceid": "_",
"passwordsalt": "
REMOVED SENSITIVE VALUE**",
"secret": "_REMOVED SENSITIVE VALUE",
"trusted_domains": [
"cloud.**
.com"
],
"datadirectory": "/media/usbdisk/owncloud/data",
"overwrite.cli.url": "https://cloud..com/owncloud",
"dbtype": "mysql",
"version": "9.0.0.19",
"dbname": "owncloud",
"dbhost": "localhost",
"dbtableprefix": "oc
",
"dbuser": "
REMOVED SENSITIVE VALUE**",
"dbpassword": "_REMOVED SENSITIVE VALUE*",
"logtimezone": "UTC",
"installed": true,
"appstore.experimental.enabled": true,
"loglevel": 2,
"maintenance": false,
"theme": "",
"memcache.local": "\OC\Memcache\APCu",
"asset-pipeline.enabled": true,
"default_language": "fr"
}
}

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

Are you using encryption: yes/no
no

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

Web server error log

None

ownCloud log (data/owncloud.log)

{"reqId":"ywywVbU1oKTwIgu8yUuS","remoteAddr":"192.168.1.102","app":"PHP","message":"stream_copy_to_stream() expects parameter 3 to be integer, string given at /var/www/owncloud/3rdparty/sabre/http/lib/Sapi.php#78","level":3,"time":"2016-04-04T19:38:09+00:00"}

Browser log

None

@chakphanu
Copy link

Can you try with 64 bit OS?
32 bit OS/PHP intval() return maximum ~2147483647.

also try to patch Sapi.php to add

         $contentLength = $response->getHeader('Content-Length');
          if ($contentLength !== null) {
 +            $contentLength = intval($contentLength);
              $output = fopen('php://output', 'wb');

@Diak
Copy link
Author

Diak commented Apr 4, 2016

No sorry i can't try with 64 bit OS i only have Owncloud installed on my Raspbian.
The patch worked fine at first but the download stopped at 2 GB which is coherent with your explanation.

So i tried to remove the $contentLength on stream_copy_to_stream call (sorry i didn't find how to display the line breaks) :

if ($contentLength !== null) {
            $output = fopen('php://output', 'wb');
            if (is_resource($body) && get_resource_type($body) == 'stream') {
                stream_copy_to_stream($body, $output);
            } else {
                fwrite($output, $body, $contentLength);
            }
...

That fixed my problem but i don't know the collateral effects...
Should I change it in fwrite call too ?

Moreover, I didn't have this problem with owncloud 8.2.3 and PHP 5. Which one of these upgrades bringed the problem ?

Thanks for you help :)

@nickvergessen
Copy link
Contributor

3rdparty problem. Closing here.

@Diak
Copy link
Author

Diak commented Apr 5, 2016

it means the problem will not be solved because it concerns a 3rd party API included in Owncloud and not Owncloud core itself ?

@nickvergessen
Copy link
Contributor

Well we can't fix it, once the thridparty (Sabre/http) fixed the issue, we will simply update it.

@Diak
Copy link
Author

Diak commented Apr 6, 2016

Ok I understand but when i used Owncloud 8.2 and PHP 5 i didn't have this problem.
Which one of these upgrades caused the problem for me ? Is it owncloud upgrade including Sabre/http upgrade who caused my problem ?

I'am asking because if some day i have to reinstall my raspbian, i need to know which versions of the components i shoud install to avoid issues.

@jswhisperer
Copy link

I'd be keen to hear of some offical Rasbian support for the core.

@derkostka
Copy link
Contributor

Same observed on Nextcloud:
nextcloud/server#1707

@derkostka
Copy link
Contributor

A patch to fix the problem is mentioned here:
nextcloud/server#1707 (comment)

@derkostka
Copy link
Contributor

derkostka commented Jun 11, 2017

New Ticket and PR created, here:

sabre-io/http#77

@staabm
Copy link

staabm commented Jun 12, 2017

just released https://github.com/fruux/sabre-http/releases/tag/4.2.3 which contains a workaround for the 32bit file size problems

@ghost
Copy link

ghost commented Jun 13, 2017

Backref to another issue: #27395

@ghost
Copy link

ghost commented Jun 14, 2017

Created #28133 and requested to update sabre-http to 4.2.3

@derkostka
Copy link
Contributor

Confirmed that sabre-http 4.2.3 fixes the issue. Please merge #28133 so we can solve this ticket.

@ghost
Copy link

ghost commented Jun 22, 2017

Please merge #28133 so we can solve this ticket.

This is no pull request so it can't be merged. Its just a request to update sabre-http to 4.2.3

@lock
Copy link

lock bot commented Aug 2, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants