adnanademovic/rosrust

Is the ctrl-c shutdown handler needed?

AntoniosBarotsis opened this issue · 2 comments

I am having an issue with the shutdown handler registered here.

thread '<unnamed>' panicked at 'ROS init failed!: Error(SigintOverride(MultipleHandlers), 
State { next_error: None, backtrace: InternalBacktrace { backtrace: None } })', 
/home/anton/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rosrust-0.9.11/src/singleton.rs:24:20

This is probably because I am creating Python bindings with PyO3 and Python defines its own ctrl-c handler. This only seems to affect the Python bindings since if I run the exact same code in Rust alone, it works fine.

I'm not quite sure what the handler that is defined in this project does but it seems like it just drops the logger when a SIGINT is received.

Would it be possible to have a temporary workaround? Only thing I can think of is putting the logger behind a feature so the handler is not needed in the first place.

I'm not quite sure if that handler is needed to begin with because I feel like the logger deallocates itself but then again you probably know better :)

For my personal use case, I've circumvented the issue by just removing the logger all together in a fork.

I see @ssemenova likely also faced a similar issue since she forked it and made the same change I did.

I wouldn't mind helping implement some workaround in the original library if you think it would make sense @adnanademovic :)