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 updevtools::test crashes RStudio when called twice on package using testthat #1832
Comments
|
I've posted the same issue on the github repo for testthat |
|
I cannot reproduce this, the attached package tests without on both Windows and MacOS, with both the CRAN release of devtools as well as the devel version. Could you provide your |
|
OK. I will do so now. Please note that I observe this crash on Linux (specifically, Ubuntu 16.04) |
|
Here is the session info: I invoked the session_info() function after the first call to test(.) but before the second call to test(.), which then caused the R session to crash |
|
I can also e-mail you a tar.gz file with the core dump and my R binary if it helps. I cannot attach it here because the file size exceeds 10 MB |
|
This might be just r-lib/pkgload#35 |
|
I can reproduce it on linux with both CRAN devtools and devel devtools, the relevant backtrace is
I am not that familiar with this code, but it seems Catch is using a singleton and it is crashing when trying to initialize the RNG the second time. Perhaps the first singleton is not being destructed properly. @kevinushey any ideas? |
|
I confirm that's precisely the backtrace from the crash as it occurs on my machine, as well. |
|
I'll take a look! |
|
I suspect that part of the issue is that
Some discussion of this issue on the RedHat bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1215452 The GCC manpage has a flag
But asking package authors to make this change isn't quite realistic. I'll have to think of a better solution. |
|
I'm open to incorporating a workaround into my package. If I set that compile flag in the makefile for my package, will that resolve the problem? |
|
I just tested the above workaround: I included the -fno-gnu-unique flag during the compilation of my package. It does indeed fix the crash. I can run test(.) an arbitrary number of times in a row, with no problem. |
|
I think my PR in r-lib/testthat#779 will fix this without requiring extra compiler flags. |
|
Wow that is quite a strange one, I was not aware of this gcc behavior. If this is a gcc specific issue I wonder why I did not observe this on Windows as well, maybe just deterministic behavior and I did not try re-running I wonder if we should have pkgload include |
|
I think static variables in inline functions should be relatively rare. There's also the worry that (in theory) if a package is tested locally with I suspect this issue will be rare enough that the issue is worth punting on until someone actually reports similar trouble. FWIW I went this route (inline function with static variable) just to minimize the amount of boilerplate needed in R packages that wanted to use Catch. |
|
Great thanks again Kevin for looking into this, I would not have thought of this being an issue, so I am glad you had an inkling of where to look. |
|
This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/ |
RStudio (as well as R sessions run from the terminal) crashes when devtools::test is invoked twice in succession on a package that uses Catch, via package testthat. The crash occurs in testthat/include/testthat/vendor/catch.h.
I've attached a trivial package that reproduces the problem:
ttcrash.tar.gz
Exact steps to reproduce:
1.) Simply install the package to "some_directory".
2.) > "library(devtools)"
3.) > test("some_directory/ttcrash")
4.) > test("some_directory/ttcrash")
The crash will occur on the last step. I'm using R version 3.4.4 and testthat version 2.0.0