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

"RangeError: Maximum call stack size exceeded" on Raspberry Pi #2

Closed
julianlam opened this issue Feb 20, 2014 · 3 comments
Closed

"RangeError: Maximum call stack size exceeded" on Raspberry Pi #2

julianlam opened this issue Feb 20, 2014 · 3 comments

Comments

@julianlam
Copy link

Using bcryptjs 0.7.10, we are experiencing troubles using .hash() and .compare() on the Raspberry Pi.

Specifically, the operation crashes with a RangeError: Maximum call stack size exceeded error, but before it does that, it churns for about 2 minutes, and then outputs 100+ of these:

(node) warning: Recursive process.nextTick detected. This will break in the next version of node. Please use setImmediate for recursive deferral.

Of note: Ghost has run into this issue as well (they ran into it 4 months ago when they switched from bcrypt-nodejs to bcryptjs), but they don't exhibit the same errors, the hashing/comparing process just takes a really long time.

In both cases, a simple npm i bcrypt followed by replacing all instances of require('bcryptjs'); with require('bcrypt'); is an acceptable workaround, although people are left wondering why a pure JS implementation of bcrypt would take several orders of magnitude longer to hash or compare a password than a native implementation.

@dcodeIO
Copy link
Owner

dcodeIO commented Feb 20, 2014

I have changed the asynchronous behaviour to use setImmediate if available. Regarding computation time this is either related to the low level implementation used, which is not mine, or, more likely, a thing that JavaScript simply isn't nearly as good at as native code.

See also: https://github.com/dcodeIO/bcrypt.js/blob/master/src/bcrypt.js#L315

@julianlam
Copy link
Author

Thanks for the quick response @dcodeIO! Will report back soon with results.

@julianlam
Copy link
Author

Apparently, "soon" means "1 month". Anyhow, trying it again:

npm install bcryptjs@latest got me 0.7.12, which is right. The error no longer occurs on .compare() or .hash(), so 👍

The hashing process still doesn't complete on the RPi, but I suppose there's nothing you can do about that.

@dcodeIO dcodeIO added bug and removed resolved labels Jun 8, 2014
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