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

Reconsider adding ob_end_clean() in remote.php for files app #16013

Closed
LukasReschke opened this issue May 2, 2015 · 8 comments · Fixed by #16042
Closed

Reconsider adding ob_end_clean() in remote.php for files app #16013

LukasReschke opened this issue May 2, 2015 · 8 comments · Fixed by #16042
Milestone

Comments

@LukasReschke
Copy link
Member

@karlitschek has requested why we have an hard dependency on output_buffering set to off with ownCloud 8.1 – thus I investigated it a little bit.

This check has been introduced since our documentation, the SabreDAV documentation as well as @evert in https://github.com/fruux/sabre-dav/pull/331#issuecomment-16945953 claim that output_buffering should be disabled, without this PHP will return memory-related errors and we might effectively risk data loss or integrity loss issues.

This indeed makes sense to me but we should reconsider if there is another way to address this issue, I stumbled upon ob_end_flush and ob_end_clean which we could just add to our remote.php file of the files app.

A little digging in our source showed me that @icewind1991 introduced this already once for stable45 in #576 and it was indeed there until ownCloud 7 where @DeepDiver1975 removed it with 79fc4f3, the commit message states:

Within OC:init() the minimum set of apps is loaded - which is filesystem, authentication and logging

This looks rather unrelated. @DeepDiver1975 do you remind why you removed it? I suspect you assumed that it was removed by mistake since the code was undocumented?

cc @evert I'd greatly appreciate if you can lend us your expertise once more on this. Just a short "yes that should work" or a "kittens will die – don't try it" would be a great guidance since you are obviously the SabreDAV expert 😄
cc @DeepDiver1975 @karlitschek

@LukasReschke LukasReschke added this to the 8.1-current milestone May 2, 2015
@LukasReschke
Copy link
Member Author

(that said webservers that respect the .htaccess or our .user.ini are fine since we set this value ourselves)

@karlitschek
Copy link
Contributor

I´m not arguing that output buffering should be disabled. Possible that this is a good idea.
But we should at least first try to disable it automatically with ini_set before be block the complete owncloud. The default in most installations is output buffering on.
This means that owncloud will stop working for a huge number of users when upgrading to 8.1
We can´t do this.

@LukasReschke Can you check if this is possible to disable it with ini_set and only block if this is not possible?
And even then we have to discuss if we a full block is really the bestfrom a user experience perspective or if the admin page is better

@LukasReschke
Copy link
Member Author

Well - the way to go as described in the ticket is that @DeepDiver1975 and @icewind1991 explain the changes they did to the OB handling in remote.php - if it is as simple as re-adding it we can just re-add this...

@evert
Copy link

evert commented May 3, 2015

The reason output buffering needs to be off is simple. The purpose of the feature is to put the entire HTTP response into memory before sending it to the client.

So if your HTTP response is massive, the entire file goes into memory. This means if you have a big file, you can drag down an entire server.

Frankly it's completely baffling to me why anyone would pick it as the default setting, like ubuntu does. It should be treated as a bug.

@karlitschek
Copy link
Contributor

@evert understood. Or we try to switch it off.
The UTF-8 ini_set PR worked brilliantly by the way.

@LukasReschke
Copy link
Member Author

output_buffering cannot be set via ini_set. It is PHP_INI_PERDIR.

@DeepDiver1975
Copy link
Member

This looks rather unrelated. @DeepDiver1975 do you remind why you removed it? I suspect you assumed that it was removed by mistake since the code was undocumented?

✔️ unrelated ❓
✔️ no clue why I removed that
✔️ most probably by mistake

LukasReschke added a commit that referenced this issue May 4, 2015
This removes the hard-dependency on output buffering as requested at #16013 since a lot of distributions such as Debian and Ubuntu decided to use `4096` instead of the PHP recommended and documented default value of `off`.

However, we still should encourage disabling this setting for improved performance and reliability thus the setting switches in `.user.ini` and `.htaccess` are remaining there. It is very likely that we in other cases also should disable the output buffering but aren't doing it everywhere and thus causing memory problems.

Fixes #16013
@LukasReschke
Copy link
Member Author

Let's re-add this then and remove the check for now and hope it doesn't bite us at other places were we handle files stuff => #16042

mmattel pushed a commit to mmattel/core that referenced this issue May 22, 2015
This removes the hard-dependency on output buffering as requested at owncloud#16013 since a lot of distributions such as Debian and Ubuntu decided to use `4096` instead of the PHP recommended and documented default value of `off`.

However, we still should encourage disabling this setting for improved performance and reliability thus the setting switches in `.user.ini` and `.htaccess` are remaining there. It is very likely that we in other cases also should disable the output buffering but aren't doing it everywhere and thus causing memory problems.

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

Successfully merging a pull request may close this issue.

4 participants