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

Out of memory issue with large response #16

Open
jittya opened this issue Aug 19, 2020 · 3 comments
Open

Out of memory issue with large response #16

jittya opened this issue Aug 19, 2020 · 3 comments

Comments

@jittya
Copy link

jittya commented Aug 19, 2020

Out of memory issue with large response

@NicolaVerbeeck
Copy link
Collaborator

Can you provide a bit more details? How large is the response for example? Is it a response you are interested in? If not, you can add it to the blacklist to prevent it being stored on the client.

@jittya
Copy link
Author

jittya commented Sep 1, 2020

this is what i recorded in crash log and response size was around 100MB

com.icapps.niddler.util.Base64.encode
Base64.java, line 158
java.lang.OutOfMemoryError: Failed to allocate a 131787080 byte allocation with 16777216 free bytes and 20MB until OOM

java.lang.StringFactory.newStringFromChars StringFactory.java:218
java.lang.StringFactory.newStringFromBytes StringFactory.java:203
java.lang.StringFactory.newStringFromBytes StringFactory.java:63
com.icapps.niddler.util.Base64.encode Base64.java:158
com.icapps.niddler.util.Base64.encodeUrl Base64.java:130
com.icapps.niddler.util.StringUtil.toString StringUtil.java:30
com.icapps.niddler.core.MessageBuilder.createBody MessageBuilder.java:194
com.icapps.niddler.core.MessageBuilder.initGeneric MessageBuilder.java:178
com.icapps.niddler.core.MessageBuilder.buildMessageJson MessageBuilder.java:85
com.icapps.niddler.core.MessageBuilder.buildMessage MessageBuilder.java:71
com.icapps.niddler.core.Niddler.logResponse Niddler.java:63
com.icapps.niddler.interceptor.okhttp.NiddlerOkHttpInterceptor.intercept NiddlerOkHttpInterceptor.java:209
okhttp3.internal.http.RealInterceptorChain.proceed RealInterceptorChain.kt:100
okhttp3.internal.connection.ConnectInterceptor.intercept ConnectInterceptor.kt:34
okhttp3.internal.http.RealInterceptorChain.proceed RealInterceptorChain.kt:100
okhttp3.internal.cache.CacheInterceptor.intercept CacheInterceptor.kt:82
okhttp3.internal.http.RealInterceptorChain.proceed RealInterceptorChain.kt:100
okhttp3.internal.http.BridgeInterceptor.intercept BridgeInterceptor.kt:83
okhttp3.internal.http.RealInterceptorChain.proceed RealInterceptorChain.kt:100
okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept RetryAndFollowUpInterceptor.kt:76
okhttp3.internal.http.RealInterceptorChain.proceed RealInterceptorChain.kt:100
okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp RealCall.kt:197
okhttp3.internal.connection.RealCall$AsyncCall.run RealCall.kt:502
java.util.concurrent.ThreadPoolExecutor.runWorker ThreadPoolExecutor.java:1133
java.util.concurrent.ThreadPoolExecutor$Worker.run ThreadPoolExecutor.java:607
java.lang.Thread.run Thread.java:761

@NicolaVerbeeck
Copy link
Collaborator

Hmm yes, it is trying to serialize the body to a string form for storing/sending. In this case, you are dropping out because the string is at least 125MiB, which is excessive for storing things on mobile.

I will ponder updates to the client library to prevent responses from running out of memory by truncating/omitting bodies if they are too long. This will need changes in the plugin as well to handle these scenarios.

For now you should probably exclude the requests from being logged in niddler by adding the specific patterns/urls to the blacklist until I find a clean solution for this

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