Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rethrow unwind exception #533

Merged
merged 1 commit into from
Oct 25, 2017
Merged

rethrow unwind exception #533

merged 1 commit into from
Oct 25, 2017

Conversation

manuel-schiller
Copy link
Contributor

On Linux with pthread library spdlog causes an SIGABORT and crashes
the application in case it catches a thread specific cancellation
exception in a critical execution phase while in a try/catch block
in spdlog/detail/logger_impl.h

The exception is caught by some general catch(...) clause where
it is NOT rethrown.

However rethrowing these kind of exception is mandatory, otherwise
an abort will be caused by the glibc.

@gabime
Copy link
Owner

gabime commented Oct 11, 2017

Intersting. Why GNUC? is it gcc specific?

@manuel-schiller
Copy link
Contributor Author

This is not GCC specific, it is specific for usage of the "Native POSIX Thread Library" (NPTL), see also https://udrepper.livejournal.com/21541.html.

I guess we should rather use __linux__ instead of __GNUG__.

@gabime
Copy link
Owner

gabime commented Oct 24, 2017

Will it compile under clang? also, could you please move this “#define” to spdlog/common.h?

@manuel-schiller
Copy link
Contributor Author

moved to common.h

yes this will compile on clang as long as cxxabi.h is present

@manuel-schiller
Copy link
Contributor Author

manuel-schiller commented Oct 25, 2017

the error handler will be called for all exceptions except for abi::__forced_unwind&. Do you want the error handler to be called in this case as well and then rethrow?

@gabime
Copy link
Owner

gabime commented Oct 25, 2017

Yes please.

On Linux with pthread library spdlog causes an SIGABORT and crashes
the application in case it catches a thread specific cancellation
exception in a critical execution phase while in a try/catch block
in spdlog/detail/logger_impl.h

The exception is caught by some general catch(...) clause where
it is NOT rethrown.

However rethrowing these kind of exception is mandatory, otherwise
an abort will be caused by the glibc.
@manuel-schiller
Copy link
Contributor Author

done

@gabime gabime merged commit fbb8244 into gabime:master Oct 25, 2017
@manuel-schiller manuel-schiller deleted the patch-1 branch October 26, 2017 06:19
@alurie
Copy link

alurie commented Apr 27, 2021

@gabime we encountered the same issue described in this PR (using spdlog v1.6.1, on centos7).
We do pthread_cancel of a thread that happens to be in the middle of spdlog sink/flush, exception is caught and not re-thrown, causing the crash.
Looking at the spdlog code changes, the fix introduced in this PR was refactored out.
(e.g. 8ca1d84 removed catch(...),
then fd170b0 added it back with re-throw, then 78ea362 removed the re-throw).
If possible, could you please shed some light on those changes (I could not locate comments associated with those commits). Most interesting question is whether the re-throw was removed because it was causing some issue?
Thank you.

@gabime
Copy link
Owner

gabime commented Apr 27, 2021

I think there was some problem with it, but I do not recall exactly..

@gabime
Copy link
Owner

gabime commented Apr 30, 2021

@alurie This was probably the cause: #549

gabime pushed a commit that referenced this pull request Apr 30, 2021
@gabime
Copy link
Owner

gabime commented Apr 30, 2021

@alurie Fixed again

swex pushed a commit to swex/spdlog that referenced this pull request Jul 4, 2021
bachittle pushed a commit to bachittle/spdlog that referenced this pull request Dec 22, 2022
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.

3 participants