Skip to content

resetting subscriber leads to crash #349

@Karsten1987

Description

@Karsten1987

given the following code: https://gist.github.com/Karsten1987/82837b87fd11ef23353754b9fa31cf7a

the situation:

1.) node spawns a subscriber and a publisher
2.1) main thread spins the executor, having sub and pub talking
2.2) second thread randomly stops the subscription (resetting the shared_ptr of it)
3.) program crashes with the backtrace at the bottom of the gist.

quickly discussed the problem with @wjwwood, when resetting the subscription, the executor still has a raw handle on it which leads to race conditions. The problem can be addressed by turning the handle into a shared pointer.

concretely speaking, this function should return a shared_ptr instead of a raw pointer.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions