Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upProtect function argument to rcpp_set_stack_trace() #706
Conversation
| @@ -20,6 +20,10 @@ | |||
| \item Automatically register init functions for Rcpp Modules (\ghpr{705} | |||
| addressing \ghit{704}). | |||
| } | |||
| \item Bug fixes: | |||
eddelbuettel
Jun 4, 2017
Member
There has never been an entry Bug fixes. Please place under Rcpp API.
There has never been an entry Bug fixes. Please place under Rcpp API.
| @@ -121,7 +121,9 @@ SEXP rcpp_get_stack_trace() { | |||
|
|
|||
| // [[Rcpp::register]] | |||
| SEXP rcpp_set_stack_trace(SEXP e) { | |||
| PROTECT(e); | |||
eddelbuettel
Jun 4, 2017
Member
Should this be Rcpp::Shield<> instead?
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.