Why does Arcgis Runtime for Android download of Preplanned Workflow fail because of unreasonable memory allocations?

664
2
04-10-2018 10:27 AM
NathanMellor
Occasional Contributor

I have some ready preplanned map areas that I decided to try with the runtime 100.2.1 before I do this on a larger scale. 

I below captured the layer errors below upon failure. 

Caused by: java.lang.OutOfMemoryError: Failed to allocate a 710258114 byte allocation with 16777216 free bytes and 40MB until OOM

Why in the world would you be trying to allocate 710 Megabytes?

On a MOBILE DEVICE, no less?

I can only guess that you are trying to allocate enough memory for the entire file. 

Why would that ever be a good idea?

The destination for the file is a folder on disk. 

BUFFERING is a fairly standard practice for downloading a file from disk. There is no way you need 710 megabytes of memory to download a 710 megabyte file. 

You are advertising this preplanned workflow, and I was attracted to all of the benefits. 

Create an offline map—ArcGIS Runtime SDK for Android | ArcGIS for Developers 

But it obviously isn't well coded or well tested. 

Please fix it or provide some workaround, so I don't regret the trust I have placed in ESRI for the 10th time. 

04-09 21:28:45.907 26473-26473/com.crittermap.arcgissample I/BCNActivity: downloadPreplanned Start: Mon Apr 09 21:28:45 PDT 2018
04-09 21:32:52.395 26473-26473/com.crittermap.arcgissample I/BCNActivity: downloadPreplanned Failed: Mon Apr 09 21:32:52 PDT 2018
04-09 21:33:08.028 26473-26473/? E/BCNActivity: layererrors USA Contour II:
com.esri.arcgisruntime.ArcGISRuntimeException: Check getCause() for further error information.
at com.esri.arcgisruntime.internal.m.h.a(SourceFile:188)
at com.esri.arcgisruntime.internal.m.i.b(SourceFile:6220)
at com.esri.arcgisruntime.tasks.offlinemap.DownloadPreplannedOfflineMapResult.getLayerErrors(SourceFile:91)
at com.crittermap.arcgissample.BCNActivity.lambda$downloadPreplannedArea$2$BCNActivity(BCNActivity.java:369)
at com.crittermap.arcgissample.BCNActivity$$Lambda$1.run(Unknown Source)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6776)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1496)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1386)
Caused by: java.lang.OutOfMemoryError: Failed to allocate a 710258114 byte allocation with 16777216 free bytes and 40MB until OOM
at com.esri.arcgisruntime.internal.c.p.c.<init>(SourceFile:56)
at com.esri.arcgisruntime.internal.c.p.g.c(SourceFile:133)
at com.esri.arcgisruntime.internal.d.a.a.i.b(SourceFile:194)
at com.esri.arcgisruntime.internal.d.a.a.i.a(SourceFile:61)
at com.esri.arcgisruntime.internal.d.a.a.c.a(SourceFile:463)
at com.esri.arcgisruntime.internal.d.a.a.c.i(SourceFile:425)
at com.esri.arcgisruntime.internal.d.a.a.n.a(SourceFile:80)
at com.esri.arcgisruntime.internal.d.a.a.n.d(SourceFile:32)
at com.esri.arcgisruntime.internal.d.a.a.c$1.call(SourceFile:131)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:762)
04-09 21:33:08.032 26473-26473/? E/BCNActivity: layererrors MultidirectionalHillshadeToSix:
com.esri.arcgisruntime.ArcGISRuntimeException: Not found
at com.esri.arcgisruntime.internal.m.h.a(SourceFile:188)
at com.esri.arcgisruntime.internal.m.i.b(SourceFile:6220)
at com.esri.arcgisruntime.tasks.offlinemap.DownloadPreplannedOfflineMapResult.getLayerErrors(SourceFile:91)
at com.crittermap.arcgissample.BCNActivity.lambda$downloadPreplannedArea$2$BCNActivity(BCNActivity.java:369)
at com.crittermap.arcgissample.BCNActivity$$Lambda$1.run(Unknown Source)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6776)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1496)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1386)
04-09 21:33:08.035 26473-26473/? E/BCNActivity: layererrors NorthAmericaOSMPackage0325Z:
com.esri.arcgisruntime.ArcGISRuntimeException: Check getCause() for further error information.
at com.esri.arcgisruntime.internal.m.h.a(SourceFile:188)
at com.esri.arcgisruntime.internal.m.i.b(SourceFile:6220)
at com.esri.arcgisruntime.tasks.offlinemap.DownloadPreplannedOfflineMapResult.getLayerErrors(SourceFile:91)
at com.crittermap.arcgissample.BCNActivity.lambda$downloadPreplannedArea$2$BCNActivity(BCNActivity.java:369)
at com.crittermap.arcgissample.BCNActivity$$Lambda$1.run(Unknown Source)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6776)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1496)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1386)
Caused by: java.lang.OutOfMemoryError: Failed to allocate a 136852558 byte allocation with 16777216 free bytes and 54MB until OOM
at com.esri.arcgisruntime.internal.c.p.c.b(SourceFile:182)
at com.esri.arcgisruntime.internal.c.p.g.c(SourceFile:139)
at com.esri.arcgisruntime.internal.d.a.a.i.b(SourceFile:194)
at com.esri.arcgisruntime.internal.d.a.a.i.a(SourceFile:61)
at com.esri.arcgisruntime.internal.d.a.a.c.a(SourceFile:463)
at com.esri.arcgisruntime.internal.d.a.a.c.i(SourceFile:425)
at com.esri.arcgisruntime.internal.d.a.a.n.a(SourceFile:80)
at com.esri.arcgisruntime.internal.d.a.a.n.d(SourceFile:32)
at com.esri.arcgisruntime.internal.d.a.a.c$1.call(SourceFile:131)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:762)

0 Kudos
2 Replies
NathanMellor
Occasional Contributor

To add to that, the OnDemand Workflow doesn't work either, for other reasons I don't understand. 

Error is: Token required.

Hmm, the documentation doesn't say a word about tokens. It appears that they are used internally, so It certainly isn't my fault if it doesn't have a token. 

04-10 19:22:35.213 27903-27903/? I/bcnactivity: ondemand: Error occurred when taking NorthAmericaOSMPackage0325Z offline
Error : Check getCause() for further error information.
04-10 19:22:35.213 27903-27903/? E/BCNActivity: layererrors NorthAmericaOSMPackage0325Z:
com.esri.arcgisruntime.ArcGISRuntimeException: Check getCause() for further error information.
at com.esri.arcgisruntime.internal.m.h.a(SourceFile:188)
at com.esri.arcgisruntime.internal.m.i.b(SourceFile:6220)
at com.esri.arcgisruntime.tasks.offlinemap.GenerateOfflineMapResult.getLayerErrors(SourceFile:82)
at com.crittermap.arcgissample.BCNActivity$8.run(BCNActivity.java:555)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6776)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1496)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1386)
Caused by: com.esri.arcgisruntime.io.JsonEmbeddedException: Token Required.
at com.esri.arcgisruntime.io.JsonEmbeddedException$a.a(SourceFile:179)
at com.esri.arcgisruntime.io.JsonEmbeddedException$a.deserialize(SourceFile:125)
at com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:69)
at com.google.gson.Gson.fromJson(Gson.java:887)
at com.google.gson.Gson.fromJson(Gson.java:852)
at com.google.gson.Gson.fromJson(Gson.java:801)
at com.google.gson.Gson.fromJson(Gson.java:773)
at com.esri.arcgisruntime.io.JsonEmbeddedException.fromJson(SourceFile:117)
at com.esri.arcgisruntime.internal.d.a.a.h.f(SourceFile:699)
at com.esri.arcgisruntime.internal.d.a.a.i.a(SourceFile:161)
at com.esri.arcgisruntime.internal.d.a.a.i.a(SourceFile:60)
at com.esri.arcgisruntime.internal.d.a.a.c.a(SourceFile:463)
at com.esri.arcgisruntime.internal.d.a.a.c.i(SourceFile:425)
at com.esri.arcgisruntime.internal.d.a.a.n.a(SourceFile:80)
at com.esri.arcgisruntime.internal.d.a.a.n.d(SourceFile:32)
at com.esri.arcgisruntime.internal.d.a.a.c$1.call(SourceFile:131)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:762)

0 Kudos
NathanMellor
Occasional Contributor

Still not working.

I have seen this behavior consistently.

I have been in contact with ESRI support, but they are still in denial about this.

0 Kudos