Skip to content

Call std::terminate in the event of catastrophic exceptions in rpc-lib #2

Description

@vshalygin

Problem

There are certain exceptions that cannot be handled within the library. Exceptions thrown due to a failure to allocate heap memory or a mutex locking error are currently unhandled and violate internal invariants. Moreover, such exceptions render further operation impossible.

Solution
Call std::terminate if exception happend:

  1. Failure of memory allocation
  2. Failure of standart containers and algorithms functions (related to memory allocation mostly)
  3. Failure of library functions, such as boost::asio::post
  4. Failure of any waiting operation, including std::mutex::lock (and related)
    This list in is not complete and may be expanded.

Note
This approach to exception handling is implemented by default in Go, so I consider it acceptable. These are the best guarantees a library can provide.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions