Bug #2518
closed
Segfault when destructing face without cancelling pending interests
Added by Alex Afanasyev almost 10 years ago.
Updated over 9 years ago.
Description
Pseudocode to trigger the problem:
shared_ptr<Face> face = make_shared<Face>();
boost::thread t = boost::thread([&face] {
boost::this_thread::sleep_for(time::milliseconds(55));
face->getIoService().post([&face] {
face.reset();
});
});
face->expressInterest(Interest("/Hello/World", time::milliseconds(50)),
bind([]{}), bind([]{}));
face->processEvents();
Destructing the face should have caused all handlers posted to io service to be cancelled and processEvents() should have been terminated with no error.
Actual: segfault
- Tracker changed from Task to Bug
More correct solution to the problem is #1372, but it requires a much bigger overhaul inside the Face implementation. However, this fix is necessary in the meantime.
- Status changed from In Progress to Code review
- % Done changed from 90 to 100
- Description updated (diff)
- Description updated (diff)
This snippet causes io_service (owned by Face) to be destructed during .post callback. Is this a supported operation at all?
Should be safe, though I'm not planning to run the snippet. As I described in note 5, it is only an illustration.
If the bug report is illustrated with code snippet, the snippet must be correct. Alternatively, describe the steps in text.
- Related to Bug #2517: NFD state is not properly cleaned up on destruction added
- Related to Task #1372: Replace usages of deadline_timer with Scheduler-based events added
- Subject changed from Segfault when destruction face without cancelling pending interests to Segfault when destructing face without cancelling pending interests
- Status changed from Code review to Closed
Also available in: Atom
PDF