Callbacks were connected but not removed until the end of simulation.
Thanks Julien Emmanuel for the report, agier for diagnosis and fsuter for patch.
actor_->activities_.remove(this);
actor_ = nullptr;
}
+ if (state_ != State::FAILED && cb_id_ >= 0)
+ s4u::Host::on_state_change.disconnect(cb_id_);
/* Answer all simcalls associated with the synchro */
finish();
}
std::vector<double> flops_amounts_;
std::vector<double> bytes_amounts_;
s4u::Exec* piface_;
-
+ int cb_id_ = -1; // callback id from Host::on_state_change.connect()
public:
ExecImpl();
s4u::Exec* get_iface() { return piface_; }
ExecImpl& set_timeout(double timeout) override;
ExecImpl& set_bound(double bound);
ExecImpl& set_sharing_penalty(double sharing_penalty);
+ void set_cb_id(unsigned int cb_id) { cb_id_ = cb_id; }
double get_start_time() const { return start_time_; }
double get_finish_time() const { return finish_time_; }
ExecPtr Exec::init()
{
auto pimpl = kernel::activity::ExecImplPtr(new kernel::activity::ExecImpl());
- Host::on_state_change.connect([pimpl](s4u::Host const& h) {
+ unsigned int cb_id = Host::on_state_change.connect([pimpl](s4u::Host const& h) {
if (not h.is_on() && pimpl->state_ == kernel::activity::State::RUNNING &&
std::find(pimpl->get_hosts().begin(), pimpl->get_hosts().end(), &h) != pimpl->get_hosts().end()) {
pimpl->state_ = kernel::activity::State::FAILED;
pimpl->post();
}
});
+ pimpl->set_cb_id(cb_id);
return ExecPtr(pimpl->get_iface());
}