Coder Social home page Coder Social logo

Comments (5)

wuyuanyi135 avatar wuyuanyi135 commented on May 28, 2024

from my observation, the following case will also fail:
Does it mean I should not use coordinator in the source anywhere?

  std::vector<int> data{1, 2, 3, 4, 5};
  schedulers::run_loop rl;
  identity_one_worker c(schedulers::make_run_loop(rl));
  sources::iterate(data, c)
      .tap([](auto _) {std::cout << "before delay\n";})
      .delay(std::chrono::milliseconds(500))
      .tap([](auto _) {std::cout << "after delay\n";})
      .subscribe([](int v) {
        std::cout << "Next " << v << "\n";
      });

from rxcpp.

wuyuanyi135 avatar wuyuanyi135 commented on May 28, 2024

I started investigating this issue. I found that the crash was caused by the following line.

return worker(lifetime, inner.lock());

For some reason, the weak_ptr returned NULL, presumably the underlying shared pointer has been released somehow.

from rxcpp.

wuyuanyi135 avatar wuyuanyi135 commented on May 28, 2024

One possibility is that the sources (like just or iterate) uses identity_immediate coordinator by default:

decltype(iterate(std::declval<std::array<rxu::decay_t<Value0>, 1>>(), identity_immediate()))>::type {

This makes more sense to me as emitting values does not sounds like asynchronous operation (except interval). Passing the runloop coordinator seems not a good choice but why will it crash?

from rxcpp.

kirkshoop avatar kirkshoop commented on May 28, 2024

Can you add the stack for the crash?

from rxcpp.

wuyuanyi135 avatar wuyuanyi135 commented on May 28, 2024

@kirkshoop Sorry for the late response. Here is the stack: (I am using master branch of rxcpp)

rxcpp::schedulers::worker::schedule_rebind<…>(const rxcpp::schedulers::schedulable &) const rx-scheduler.hpp:815
rxcpp::schedulers::worker::schedule rx-scheduler.hpp:260
rxcpp::schedulers::schedulable::schedule rx-scheduler.hpp:621
rxcpp::schedulers::detail::action_tailrecurser::operator() rx-scheduler.hpp:715
std::__invoke_impl<…> invoke.h:61
std::__invoke_r<…> invoke.h:111
std::_Function_handler::_M_invoke(const std::_Any_data &, const rxcpp::schedulers::schedulable &, const rxcpp::schedulers::recurse &) std_function.h:291
std::function::operator()(const rxcpp::schedulers::schedulable &, const rxcpp::schedulers::recurse &) const std_function.h:560
rxcpp::schedulers::detail::action_type::operator() rx-scheduler.hpp:679
rxcpp::schedulers::action::operator() rx-scheduler.hpp:727
rxcpp::schedulers::schedulable::operator() rx-scheduler.hpp:645
rxcpp::schedulers::run_loop::dispatch rx-runloop.hpp:192
main emitting_a_list_simultaneously_or_sequentially.cpp:37
__tmainCRTStartup 0x00007ff72cc9143f
mainCRTStartup 0x00007ff72cc91146
BaseThreadInitThunk 0x00007ff8045554e0
RtlUserThreadStart 0x00007ff8049a485b
<unknown> 0x0000000000000000

from rxcpp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.