r-lib / revdepcheck

R package reverse dependency checking
https://revdepcheck.r-lib.org
Other
99 stars 31 forks source link

C stack usage too close to the limit when using strsplit on a 00check.log content #315

Open cderv opened 2 years ago

cderv commented 2 years ago

This is the error I get when using cloud_report() or cloud_summary(). It comes from cloud_results() when parsing results to compare them.

It took me time to isolate from where it comes. It happens at this line : https://github.com/r-lib/revdepcheck/blob/31cadc35b3c8b58690cd73bb662cc24c96bbb9a3/R/cloud.R#L328

This is causing issue with one specific package, but it make the whole process fails. 00check.log contains a big number of line (27565), and specifically a very long entry because the checks have failed during vignette building. It happens with package StanHeaders - extract from the content:

* checking running R code from vignettes ... NONE
  ‘stanmath.Rmd’ using ‘UTF-8’... OK
* checking re-building of vignette outputs ... WARNING
Error(s) in re-building vignettes:
--- re-building ‘stanmath.Rmd’ using rmarkdown
In file included from /opt/R/4.0.3/lib/R/site-library/RcppEigen/include/Eigen/Core:397,
                 from /opt/R/4.0.3/lib/R/site-library/RcppEigen/include/Eigen/Dense:1,
                 from /opt/R/4.0.3/lib/R/site-library/RcppEigen/include/RcppEigenForward.h:30,
                 from /opt/R/4.0.3/lib/R/site-library/RcppEigen/include/RcppEigen.h:25,
                 from file828956d1b8e3.cpp:3:
/opt/R/4.0.3/lib/R/site-library/RcppEigen/include/Eigen/src/Core/arch/SSE/PacketMath.h:60:39: warning: ignoring attributes on template argument ‘__m128’ {aka ‘__vector(4) float’} [-Wignored-attributes]
   60 | template<> struct is_arithmetic<__m128>  { enum { value = true }; };
      |                                       ^
/opt/R/4.0.3/lib/R/site-library/RcppEigen/include/Eigen/src/Core/arch/SSE/PacketMath.h:61:40: warning: ignoring attributes on template argument ‘__m128i’ {aka ‘__vector(2) long long int’} [-Wignored-attributes]
   61 | template<> struct is_arithmetic<__m128i> { enum { value = true }; };
      |                                        ^
/opt/R/4.0.3/lib/R/site-library/RcppEigen/include/Eigen/src/Core/arch/SSE/PacketMath.h:62:40: warning: ignoring attributes on template argument ‘__m128d’ {aka ‘__vector(2) double’} [-Wignored-attributes]
   62 | template<> struct is_arithmetic<__m128d> { enum { value = true }; };
      |                                        ^

/opt/R/4.0.3/lib/R/site-library/RcppEigen/include/Eigen/src/Core/arch/SSE/PacketMath.h:161:43: warning: ignoring attributes on template argument ‘Eigen::internal::Packet4f’ {aka ‘__vector(4) float’} [-Wignored-attributes]
  161 | template<> struct unpacket_traits<Packet4f> { typedef float  type; enum {size=4, alignment=Aligned16}; typedef Packet4f half; };
      |                                           ^
/opt/R/4.0.3/lib/R/site-library/RcppEigen/include/Eigen/src/Core/arch/SSE/PacketMath.h:162:43: warning: ignoring attributes on template argument ‘Eigen::internal::Packet2d’ {aka ‘__vector(2) double’} [-Wignored-attributes]
  162 | template<> struct unpacket_traits<Packet2d> { typedef double type; enum {size=2, alignment=Aligned16}; typedef Packet2d half; };

This goes one from line 70 to the end. As the file is supposed to be splitted by entry *, I believe this creates a string way to big.

I have joined the log file here: 00check.log

To reproduce:

url <- "https://github.com/r-lib/revdepcheck/files/7541278/00check.log"
tmp_file <- tempfile()
download.file(url, destfile = tmp_file)

stdout <- brio::read_file(tmp_file)
stdout <- iconv(stdout, "UTF-8", "UTF-8", sub = "bytes")
stdout <- gsub("\r\n", "\n", stdout, fixed = TRUE)
entries <- strsplit(paste0("\n", stdout), "\n\\*+[ ]")[[1]][-1]

unlink(tmp_file)

It throws this error on the line entries <-

Error: C stack usage  23362914 is too close to the limit

If we can discuss why we get this very long error during the vignette build, it would be interesting to handle this special case somehow. At least by using a tryCatch() to not stop the whole process, and report that this packages has not been compared because of parsing failure to investigate. What do you think ?

For the context, I found this in my undergoing work of trying to understand and make the revdepcloud service works better for using it, including with vignette build. StandHeaders package doesn't error on CRAN, so it should not in our ecosystem either. but that is another story.