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

"XSendFile on" or php-apc optimization corrupt files uploaded #5788

Closed
mend0za opened this issue Nov 10, 2013 · 7 comments
Closed

"XSendFile on" or php-apc optimization corrupt files uploaded #5788

mend0za opened this issue Nov 10, 2013 · 7 comments
Labels

Comments

@mend0za
Copy link

mend0za commented Nov 10, 2013

When I use XSendFile optimization as recommended in Operator manual - ownCloud corrupt files. Both in "Encryption on" and "Encryption off" mode.

Workaround : turn off XSendFile optimization(a2dismod xsendfile, remove XSendFile optimization from virtual host config).

I guess, that this issue related to incorrect uploaded file size calculation. Because in WebUI file size always (even XSendFile turned off) as for corrupted one.

Steps to reproduce:

  1. Turn on XSendFile optimize as described at http://doc.owncloud.org/server/5.0/admin_manual/configuration/xsendfile.html
  2. Upload file (gif or pdf) via Linux client
  3. See the file changed on ownCloud webUI. File already corrupted in storage. PDFViewer component failed to open the file.
  4. Download this file to local machine from webUI.
  5. See the difference with original and corrupted one.

Comparing:
$ diff -qs incoming/lmce81.pdf-corrupted LinuxMagazine/lmce81.pdf
Files incoming/lmce81.pdf-corrupted and LinuxMagazine/lmce81.pdf differ

$ ls -lh incoming/lmce81.pdf LinuxMagazine/lmce81.pdf
-rw-r--r-- 1 mend0za mend0za 5.8M Nov 10 10:56 incoming/lmce81.pdf-corrupted
-rw-r--r-- 1 mend0za mend0za 4.4M Nov 25 2010 LinuxMagazine/lmce81.pdf

Client version: 1.4.2-0 on Debian AMD/64

OS: Debian 7.2/amd64 (wheezy), Debian 6.x (squeeze)
Apache: Apache/2.2.22 (Debian) PHP/5.4.4-14+deb7u5 mod_ssl/2.2.22 OpenSSL/1.0.1e mod_perl/2.0.7 Perl/v5.14.2, also Apache/2.2.16 (Debian) PHP/5.3.3-7+squeeze17 with Suhosin-Patch mod_ssl/2.2.16 OpenSSL/0.9.8o
mod_perl/2.0.4 Perl/v5.10.1

PHP: 5.4.4-14+deb7u5 (Debian 7.2), php 5.3 (Debian 6.x), php-apc on

OwnCloud: 6.0.0beta3 (aka git rev 841c622) Reproduced also on ownCloud 5.0.12, 5.0.13, 6.0.0beta1

Turned on XSendFile force to uploaded files corruption (any size).

Apache2.2 with SSL:
<Directory /var/www/owncloud/>
AllowOverride All
SetEnv MOD_X_SENDFILE_ENABLED 1
XSendFile On

$CONFIG = array (
'instanceid' => 'ocf2568e2b73',
'passwordsalt' => '',
'datadirectory' => '/var/www/owncloud/data',
'dbtype' => 'mysql',
'version' => '6.0.0.5',
'dbname' => 'owncloud',
'dbhost' => 'localhost',
'dbtableprefix' => 'oc_',
'dbuser' => 'owncloud',
'dbpassword' => '',
'installed' => true,
'3rdpartyroot' => '/var/www/owncloud/3rdparty',
'3rdpartyurl' => '',
'apps_paths' =>
array (
0 =>
array (
'path' => '/var/www/owncloud/apps',
'url' => '/apps',
'writable' => true,
),
1 =>
array (
'path' => '/var/www/owncloud/apps2',
'url' => '/apps2',
'writable' => false,
),
),
'forcessl' => false,
);

Apps enabled:

  • Deleted Files
  • Encryption
  • ownCloud dependencies info
  • PDF Viewer
  • Share Files
  • Versions

apache error.log :
[Sun Nov 10 14:03:44 2013] [error] [client 204.155.156.31] client denied by server configuration: /var/www/owncloud/data/htaccesstest.txt
[Sun Nov 10 14:17:19 2013] [error] [client 31.182.72.193] Negotiation: discovered file(s) matching request: /var/www/owncloud/apps/files/download (None could be negotiated)., referer: https://host/index.php/apps/files?dir=/

owncloud log:
{"app":"PHP","message":"RecursiveDirectoryIterator::__construct(/var/www/owncloud/data/mend0za/thumbnails/193/): failed to open dir: No such file or directory at /var/www/owncloud/lib/private/files/storage/local.php#44","level":3,"time":"2013-11-10T11:17:00+00:00"}
{"app":"PHP","message":"RecursiveDirectoryIterator::__construct(/var/www/owncloud/data/mend0za/thumbnails/194/): failed to open dir: No such file or directory at /var/www/owncloud/lib/private/files/storage/local.php#44","level":3,"time":"2013-11-10T11:17:02+00:00"}

@mend0za
Copy link
Author

mend0za commented Nov 10, 2013

http://forum.owncloud.org/viewtopic.php?f=14&t=14292 - the same things as described here

@karlitschek
Copy link
Contributor

@bartv2 Can you have a look please?

@MorrisJobke
Copy link
Contributor

I also run in XSendfile issues, but turning off xsendfile works for me. I thought it was most likely related to the encryption app. Has anybody a ownCloud instance with XSendfile switched on?

@bartv2
Copy link
Contributor

bartv2 commented Nov 15, 2013

I looked into this, the XSendfile is sending the encrypted version because it is reading the file on disk.

@karlitschek
Copy link
Contributor

@bartv2 That's awesome :-) Thanks for your help

@DeepDiver1975
Copy link
Member

I looked into this, the XSendfile is sending the encrypted version because it is reading the file on disk.

in case encrpytion is enabled we need to disable XSendfile - right?

@schiesbn

@schiessle
Copy link
Contributor

since @bartv2 patch is merged I assume that the issue is solved. The fix is in OwnCLoud6 RC4, @mend0za please retry the latest RC... If the issue still exists feel free to re-open the ticket.

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

No branches or pull requests

6 participants