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

issues with large sets of response payload, even in smaller chunks #986

Open
3 tasks done
brody4hire opened this issue Jun 5, 2020 · 1 comment
Open
3 tasks done

Comments

@brody4hire
Copy link

Bug Report

Problem

I am working on a new plugin for a major customer, with some enhancements to support several hundred megabytes worth of response data. If I would send all of the data at once, the Java code would crash with a JSON memory error. The obvious workaround would be to send the response data in multiple parts, with multiple plugin responses as documented and supported by the API.

But if I would send too many plugin responses, it would still crash with a JSON memory error. I think the cause is that the MAX_PAYLOAD_SIZE value of 500 MB is way too large
here.

I have made github:brodybits/cordova-big-android-response-payload-test as a demo which can be used to reproduce this issue. It will send the responses in 1 MB chunks, which should be no problem. It seems to work consistently stable with 20 native response chunks, memory issues with 400 native response chunks.

I tried reducing MAX_PAYLOAD_SIZE to 16 MB, and it does seem to resolve the crash. But if there are too many plugin responses, I would then see some ugly module warning messages like this:

2020-06-04 23:23:53.703 6741-6741/com.demoapp I/chromium: [INFO:CONSOLE(53)] "Uncaught module cordova/plugin/android/polling not found", source: file:///android_asset/www/cordova.js (53)

and if I don't use background threading, the JavaScript would not see all of the response messages.

A project colleague pointed to the some code which seems to trigger the module not found messages - here.

Here is the original thread on the mailing list.

What is expected to happen?

  • sending large sets of response payload data chunks should just work without crashes and without module not found warning messages

What does actually happen?

  • sending large sets of response payload data, even in smaller chunks, leads to crashes, with both reproduction and analysis given above
  • reducing MAX_PAYLOAD_SIZE as described above does seem to resolve the crash but seems to uncover some other issues as described above

Information

see above

Command or Code

see above

Environment, Platform, Device

  • cordova-android 8.1.0
  • cordova-android from master with MAX_PAYLOAD_SIZE reduced to 16 MB
  • device: Samsung Galaxy SM-G920V with Android version 7.0

Version information

  • cordova-android: 8.1.0 & master
  • Cordova CLI: 9.0.0 (cordova-lib@9.0.1)
  • Cordova plugin: test plugin which is part of the test project described above
  • host: macOS Catalina

Checklist

  • I searched for existing GitHub issues
  • I updated all Cordova tooling to most recent version
  • I included all the necessary information above
@expcapitaldev
Copy link

it is rare issue but still relevant

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

No branches or pull requests

2 participants