LiquidPlayer / LiquidCore

Node.js virtual machine for Android and iOS
MIT License
1.02k stars 128 forks source link

Error while running code in Xcode. #97

Closed A-P-Singh closed 5 years ago

A-P-Singh commented 5 years ago

Hi , Same code is working fine with Android but when I run my bundle file file in Xcode , I am getting below error: FIXME! Isolate::ReportExternalAllocationLimitReached() FIXME! Isolate::ReportExternalAllocationLimitReached() FIXME! Isolate::ReportExternalAllocationLimitReached() FIXME! Isolate::ReportExternalAllocationLimitReached() FIXME! Isolate::ReportExternalAllocationLimitReached() FIXME! Isolate::ReportExternalAllocationLimitReached() FIXME! Isolate::ReportExternalAllocationLimitReached() FIXME! Isolate::ReportExternalAllocationLimitReached() FIXME! Isolate::ReportExternalAllocationLimitReached() FIXME! Isolate::ReportExternalAllocationLimitReached() FIXME! Isolate::ReportExternalAllocationLimitReached() FIXME! Isolate::ReportExternalAllocationLimitReached() FIXME! Isolate::ReportExternalAllocationLimitReached() LiquidCore was compiled with optimization - stepping may behave oddly; variables may not be available. (lldb) error: empty command (lldb)

My guess is because of below library I am getting above error const zlib = require('zlib'); Please suggest me the solutions.

A-P-Singh commented 5 years ago

Second thing , is why I am not able to install latest version on liquidCore-cli in javascript code . When I specify version in package.json file and do npm install, Like I did in below example , I am getting Error . Example: "dependencies": { "babel-preset-env": "^1.7.0", "liquidcore-cli": "^0.6.0", "react-native": "0.56.0" }, Error: npm ERR! code ETARGET npm ERR! notarget No matching version found for liquidcore-cli@^0.6.0 npm ERR! notarget In most cases you or one of your dependencies are requesting npm ERR! notarget a package version that doesn't exist. npm ERR! notarget

Please help in this also :)

ericwlange commented 5 years ago

On the second point, I am not sure what happened but liquidcore-cli should not be version ^0.6.0, it should be ^0.4.7. You can edit it manually in your package.json and run npm install.

As for the first issue, let me look at it. I've never attempted to use zlib, so that is probably the source of the bug.

ericwlange commented 5 years ago

Can you give me a quick example of what you are doing with zlib so I can try to replicate it?

The error message you quote above is related to external memory allocation. Before 0.6.0, I wasn't allocating any external memory, as I didn't know what it was used for. But then issue #82 was filed that had this error message. Adding 512k of external memory fixed it, but that was an arbitrary amount. zlib most likely requires more, but how much more I am not sure. I need to see what V8 does in this situation.

A-P-Singh commented 5 years ago

Please take look of some peace of my code:

const https = require('https');
const zlib = require('zlib');

var req = https.request(options, function(res) { 
var buffers = [];
res.pipe(zlib.createGunzip()).on('data', function(chunk) {
  buffers.push(chunk);
}).on('end', function() {
  console.log('------res-----',Buffer.concat(buffers).toString());
})

I hope its enough for reproducing the issue.

ericwlange commented 5 years ago

ok, I will check it out. But quick thing to test to see if this is the problem. Change line 203 of LiquidCoreiOS/LiquidCore/node-8.9.3/V82JSC/Isolate.cpp to something larger, like 1024 or 2048. Keep increasing it and see if there is an amount that makes the issue go away. I will then see what the appropriate amount should be.

ericwlange commented 5 years ago

I just scanned through the V8 code, and it appears that V8 uses 64 MB as its allocation limit. So try changing line 203 of Isolate.cpp to:

#define EXTERNAL_MEMORY_SIZE (64 *1024 * 1024)

That seems like an awfully large number, but if that is shared amongst all isolates, then it is manageable. At the moment, I allocate the memory per-isolate, but can change that.

Let me know if this change solves the problem and I can then get it into 0.6.1, which I was getting ready to roll out by end of week.

A-P-Singh commented 5 years ago

I am using Carthage (0.5.1) for running my bundler file with IOS . When I use pod then I am also getting https://github.com/LiquidPlayer/LiquidCore/issues/98 Error.

So now I am fully blocked :( Because my code is not working without carthage and if I use carthage then I am getting this memory leak error . Please find the attachment of exact error.

Screen Shot 2019-04-23 at 3 11 00 PM

Can you please suggest me any quick solution or please fix these both issue in 0.6.1 and release is ASAP .

ericwlange commented 5 years ago

Ah yes. You need to upgrade to 0.6.0. All these bugs are already fixed there. I didn't realize you were on 0.5.1.

I have dropped support for Carthage and don't intend to resupport it.

On Tue, Apr 23, 2019, 11:43 AM A-P-Singh notifications@github.com wrote:

I am using Carthage (0.5.1) for running my bundler file with IOS . When I use pod then I am also getting #98 https://github.com/LiquidPlayer/LiquidCore/issues/98 Error.

So now I am fully blocked :( Because my code is not working without carthage and if I use carthage then I am getting this memory leak error . Please find the attachment of exact error. [image: Screen Shot 2019-04-23 at 3 11 00 PM] https://user-images.githubusercontent.com/22491079/56571295-40720180-65da-11e9-8e94-8c37768a9558.png

Can you please suggest me any quick solution or please fix these both issue in 0.6.1 and release is ASAP .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/LiquidPlayer/LiquidCore/issues/97#issuecomment-485731034, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJC4ZATSCWXAO5W6R5D4C3PR3K2PANCNFSM4HHUQ5HA .

ericwlange commented 5 years ago

0.6.1 has been pushed. Hopefully all of your issues are resolved with it. Cheers.