Skip to content

Terminating with unexpected exception #358

@ruslo

Description

@ruslo

Example simple_wget crashing from time to time with error:
boost thread: trying joining itself: Resource deadlock avoided

How to reproduce

I turn off wi-fi and run command:
simple_wget https://example.com/some/archive.tar.gz

Usually command exits with code 1 and message:

Saving to: archive.tar.gz
Host not found (authoritative)

which is expected and good, but sometimes application crash in libc++ with message:

libc++abi.dylib: terminating with unexpected exception of type boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::thread_resource_error> >: boost thread: trying joining itself: Resource deadlock avoided
Process 75882 stopped

Backtrace can be found here

I can guess that exception which is thrown from join trigger std::terminate
because destructor has nothrow type (async_impl.h):

      ~async_client() throw ()
      {
        sentinel_.reset();
        if (lifetime_thread_.get()) {
          lifetime_thread_->join(); // BOOM!
          lifetime_thread_.reset();
        }
      }

Some tests

  • 5 crash from 1000 run
  • 36 crash from 10000 run

Environment

  • Mac OS X 10.9.1, boost 1.55 (debug build with libc++), openssl (system)
  • iOS, boost 1.55 (debug build with libc++), openssl 1.0.1e
  • I'm using cpp-netlib-0.10.1, but cpp-netlib-0.11.0-rc3 has same behaviour

Also I've tried it on my virtual machine with Mac OS X 10.8.5 (which not using wi-fi),
there is no crashes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions