Android: How to simulate CursorWindowAllocationException crash - android

I want to simulate android.database.CursorWindowAllocationException crash. I am working on a huge codebase with a lot of room database queries in each screen. I am not sure in which database query this crash occurs and in which scenario this crash occurs. So is there any way to simulate this crash? I tried keeping almost 10 database cursors open in a for loop but could not reproduce the crash. I have attached the crashlytics logs for reference.
Fatal Exception: android.database.CursorWindowAllocationException: Cursor window allocation of 2048 kb failed.
at android.database.CursorWindow.<init>(CursorWindow.java:108)
at android.database.AbstractWindowedCursor.clearOrCreateWindow(AbstractWindowedCursor.java:198)
at android.database.sqlite.SQLiteCursor.clearOrCreateWindow(SQLiteCursor.java:309)
at android.database.sqlite.SQLiteCursor.fillWindow(SQLiteCursor.java:147)
at android.database.sqlite.SQLiteCursor.getCount(SQLiteCursor.java:141)
at android.database.AbstractCursor.moveToPosition(AbstractCursor.java:220)
at android.database.AbstractCursor.moveToNext(AbstractCursor.java:269)
at androidx.room.InvalidationTracker$1.checkUpdatedTable(InvalidationTracker.java:461)
at androidx.room.InvalidationTracker$1.run(InvalidationTracker.java:431)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)

The following simulates such a crash (but traps it):-
var lastIndex = 0
try
{
for (i in 0..1999) {
lastIndex = i
val csr: Cursor = db.openHelper.writableDatabase.query(SimpleSQLiteQuery("SELECT * FROM model"))
val count = csr.count.toLong()
}
}catch ( e:java.lang.Exception)
{
Log.d(
"DBEXCEPTION",
"Exception trapped at INDEX " + lastIndex + " Message was " + e.message
)
e.printStackTrace()
}
}
where db is an instance of an #Database annotated class (etc).
0..1999 as 2000 open Cursors should be enough to always fail
note that empty Cursors do not appear to result in a failure and not actually traversing the Cursor in some way doesn't result in the a failure. hence the csr.count.toLong
I suspect that the file underlying the Cursor is created/opened and closed properly by SQLite and it is not until an attempt is made to access the Cursor that the file is actually opened and then left open until the file is closed.
The log will then contain something like:-
2022-09-20 09:48:01.929 E/CursorWindow: CursorWindow: mmap() failed: errno=12.
2022-09-20 09:48:01.930 D/DBEXCEPTION: Exception trapped at INDEX 1415 Message was Could not allocate CursorWindow '/data/user/0/a.a.so73757679kotlinroomuniqueconflict/databases/the_database.db' of size 2097152 due to error -12.
2022-09-20 09:48:01.930 W/System.err: android.database.CursorWindowAllocationException: Could not allocate CursorWindow '/data/user/0/a.a.so73757679kotlinroomuniqueconflict/databases/the_database.db' of size 2097152 due to error -12.
2022-09-20 09:48:01.930 W/System.err: at android.database.CursorWindow.nativeCreate(Native Method)
2022-09-20 09:48:01.930 W/System.err: at android.database.CursorWindow.<init>(CursorWindow.java:139)
2022-09-20 09:48:01.930 W/System.err: at android.database.CursorWindow.<init>(CursorWindow.java:120)
2022-09-20 09:48:01.930 W/System.err: at android.database.AbstractWindowedCursor.clearOrCreateWindow(AbstractWindowedCursor.java:202)
2022-09-20 09:48:01.931 W/System.err: at android.database.sqlite.SQLiteCursor.fillWindow(SQLiteCursor.java:147)
2022-09-20 09:48:01.931 W/System.err: at android.database.sqlite.SQLiteCursor.getCount(SQLiteCursor.java:140)
2022-09-20 09:48:01.931 W/System.err: at android.app.Activity.performCreate(Activity.java:7994)
2022-09-20 09:48:01.931 W/System.err: at android.app.Activity.performCreate(Activity.java:7978)
2022-09-20 09:48:01.931 W/System.err: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309)
2022-09-20 09:48:01.931 W/System.err: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3422)
2022-09-20 09:48:01.931 W/System.err: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601)
2022-09-20 09:48:01.931 W/System.err: at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
2022-09-20 09:48:01.931 W/System.err: at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
2022-09-20 09:48:01.931 W/System.err: at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
2022-09-20 09:48:01.931 W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
2022-09-20 09:48:01.932 W/System.err: at android.os.Handler.dispatchMessage(Handler.java:106)
2022-09-20 09:48:01.932 W/System.err: at android.os.Looper.loop(Looper.java:223)
2022-09-20 09:48:01.932 W/System.err: at android.app.ActivityThread.main(ActivityThread.java:7656)
2022-09-20 09:48:01.932 W/System.err: at java.lang.reflect.Method.invoke(Native Method)
2022-09-20 09:48:01.932 W/System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
2022-09-20 09:48:01.932 W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
2022-09-20 09:48:02.003 W/libc: malloc(4194304) failed: returning null pointer
2022-09-20 09:48:02.003 A/libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x80000 in tid 23176 (RenderThread), pid 23153 (muniqueconflict)
It should be noted that the issue at hand is not exactly the number of Cursors but that underlying a Cursor is a file and that (I believe) the issue is the number of unclosed file allocations of which the database itself will have 3 (for the database, the -wal file and the -shm file).
However, there may also be a memory related issue, as this test then results in the malloc error (failed to get 4Mb).

Related

Ionic app with Intercom plugin fails on startup in Android "java.lang.ClassNotFoundException: io.intercom.android.sdk.IntercomBridge"

I am integrating the Intercom plugin for an existing Ionic 5 application following the instructions here: https://ionicframework.com/docs/native/intercom. Everything works great iOS, but when I start the application in an android simulator, the following exception is thrown and the app terminates.
I am fairly new to android studio/java, so any advice would be greatly appreciated.
D/Capacitor: Starting BridgeActivity
W/System.err: java.lang.ClassNotFoundException: io.intercom.android.sdk.IntercomBridge
W/System.err: at java.lang.Class.classForName(Native Method)
W/System.err: at java.lang.Class.forName(Class.java:454)
W/System.err: at java.lang.Class.forName(Class.java:379)
W/System.err: at org.apache.cordova.PluginManager.instantiatePlugin(PluginManager.java:564)
W/System.err: at org.apache.cordova.PluginManager.getPlugin(PluginManager.java:183)
W/System.err: at org.apache.cordova.PluginManager.startupPlugins(PluginManager.java:108)
W/System.err: at org.apache.cordova.PluginManager.init(PluginManager.java:96)
W/System.err: at com.getcapacitor.cordova.MockCordovaWebViewImpl.init(MockCordovaWebViewImpl.java:58)
W/System.err: at com.getcapacitor.Bridge$Builder.create(Bridge.java:1303)
W/System.err: at com.getcapacitor.BridgeActivity.load(BridgeActivity.java:72)
W/System.err: at com.getcapacitor.BridgeActivity.init(BridgeActivity.java:58)
W/System.err: at com.getcapacitor.BridgeActivity.init(BridgeActivity.java:41)
W/System.err: at com.rkkn.driversseatcoop2.MainActivity.onCreate(MainActivity.java:15)
W/System.err: at android.app.Activity.performCreate(Activity.java:8054)
W/System.err: at android.app.Activity.performCreate(Activity.java:8034)
W/System.err: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1341)
W/System.err: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3666)
W/System.err: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3842)
W/System.err: at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
W/System.err: at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
W/System.err: at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2252)
W/System.err: at android.os.Handler.dispatchMessage(Handler.java:106)
W/System.err: at android.os.Looper.loopOnce(Looper.java:201)
W/System.err: at android.os.Looper.loop(Looper.java:288)
W/System.err: at android.app.ActivityThread.main(ActivityThread.java:7842)
W/System.err: at java.lang.reflect.Method.invoke(Native Method)
W/System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
W/System.err: Caused by: java.lang.ClassNotFoundException: Didn't find class "io.intercom.android.sdk.IntercomBridge" on path: DexPathList[[zip file
dd
[1]: https://ionicframework.com/docs/v5/native/intercom

Can not load data from webservice from the first time

After getting facebook access token, i use it for login in my own web server. However in the first time, there is warning in the log file, and i can not load data from my server, but when i open app from second times, it load normally.
Below is warning log:
W/System.err: com.google.gson.JsonSyntaxException:
java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING
at line 1 column 1 path $ W/System.err: at
com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:224)
W/System.err: at
retrofit2.converter.gson.GsonResponseBodyConverter.convert(GsonResponseBodyConverter.java:39)
W/System.err: at
retrofit2.converter.gson.GsonResponseBodyConverter.convert(GsonResponseBodyConverter.java:27)
W/System.err: at
retrofit2.ServiceMethod.toResponse(ServiceMethod.java:122)
W/System.err: at
retrofit2.OkHttpCall.parseResponse(OkHttpCall.java:217) W/System.err:
at retrofit2.OkHttpCall.execute(OkHttpCall.java:180) W/System.err:
at
retrofit2.adapter.rxjava2.CallExecuteObservable.subscribeActual(CallExecuteObservable.java:42) W/System.err: at
io.reactivex.Observable.subscribe(Observable.java:12084) W/System.err:
at
retrofit2.adapter.rxjava2.BodyObservable.subscribeActual(BodyObservable.java:34)
W/System.err: at
io.reactivex.Observable.subscribe(Observable.java:12084) W/System.err:
at
io.reactivex.internal.operators.observable.ObservableSingleSingle.subscribeActual(ObservableSingleSingle.java:35)
W/System.err: at io.reactivex.Single.subscribe(Single.java:3433)
W/System.err: at
io.reactivex.internal.operators.single.SingleDoOnSuccess.subscribeActual(SingleDoOnSuccess.java:35)
W/System.err: at io.reactivex.Single.subscribe(Single.java:3433)
W/System.err: at
io.reactivex.internal.operators.single.SingleSubscribeOn$SubscribeOnObserver.run(SingleSubscribeOn.java:89)
W/System.err: at
io.reactivex.Scheduler$DisposeTask.run(Scheduler.java:579)
W/System.err: at
io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:66)
W/System.err: at
io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:57)
W/System.err: at
java.util.concurrent.FutureTask.run(FutureTask.java:266) W/System.err:
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
W/System.err: at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
W/System.err: at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
W/System.err: at java.lang.Thread.run(Thread.java:764)
W/System.err: Caused by: java.lang.IllegalStateException: Expected
BEGIN_OBJECT but was STRING at line 1 column 1 path $ W/System.err:
at com.google.gson.stream.JsonReader.beginObject(JsonReader.java:385)
W/System.err: at
com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:213)
What could be causing this?
That error tells you that there is an error when GSON tries to parse the JSON returned by the web service you're calling. In particular, GSON is expecting a JSON object, but it receives a string (see the first line of the error message).
If the error happens only the first time you call it and not the second it means that the web service returns 2 different answers, and GSON can correctly parse the second one, but not the first one.
In order to find out what's wrong, you should provide more details, like your data model and the 2 responses returned by the web service.

Android android.permission.INTERACT_ACROSS_USERS warning when finishing activity

My app's service starts activity in LockScreen(android:showOnLockScreen="true" option in Manifests.xml).
The LockScreen activity sets onTouch listener.
In onTouch, it calls finish() to close activity
This finish() function incurs warning message 'requires android.permission.INTERACT_ACROSS_USERS'
How to solve it?
Following is Manifests.xml
<service android:name=".LockScreenService" />
<activity android:name=".LockScreenActivity"
android:showOnLockScreen="true"
android:launchMode="singleInstance"
android:theme="#style/AppThemeNoAction">
</activity>
Following is Lockscreen activity onTouch Source
#Override
public boolean onTouch(View v, MotionEvent event) {
finish()
}
Following is warning log
W/System.err: java.lang.SecurityException: Permission Denial: getCurrentUser() from pid=20053, uid=10216 requires android.permission.INTERACT_ACROSS_USERS
W/System.err: at android.os.Parcel.readException(Parcel.java:1958)
W/System.err: at android.os.Parcel.readException(Parcel.java:1904)
W/System.err: at android.sec.clipboard.IClipboardService$Stub$Proxy.isEnabled(IClipboardService.java:757)
W/System.err: at com.example.android.content.clipboard.SemClipboardManager.isEnabled(SemClipboardManager.java:1008)
W/System.err: at android.widget.TextView.getSecClipboardEnabled(TextView.java:16133)
W/System.err: at android.widget.TextView.onDetachedFromWindowInternal(TextView.java:7178)
W/System.err: at android.view.View.dispatchDetachedFromWindow(View.java:18645)
W/System.err: at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3878)
I/chatty: uid=10216(u0_a216) com.example.lockscreen identical 4 lines
W/System.err: at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3878)
W/System.err: at android.view.ViewRootImpl.dispatchDetachedFromWindow(ViewRootImpl.java:4001)
W/System.err: at android.view.ViewRootImpl.doDie(ViewRootImpl.java:7267)
W/System.err: at android.view.ViewRootImpl.die(ViewRootImpl.java:7244)
W/System.err: at android.view.WindowManagerGlobal.removeViewLocked(WindowManagerGlobal.java:483)
W/System.err: at android.view.WindowManagerGlobal.removeView(WindowManagerGlobal.java:421)
W/System.err: at android.view.WindowManagerImpl.removeViewImmediate(WindowManagerImpl.java:131)
W/System.err: at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:4643)
W/System.err: at android.app.ActivityThread.-wrap5(Unknown Source:0)
W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1757)
W/System.err: at android.os.Handler.dispatchMessage(Handler.java:105)
W/System.err: at android.os.Looper.loop(Looper.java:164)
W/System.err: at android.app.ActivityThread.main(ActivityThread.java:6938)
06-19 10:30:50.615 20053-20053/com.example.lockscreen W/System.err: at java.lang.reflect.Method.invoke(Native Method)
W/System.err: at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
W/System.err: java.lang.SecurityException: Permission Denial: getCurrentUser() from pid=20053, uid=10216 requires android.permission.INTERACT_ACROSS_USERS
W/System.err: at android.os.Parcel.readException(Parcel.java:1958)
W/System.err: at android.os.Parcel.readException(Parcel.java:1904)
W/System.err: at android.sec.clipboard.IClipboardService$Stub$Proxy.isEnabled(IClipboardService.java:757)
W/System.err: at com.example.android.content.clipboard.SemClipboardManager.isEnabled(SemClipboardManager.java:1008)
W/System.err: at android.widget.TextView.getSecClipboardEnabled(TextView.java:16133)
W/System.err: at android.widget.TextView.onDetachedFromWindowInternal(TextView.java:7178)
W/System.err: at android.view.View.dispatchDetachedFromWindow(View.java:18645)
W/System.err: at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3878)
I/chatty: uid=10216(u0_a216) com.example.lockscreen identical 4 lines
W/System.err: at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3878)
W/System.err: at android.view.ViewRootImpl.dispatchDetachedFromWindow(ViewRootImpl.java:4001)
W/System.err: at android.view.ViewRootImpl.doDie(ViewRootImpl.java:7267)
W/System.err: at android.view.ViewRootImpl.die(ViewRootImpl.java:7244)
W/System.err: at android.view.WindowManagerGlobal.removeViewLocked(WindowManagerGlobal.java:483)
W/System.err: at android.view.WindowManagerGlobal.removeView(WindowManagerGlobal.java:421)
W/System.err: at android.view.WindowManagerImpl.removeViewImmediate(WindowManagerImpl.java:131)
W/System.err: at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:4643)
W/System.err: at android.app.ActivityThread.-wrap5(Unknown Source:0)
W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1757)
W/System.err: at android.os.Handler.dispatchMessage(Handler.java:105)
W/System.err: at android.os.Looper.loop(Looper.java:164)
W/System.err: at android.app.ActivityThread.main(ActivityThread.java:6938)
06-19 10:30:50.617 20053-20053/com.example.lockscreen W/System.err: at java.lang.reflect.Method.invoke(Native Method)
W/System.err: at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
D/ViewRootImpl#bee7239[LockScreenActivity]: dispatchDetachedFromWindow
D/InputEventReceiver: channel '7c33270 com.example.lockscreen/com.example.lockscreen.LockScreenActivity (client)' ~ Disposing input event receiver.
D/InputEventReceiver: channel '7c33270 com.example.lockscreen/com.example.lockscreen.LockScreenActivity (client)' ~NativeInputEventReceiver.
Higher than target API 23 versions, the application gets permission with popup-window. Did you get a permission with popup-window?
EDIT:
You can use checkSelfPermission() and requestPermissions() to check permission or get permission.

EOFException is thrown when reading contents of an ePub file

I'm trying to read the contents of an ePub file using the library epublib and this example demonstrates that.
For me, an exception is thrown when loading the book from the input stream
// Load Book from inputStream
Book book = (new EpubReader()).readEpub(epubInputStream);
Not sure why the code isn't working and the exception is thrown for me? It has worked for other users of the StackOverflow.
Full Stack trace is shared below:
W/System.err: java.io.EOFException
W/System.err: at libcore.io.Streams.readFully(Streams.java:83)
W/System.err: at java.util.zip.ZipInputStream.getNextEntry(ZipInputStream.java:235)
W/System.err: at nl.siegmann.epublib.epub.EpubReader.readResources(EpubReader.java:184)
W/System.err: at nl.siegmann.epublib.epub.EpubReader.readEpub(EpubReader.java:94)
W/System.err: at nl.siegmann.epublib.epub.EpubReader.readEpub(EpubReader.java:53)
W/System.err: at nl.siegmann.epublib.epub.EpubReader.readEpub(EpubReader.java:37)
W/System.err: at com.blogspot.gsrikar.ePubViewerActivity.readEPubContents(ePubViewerActivity.java:102)
W/System.err: at com.blogspot.gsrikar.ePubViewerActivity.onCreate(ePubViewerActivity.java:88)
W/System.err: at android.app.Activity.performCreate(Activity.java:6904)
W/System.err: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1136)
W/System.err: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3266)
W/System.err: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3415)
W/System.err: at android.app.ActivityThread.-wrap17(ActivityThread.java)
W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1821)
W/System.err: at android.os.Handler.dispatchMessage(Handler.java:102)
W/System.err: at android.os.Looper.loop(Looper.java:148)
W/System.err: at android.app.ActivityThread.main(ActivityThread.java:7325)
W/System.err: at java.lang.reflect.Method.invoke(Native Method)
W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
EOFException is thrown:
if there is no data in a stream but you are trying to read.. eg read
methods of chain streams like DataInputStream, ObjectInputStream
throw EOFException if they are trying to read from FileInputStream
but the FileInputStream is empty or
if the formats are not matching...eg if int is present and you are
using readFloat() of DataInputStream
You should try calling below method before passing it to readEpub.
Java Doc link : http://docs.oracle.com/javase/7/docs/api/java/io/InputStream.html#available()
//assuming the above variables are already declared.
if(epubInputStream.available() > 0)
Book book = (new EpubReader()).readEpub(epubInputStream);
else
System.out.println("no data to read");

Volley SSL error when uploading a file larger than 1mb (I/O error during system call, Connection reset by peer)

I tried adding a retry policy (https://stackoverflow.com/a/22169775/2098493)
but the error persist when file being uploaded is larger than 1mb.
W/System.err: com.android.volley.NoConnectionError: javax.net.ssl.SSLException: Write error: ssl=0xafc3fe00: I/O error during system call, Connection reset by peer
W/System.err: at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:151)
W/System.err: at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:112)
W/System.err: Caused by: javax.net.ssl.SSLException: Write error: ssl=0xafc3fe00: I/O error during system call, Connection reset by peer
W/System.err: at com.android.org.conscrypt.NativeCrypto.SSL_write(Native Method)
W/System.err: at com.android.org.conscrypt.OpenSSLSocketImpl$SSLOutputStream.write(OpenSSLSocketImpl.java:765)
W/System.err: at com.android.okio.Okio$1.write(Okio.java:70)
W/System.err: at com.android.okio.RealBufferedSink.emitCompleteSegments(RealBufferedSink.java:116)
W/System.err: at com.android.okio.RealBufferedSink.write(RealBufferedSink.java:44)
W/System.err: at com.android.okhttp.internal.http.RetryableSink.writeToSocket(RetryableSink.java:77)
W/System.err: at com.android.okhttp.internal.http.HttpConnection.writeRequestBody(HttpConnection.java:240)
W/System.err: at com.android.okhttp.internal.http.HttpTransport.writeRequestBody(HttpTransport.java:77)
W/System.err: at com.android.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:622)
W/System.err: at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:388)
W/System.err: at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:332)
W/System.err: at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:500)
W/System.err: at com.android.okhttp.internal.http.DelegatingHttpsURLConnection.getResponseCode(DelegatingHttpsURLConnection.java:105)
W/System.err: at com.android.okhttp.internal.http.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:25)
W/System.err: at com.android.volley.toolbox.HurlStack.performRequest(HurlStack.java:110)
W/System.err: at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:96)
Thanks for your advice.
The solution was a combination of adding Volley Retry Policy and making sure back-end and server (nodejs/nginx) max uploaded file size are both set correctly.
//where RETRY_DEFAULT_TIMEOUT_MS = 5000, RETRY_DEFAULT_MAX_RETRIES = 3, RETRY_DEFAULT_BACKOFF_MULT = 2.0f
request.setRetryPolicy(new DefaultRetryPolicy(RETRY_DEFAULT_TIMEOUT_MS,
RETRY_DEFAULT_MAX_RETRIES,
RETRY_DEFAULT_BACKOFF_MULT));

Categories

Resources