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 when OkHttp request/response body has huge data(like a video for example) #581

Open
LouisCAD opened this issue Dec 16, 2017 · 2 comments
Assignees
Milestone

Comments

@LouisCAD
Copy link

Hi, I'm uploading video files with an app using OkHttp, and Stetho still tries to allocate the whole video (which was more than 100MB in my case, but could be bigger) in RAM instead of setting a reasonable threshold where it'd just print the size of the request, and maybe the beginning of the request up to the max RAM consumption threshold.

Happened on thread: Thread[StethoWorker-main-730,5,main]
                                                                              java.lang.OutOfMemoryError: Failed to allocate a 8208 byte allocation with 136 free bytes and 136B until OOM, max allowed footprint 201326592, growth limit 201326592
                                                                                  at java.io.BufferedOutputStream.<init>(BufferedOutputStream.java:76)
                                                                                  at java.io.BufferedOutputStream.<init>(BufferedOutputStream.java:59)
                                                                                  at com.facebook.stetho.server.http.LightHttpServer.serve(LightHttpServer.java:46)
                                                                                  at com.facebook.stetho.inspector.DevtoolsSocketHandler.onAccepted(DevtoolsSocketHandler.java:52)
                                                                                  at com.facebook.stetho.server.ProtocolDetectingSocketHandler.onSecured(ProtocolDetectingSocketHandler.java:63)
                                                                                  at com.facebook.stetho.server.SecureSocketHandler.onAccepted(SecureSocketHandler.java:33)
                                                                                  at com.facebook.stetho.server.LazySocketHandler.onAccepted(LazySocketHandler.java:36)
                                                                                  at com.facebook.stetho.server.LocalSocketServer$WorkerThread.run(LocalSocketServer.java:167)
@jasta
Copy link
Contributor

jasta commented Dec 28, 2017

There's sadly no accurate way around this problem given chrome://inspect's protocol. We would have to lie to chrome and tell it that some clamped amount of data was transmitted as we cannot stream or chunk the data over to it in any way. That said, Stetho shouldn't crash so I think we can find some reasonable compromise like just saying "Data truncated at ... bytes".

@jasta jasta added this to the v1.5.1 milestone Dec 28, 2017
@jasta jasta self-assigned this Dec 28, 2017
@jasta
Copy link
Contributor

jasta commented Dec 29, 2017

Looks like someone is partially addressing this in #564.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants