Skip to content

RTDPublisher Stop() being called despite remaining active subscribers #126

Description

@andyvandy

Happy New Year Steven!

I've run into an edge case where stop() is getting called on Python RTDPublisher instances when a cell disconnects which cuts the connection for other remaining subscribers. ( shutting down a shared service/database connection )
Observed on 0.18.7 py 3.11 64bit.

I haven't gotten a debugger hooked up to the C++ code but this function looked like a plausible trigger.

bool disconnect(size_t numSubscribers) override
{
RtdPublisher::disconnect(numSubscribers);
// TODO: check numSubscribers == 0
stop();
auto p = _parent.lock();
if (p)
{
scoped_atomic_flag lock(p->busy);
p->tasks.remove_if([&](auto& t) { return t.get() == this; });
}
return true;
}

Assuming that the underlying xlo.RTDPublisher has properly implemented disconnect and stop functions, is there any need for line 111 at all? Even if predicated on numSubscribers==0, would there be a reason to call stop() here rather than from the disconnect function?

If not, the fix looks like it may just be a single line deletion 🤞

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions