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

Fix dropbox storage to not store the whole file in memory #23272

Merged
merged 1 commit into from
Mar 17, 2016

Conversation

PVince81
Copy link
Contributor

Since the library can only store the full response in memory on
download, we use an alternate client lib and set the correct headers to
be able to stream the content to a temp file.

Note: I had to patch the library and also note that the library is unmaintained and that we should really find some time to update to a better library... #13841

Similar approach like for GDrive.

Fixes #4040

Please review @LukasReschke @icewind1991 @Xenopathic

@PVince81 PVince81 added this to the 9.1-current milestone Mar 15, 2016
@mention-bot
Copy link

By analyzing the blame information on this pull request, we identified @Xenopathic, @icewind1991 and @realriot to be potential reviewers

@enoch85
Copy link
Member

enoch85 commented Mar 15, 2016

Will this be backported?


$client = \OC::$server->getHTTPClientService()->newClient();
try {
$tmpFile = \OC::$server->getTempManager()->getTemporaryFile($ext);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see $ext defined in fopen at this point

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So maybe just getTemporaryFile?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, copy-paste fail...

@PVince81
Copy link
Contributor Author

Possibly 9.0.1

@PVince81 PVince81 force-pushed the dropbox-downloadnotthefullfileinmemory branch from 2877dbe to f708310 Compare March 15, 2016 16:37
@PVince81
Copy link
Contributor Author

Looks like that breaks unit tests.
At least when running them locally, they look much worse than #19868

@PVince81
Copy link
Contributor Author

Failing tests related to encoding, let's find out how much more we need to encode.

Since the library can only store the full response in memory on
download, we use an alternate client lib and set the correct headers to
be able to stream the content to a temp file.
@PVince81 PVince81 force-pushed the dropbox-downloadnotthefullfileinmemory branch from f708310 to ab50ba7 Compare March 15, 2016 17:05
@PVince81
Copy link
Contributor Author

I removed the $ext in the wrong file 😞

@PVince81
Copy link
Contributor Author

Ok, now it's giving the same old failures we already had in #19868

@@ -196,7 +196,7 @@ private function getOAuthBaseParams() {
* @return array Array for request's headers section like
* array('Authorization' => 'OAuth ...');
*/
private function getOAuthHeader($uri, $params, $method = 'GET', $oAuthParams = null) {
public function getOAuthHeader($uri, $params, $method = 'GET', $oAuthParams = null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we list changes made to 3rdparty things somewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in general I'd agree, but @LukasReschke told me we already super-patched this lib before due to security issues.
Maybe I can try and track down his changes and add them to "patch.txt" too

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in general I'd agree, but @LukasReschke told me we already super-patched this lib before due to security issues.

… the library was patched before that already as well … it's a nightmare 🙈 … also unmaintained upstream so we can't copy new releases over.

I'd just do 🙈 here and hope that at some point we switch to the proper Dropbox SDK.

@PVince81
Copy link
Contributor Author

So can I get your thumbs up @icewind1991 @LukasReschke ?

@karlitschek backport to 9.0.1 ? (another memory issue, for dropbox download)

@karlitschek
Copy link
Contributor

great. please backport

@LukasReschke
Copy link
Member

👍

1 similar comment
@icewind1991
Copy link
Contributor

👍

@PVince81
Copy link
Contributor Author

stable9: #23372

DeepDiver1975 added a commit that referenced this pull request Mar 17, 2016
…einmemory

Fix dropbox storage to not store the whole file in memory
@DeepDiver1975 DeepDiver1975 merged commit 0bc51b9 into master Mar 17, 2016
@DeepDiver1975 DeepDiver1975 deleted the dropbox-downloadnotthefullfileinmemory branch March 17, 2016 19:52
@enoch85
Copy link
Member

enoch85 commented Mar 17, 2016

Thanks!

@lock
Copy link

lock bot commented Aug 6, 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 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[External storage - Dropbox] Allowed memory size exhausted
7 participants