Skip to content

MB-44253: Remove try/catch from Executor*::runTask methods - #15

Merged
trondn merged 1 commit into
couchbasedeps:v2026.08.31.00-couchbasefrom
jimwwalker:v2026.08.31.00-couchbase
Sep 7, 2026
Merged

trondn merged 1 commit into
couchbasedeps:v2026.08.31.00-couchbasefrom
jimwwalker:v2026.08.31.00-couchbase

Conversation

@jimwwalker

Copy link
Copy Markdown

Slightly adapted Dave Rigby's patch:

commit 3d4519d
Author: Dave Rigby daver@couchbase.com
Date: Thu Feb 11 14:01:47 2021 +0000

MB-44253: Remove try/catch from Executor*::runTask methods

These try/catch blocks prevent unhandled exceptions in GlobalTasks
from triggering std::terminate, and in turn generating a Breakpad
minidump with the state of the process when the exception was thrown
(as opposed to where it was caught).

Started a discussion with Folly about a more generic way to address
this (i.e. making the try/catch somehow optional) - see
https://github.com/facebook/folly/issues/1525 - but in the short-term
simply remove the invokeCatchingExns() wrapper from our branch.

(Note: Currently we only use ThreadPoolExecutor and hence we only
/need/ to change that one, but for consistency / possible future use
change all instances).

Additionally disable the two unit tests which assert the removed exception-catching behaviour (they would now std::terminate):

  • ThreadedExecutorTest.exception
  • SerialExecutorTest/*.ExecutionThrows

@trondn trondn left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably wrong to self review ;) but the fact still holds true that we don't want the exceptions to be caught

@jimwwalker

Copy link
Copy Markdown
Author

Thanks - this will be tested to some extent before we even adopt it, hopefully no more customisation on the dependency needed and maybe some issues fixed 🤞

@jimwwalker
jimwwalker force-pushed the v2026.08.31.00-couchbase branch 2 times, most recently from 6572922 to 880e7d9 Compare September 7, 2026 12:46
Slightly adapted Dave Rigby's patch:

commit 3d4519d
Author: Dave Rigby <daver@couchbase.com>
Date:   Thu Feb 11 14:01:47 2021 +0000

    MB-44253: Remove try/catch from Executor*::runTask methods

    These try/catch blocks prevent unhandled exceptions in GlobalTasks
    from triggering std::terminate, and in turn generating a Breakpad
    minidump with the state of the process when the exception was thrown
    (as opposed to where it was caught).

    Started a discussion with Folly about a more generic way to address
    this (i.e. making the try/catch somehow optional) - see
    facebook#1525 - but in the short-term
    simply remove the invokeCatchingExns() wrapper from our branch.

    (Note: Currently we only use ThreadPoolExecutor and hence we only
    /need/ to change that one, but for consistency / possible future use
    change all instances).

Additionally disable the two unit tests which assert the removed
exception-catching behaviour (they would now std::terminate):
- ThreadedExecutorTest.exception
- SerialExecutorTest/*.ExecutionThrows

MB-64254: Also drop noexcept from invokeCatchingExns. With noexcept the
compiler treats the frame as a terminate handler, so the exception is
unwound up to this point before std::terminate runs and the crash
backtrace loses every frame above the executor. Without it no handler
is found and terminate is called from __cxa_throw with the throwing
frame intact.
@jimwwalker
jimwwalker force-pushed the v2026.08.31.00-couchbase branch from 880e7d9 to 06d0710 Compare September 7, 2026 12:47
@trondn
trondn merged commit 5eee46b into couchbasedeps:v2026.08.31.00-couchbase Sep 7, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants