Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

Allow callbacks in nodejs4 kernel #16

Closed
achimnol opened this issue Mar 30, 2016 · 1 comment
Closed

Allow callbacks in nodejs4 kernel #16

achimnol opened this issue Mar 30, 2016 · 1 comment
Labels

Comments

@achimnol
Copy link
Member

Egoing has reported an issue that he could not see the result of the following code:

var 입력한비밀번호 = '1111';
var 소금의크기 = 32;
var 암호화반복횟수 = 10000;
var 암호의길이 = 32;
var crypto = require('crypto');
crypto.randomBytes(소금의크기, function(오류, 소금){
    crypto.pbkdf2(입력한비밀번호, 소금, 암호화반복횟수, 암호의길이, 'sha512', function(오류, 생성된암호){
        console.log(생성된암호.toString('hex'));
    });
});

This is due to the current nodejs kernel just goes through the synchronous part until it sends the execution result and callbacks generated by the user code are executed later.
We need a "blocking" mechanism until all user callbacks finish as well as temporarily removing existing sorna-side callbacks from the event loop.

As the result, I have found a small hacky open source project that uses C++ addon to access uv_run() function, and patched it to implement a blocking call until all callbacks finish:
abbr/deasync#53

Then, I have added unref() / ref() support to zeromq.node project:
JustinTulloss/zeromq.node#503

Now we can implement a proper blocking call for nodejs4 kernel.

@achimnol achimnol added the bug label Mar 30, 2016
@achimnol
Copy link
Member Author

Ooooops... this issue should have been added to lablup/backend.ai-kernels#14 project!

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

No branches or pull requests

1 participant