-
-
Notifications
You must be signed in to change notification settings - Fork 208
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
Protect function argument to rcpp_set_stack_trace() #706
Conversation
inst/NEWS.Rd
Outdated
@@ -20,6 +20,10 @@ | |||
\item Automatically register init functions for Rcpp Modules (\ghpr{705} | |||
addressing \ghit{704}). | |||
} | |||
\item Bug fixes: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There has never been an entry Bug fixes. Please place under Rcpp API.
src/barrier.cpp
Outdated
@@ -121,7 +121,9 @@ SEXP rcpp_get_stack_trace() { | |||
|
|||
// [[Rcpp::register]] | |||
SEXP rcpp_set_stack_trace(SEXP e) { | |||
PROTECT(e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be Rcpp::Shield<>
instead?
Also, remember that we (generally) prefer Issue tickets prior to PRs... |
Next time I have a reprex I file an issue first. Promise ;-) |
Codecov Report
@@ Coverage Diff @@
## master #706 +/- ##
=======================================
Coverage 89.57% 89.57%
=======================================
Files 66 66
Lines 3588 3588
=======================================
Hits 3214 3214
Misses 374 374
Continue to review full report at Codecov.
|
Thanks for quickly making the changes. Does it still pass your local test? |
Thanks for catching this! I don't think this is quite the right change, though. Normally, we should be able to operate under the assumption that It looks to me like the real issue here is that the Rcpp/inst/include/Rcpp/exceptions.h Line 34 in 7687508
Rcpp/inst/include/Rcpp/exceptions.h Line 39 in 7687508
And so the returned |
Well whether you want it or not we're having the review now :) |
@kevinushey: Good point, thanks for chiming in. @eddelbuettel: I'm fine with that. |
Concerning the local test: I can no longer replicate the original heisenbug. I'll run a test on dplyr using this branch of Rcpp with valgrind and gctorture. |
FWIW, |
Meaning we'd no longer need this? Colour me confused. In any event, this is unlikely to do harm, and as @kevinushey pointed out both a good catch anyway and now in a better spot so I'll merge. |
I was pointing out that some functions seem to be caller-protected, others callee-protected. But then |
The rule in the R source code is that the caller protects arguments and the callee can expect its arguments to be protected. There are documented exceptions, e.g. |
which may be gc-ed otherwise.
I was unable to create a reproducible example for this problem, but I have two stack traces from test runs for dplyr with valgrind and gctorture enabled that indicate that this may be the source of a problem. I'm not seeing these errors anymore after applying this fix.