ReactiveX / RxCpp

Reactive Extensions for C++
Apache License 2.0
3.07k stars 396 forks source link

Issue with Boost.Asio scheduler and RxCpp #525

Open david-hoze opened 4 years ago

david-hoze commented 4 years ago

Hi, I'm using a scheduler taken from Boost.ASIO scheduler for RxCPP (referenced in https://github.com/ReactiveX/RxCpp/issues/183).

I'm experiencing an issue with RxCpp, full reproduction in https://github.com/david-hoze/RxCppAsioReproduction.

When running the example, I often (not always) get

pure virtual method called
terminate called without an active exception

Process finished with exit code 134 (interrupted by signal 6: SIGABRT)

very often when running.

When debugging the stacktrace shows it gets the SIGABRT in https://github.com/ReactiveX/RxCpp/blob/eaf0545efef9fdccc0a6bc88f23ef0fc876c36f3/Rx/v2/src/rxcpp/rx-scheduler.hpp#L413 and on my code in: https://github.com/david-hoze/RxCppAsioReproduction/blob/master/rx-asio.h#L53 and higher in the stack trace: https://github.com/david-hoze/RxCppAsioReproduction/blob/master/main_rxcpp_asio_reproduction.cpp#L29

You can debug and see yourself.. Am I using RxCpp wrongly? is it a problem with the rx-asio scheduler I downloaded? Do you know of a more robust and tested version of a Boost.Asio RxCpp scheduler?

kirkshoop commented 4 years ago

Thanks for the repo with a repro.. this was much easier to look into!

I put my changes in a PR here https://github.com/david-hoze/RxCppAsioReproduction/pull/1

in short -

david-hoze commented 4 years ago

Hi, no problem, my pleasure :smiley:, thanks for the quick reply! The second version (less subjects, more operators) indeed fixes the issue, and does not throw a SIGABRT, and it's also very good for learning how it should be done with operators. FYI, the first version still throws (at least on my machine).

Thanks, David

windoze commented 4 years ago

@david-hoze Sorry for the late response, I just got the chance to check my email during the Chinese New Year holiday. This snippet was written 5 years ago and I really cannot recall all the details, only thing I can remember is that I was working on a project using both RxCpp and Boost hence the idea, I'm pretty sure it used to be working but of course everything could have been changed since then. I'll try to find some time to look into the code and make it working again, but right now I cannot promise anything. Thank you for being interested by my code and sorry again.