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

OutOfMemory Exception on 35MB File Upload #114

Closed
quantum0813 opened this issue Apr 19, 2016 · 5 comments
Closed

OutOfMemory Exception on 35MB File Upload #114

quantum0813 opened this issue Apr 19, 2016 · 5 comments
Assignees
Labels
android bug Acknowledged bug which is seen in Upload Service, but it's caused by an underlying Android Bug

Comments

@quantum0813
Copy link

quantum0813 commented Apr 19, 2016

I am getting an OutOfMemory exception when trying to upload a 35MB file. This is occurring on a Samsung Galaxy S5 running Android 4.4.2. Here is the stack trace:

E/dalvikvm-heap(10845): Out of memory on a 33550500-byte allocation.
I/dalvikvm(10845): "pool-3-thread-1" prio=5 tid=27 RUNNABLE
I/dalvikvm(10845):   | group="main" sCount=0 dsCount=0 obj=0x42e8e1c8 self=0x7a90c0e0
I/dalvikvm(10845):   | sysTid=12717 nice=0 sched=0/0 cgrp=apps handle=2056308024
I/dalvikvm(10845):   | state=R schedstat=( 347603340 78194787 397 ) utm=21 stm=13 core=3
I/dalvikvm(10845):   at java.io.ByteArrayOutputStream.expand(ByteArrayOutputStream.java:~91)
I/dalvikvm(10845):   at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:201)
I/dalvikvm(10845):   at com.android.okhttp.internal.http.RetryableOutputStream.write(RetryableOutputStream.java:64)
I/dalvikvm(10845):   at net.gotev.uploadservice.a.a.b.a(HurlStackConnection.java:75)
I/dalvikvm(10845):   at net.gotev.uploadservice.f.a(HttpUploadTask.java:205)
I/dalvikvm(10845):   at net.gotev.uploadservice.m.c(MultipartUploadTask.java:128)
I/dalvikvm(10845):   at net.gotev.uploadservice.m.a(MultipartUploadTask.java:61)
I/dalvikvm(10845):   at net.gotev.uploadservice.f.a(HttpUploadTask.java:149)
I/dalvikvm(10845):   at net.gotev.uploadservice.f.run(HttpUploadTask.java:100)
I/dalvikvm(10845):   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
I/dalvikvm(10845):   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
I/dalvikvm(10845):   at java.lang.Thread.run(Thread.java:841)
@gotev
Copy link
Owner

gotev commented Apr 19, 2016

  1. Can you sistematically replicate this behaviour every time with the same file?
  2. Android 4.4.2 uses OkHttp 1.5 internally to provide HttpUrlConnection implementation. That's pretty old. Try to switch to OkHttp stack implementation (which uses OkHttp 3.2.0), by following this guide, without changing anything else and tell me if you still have the same behaviour

@gotev
Copy link
Owner

gotev commented Apr 20, 2016

@quantum0813 I think the problem is exactly the same reported here. It's a bug in the old OkHttp implementation used by Android 4.4, which has been fixed, so try to switch the http stack as I've described and let me know. If you target multiple android versions, then I definitely advise you to do that, to have a consistent networking behaviour.

@gotev gotev added the support Issue which has become more of a StackOverflow or a blog post label Apr 20, 2016
@gotev gotev self-assigned this Apr 20, 2016
@gotev gotev added android bug Acknowledged bug which is seen in Upload Service, but it's caused by an underlying Android Bug workaround available and removed support Issue which has become more of a StackOverflow or a blog post labels Apr 20, 2016
@quantum0813
Copy link
Author

Thanks for your quick reply. I have updated my app to use the OkHttp stack implementation. I'll do some more testing, and report back.

@gotev
Copy link
Owner

gotev commented Apr 27, 2016

@quantum0813 are your tests successful?

@gotev
Copy link
Owner

gotev commented May 3, 2016

Closing due to lack of feedback. Made some tests with the proposed solution, and the problem doesn't occur. Read this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android bug Acknowledged bug which is seen in Upload Service, but it's caused by an underlying Android Bug
Projects
None yet
Development

No branches or pull requests

2 participants