Bug #2518
closedSegfault when destructing face without cancelling pending interests
100%
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
Updated by Alex Afanasyev almost 10 years ago
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.
Updated by Alex Afanasyev almost 10 years ago
- Status changed from In Progress to Code review
- % Done changed from 90 to 100
Updated by Alex Afanasyev almost 10 years ago
Just in case. The snippet is just an illustration. Actual test case is here: http://gerrit.named-data.net/#/c/1758/1/tests/unit-tests/test-face.cpp
Updated by Junxiao Shi almost 10 years ago
- Description updated (diff)
This snippet causes io_service (owned by Face) to be destructed during .post callback. Is this a supported operation at all?
Updated by Alex Afanasyev almost 10 years ago
Should be safe, though I'm not planning to run the snippet. As I described in note 5, it is only an illustration.
Updated by Junxiao Shi almost 10 years ago
If the bug report is illustrated with code snippet, the snippet must be correct. Alternatively, describe the steps in text.
Updated by Alex Afanasyev almost 10 years ago
- Related to Bug #2517: NFD state is not properly cleaned up on destruction added
Updated by Alex Afanasyev almost 10 years ago
- Related to Task #1372: Replace usages of deadline_timer with Scheduler-based events added
Updated by Davide Pesavento almost 10 years ago
- Subject changed from Segfault when destruction face without cancelling pending interests to Segfault when destructing face without cancelling pending interests
Updated by Junxiao Shi over 9 years ago
- Status changed from Code review to Closed