Project

General

Profile

Actions

Bug #2518

closed

Segfault when destructing face without cancelling pending interests

Added by Alex Afanasyev almost 10 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Normal
Category:
Base
Target version:
Start date:
02/12/2015
Due date:
% Done:

100%

Estimated time:

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


Related issues 2 (0 open2 closed)

Related to NFD - Bug #2517: NFD state is not properly cleaned up on destructionAbandoned

Actions
Related to ndn-cxx - Task #1372: Replace usages of deadline_timer with Scheduler-based eventsClosedAlex Afanasyev

Actions
Actions #1

Updated by Alex Afanasyev almost 10 years ago

  • Tracker changed from Task to Bug
Actions #2

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.

Actions #3

Updated by Alex Afanasyev almost 10 years ago

  • Status changed from In Progress to Code review
  • % Done changed from 90 to 100
Actions #4

Updated by Alex Afanasyev almost 10 years ago

  • Description updated (diff)
Actions #5

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

Actions #6

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?

Actions #7

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.

Actions #8

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.

Actions #9

Updated by Alex Afanasyev almost 10 years ago

  • Related to Bug #2517: NFD state is not properly cleaned up on destruction added
Actions #10

Updated by Alex Afanasyev almost 10 years ago

  • Related to Task #1372: Replace usages of deadline_timer with Scheduler-based events added
Actions #11

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
Actions #12

Updated by Junxiao Shi over 9 years ago

  • Status changed from Code review to Closed
Actions

Also available in: Atom PDF