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

Nan::ObjectWrap::Unref(): Assertion `!persistent().IsWeak()' failed. #142

Open
tbranyen opened this issue Aug 18, 2021 · 3 comments
Open

Comments

@tbranyen
Copy link

This error happens when I call the list() function on a 1s interval poll. I do this to ensure that the camera is still connected and detect if new cameras have been added. Doing this causes a crash consistently:

18:38:56 0|index  | node /home/tim/git/remote-camera-control/server/index.js: ../../nan/nan_object_wrap.h:109: virtual void Nan::ObjectWrap::Unref(): Assertion `!persistent().IsWeak()' failed.

Commenting out the following line prevents the fatal exception from being raised. I suspect this indicates a race condition around dereferencing. Will dig and see if there is a way to safely guard around this as it's pretty annoying to have the Node process hard crash.

@tbranyen
Copy link
Author

Some logs right before the crash:

19:07:09 0|index  | gp_port_info_list_get_info Getting info of entry 38 (45 available)...
19:07:09 0|index  | gp_port_set_timeout Setting port timeout to 5000 milliseconds.
19:07:09 0|index  | gp_port_set_settings Setting settings...
19:07:09 0|index  | gp_libusb1_update (old int=0, conf=-1, alt=-1) port usb:001,003, (new int=0, conf=-1, alt=-1) port usb:001,003
19:07:09 0|index  | gp_libusb1_update lowlevel libusb1 port not yet opened, no need for libusb changes
19:07:09 0|index  | gp_abilities_list_detect_usb Auto-detecting USB cameras...
19:07:09 0|index  | gp_libusb1_find_device_by_class_lib Looking for USB device (class 0x29a, subclass, 0xffffffff, protocol 0xffffffff)...
19:07:09 0|index  | gp_libusb1_find_device_by_class_lib Looking for USB device (class 0x6, subclass, 0x1, protocol 0x1)...
19:07:09 0|index  | gp_port_info_list_get_info Getting info of entry 39 (45 available)...
19:07:09 0|index  | gp_port_set_timeout Setting port timeout to 5000 milliseconds.
19:07:09 0|index  | gp_port_set_settings Setting settings...
19:07:09 0|index  | gp_libusb1_update (old int=0, conf=-1, alt=-1) port usb:003,002, (new int=0, conf=-1, alt=-1) port usb:003,002
19:07:09 0|index  | gp_libusb1_update lowlevel libusb1 port not yet opened, no need for libusb changes
19:07:09 0|index  | gp_abilities_list_detect_usb Auto-detecting USB cameras...
19:07:09 0|index  | gp_libusb1_find_device_lib Looking for USB device (vendor 0x4a9, product 0x319b)... found.
19:07:09 0|index  | gp_libusb1_find_device_lib Detected defaults: config 1, interface 0, altsetting 0, inep 81, outep 02, intep 83, class 06, subclass 01
19:07:09 0|index  | gp_abilities_list_detect_usb Found 'Canon EOS 50D' (0x4a9,0x319b)
19:07:09 0|index  | gp_port_free Freeing port...
19:07:09 0|index  | gp_port_close Closing port...
19:07:10 0|index  | node /home/tim/git/remote-camera-control/server/index.js: ../node_modules/nan/nan_object_wrap.h:109: virtual void Nan::ObjectWrap::Unref(): Assertion `!persistent().IsWeak()' failed.

@icheered
Copy link

I'm running into the same issue, did you ever solve it?

@tbranyen
Copy link
Author

I worked around it using a function to "recover" after a crash.

https://github.com/tbranyen/remote-camera-control/blob/master/index.js#L12-L28

Looks like no substantial commits have landed since I opened this issue years ago, so this might be your best bet for now if you want to use this module.

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