Closed BannerBomb closed 4 years ago
I have played around with it some more. And it also causes a core dump when doing something like
const RE2 = require('re2');
new RE2(/test/).constructor()
And I have found an issue with the properties.
In the images below the first bot with the green avatar(Highlight Testing) is using worker_threads, while the bot with the pink avatar(Highlight) isn't using worker_threads.
result of the source
property.
result of the flags
property.
result of the global
property.
The methods like toString
, exec
test
etc seems fine 👍
Looking at these all of the methods seem to be fine but the RegExp properties are all undefined.
also in reply to this https://github.com/uhop/node-re2/issues/57#issuecomment-581194375 comment, not sure if this helps or if you've seen it but there's some small documentations on implementing worker thread support to a C++ addon. https://nodejs.org/api/addons.html#addons_object_factory starting from here and scrolling down from that page is about factory objects, wrapped functions, and factory wrapped objects https://nodejs.org/api/addons.html#addons_factory_of_wrapped_objects etc
Like almost everybody else I use nan.h
, which supposed to hide API differences between versions yet supporting all features. I'll try to refresh my nan
code first before doing anything drastic.
Thank you for identifying specific problems. It gives me something to start with.
New version: https://github.com/uhop/node-re2/tree/1.12.0
It WFM in workers, yet my worker tests are rather primitive. Please try to verify that it works in your project as well.
Since the previous comment, I found a problem with redefining the constructor in different environments. The constructor was stored in a global. I got rid of it.
New version: https://github.com/uhop/node-re2/tree/1.13.0
Please let me know the results of your testing.
@uhop I've tested all the issues I've posted previously along with a few other things and it seems to be working good now. Thanks. I'll let you know if I come across anything else. Keep up the good work 😄
Hey, I see you have fixed the issue with the worker_threads. However now when using the package without initializing the constructor will cause a core dump.
So first off my node.js version is:
v13.10.1
and RE2 version is1.11.0
A reproducible code is
the 2 above are examples that will cause a core dump. But it will cause the core dump anytime you try to use it without initializing the constructor, and an example of the code that won't cause a core dump is