[Rcpp-devel] Rcpp::exception + threads = disaster

Joshua N Pritikin jpritikin at pobox.com
Fri Feb 7 15:10:37 CET 2020


On Fri, Feb 07, 2020 at 07:56:40AM -0600, Dirk Eddelbuettel wrote:
> On 7 February 2020 at 08:23, Joshua N Pritikin wrote:
> | Yeah, so I replaced Rcpp::stop with,
> | 
> | template <typename... Args>
> | inline void NORET mxThrow(const char* fmt, Args&&... args) {
> |     throw std::runtime_error( tfm::format(fmt, std::forward<Args>(args)... ).c_str() );
> | }
> | 
> | And now things work great. 
> 
> Good to know!
> 
> | But why does Rcpp::stop need to get the stack_trace? R's stack trace isn't
> | going to change until the control flow returns back to R. So why can't you
> | just set a flag to indicate that "some C++ exception happened" and grab the
> | stack_trace immediately before returning control to R?
> 
> See several (extended) discussions at GitHub around the issues that changed
> and improved exception handling and stack traces. A fair amount of very nice
> work made Rcpp more robust here.

Where? I looked here,

https://github.com/RcppCore/Rcpp/issues?utf8=%E2%9C%93&q=is%3Aissue+exception

but I didn't see anything obviously related.


More information about the Rcpp-devel mailing list