Skip to content
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

infinite loop of as.vector(x, mode) in default_usage.s4method #1234

Closed
muschellij2 opened this issue Jun 22, 2016 · 5 comments
Closed

infinite loop of as.vector(x, mode) in default_usage.s4method #1234

muschellij2 opened this issue Jun 22, 2016 · 5 comments

Comments

@muschellij2
Copy link
Contributor

Cross-posting something from the roxygen package (r-lib/roxygen2#475) from klutometis/roxygen @klutometis. If

Error

When trying to document using devtools::document getting C stack usage error on R 3.3.0:

devtools::document(roclets=c('rd', 'collate', 'namespace', 'vignette'))
Updating extrantsr documentation
Loading extrantsr
Error: C stack usage  7970652 is too close to the limit

Traceback

After running traceback() you get as.vector(x, mode) repeated over and over and then the tail is:

29: as.vector(x, mode)
28: as.vector(x, mode)
27: as.vector(x, "character")
26: as.vector(x, "character")
25: as.character.default(x$value@defined)
24: as.character(x$value@defined)
23: format_name(name)
22: eval(expr, envir, enclos)
21: eval(arg, env)
20: escape(eval(arg, env))
19: FUN(X[[i]], ...)
18: lapply(args, function(arg) {
        if (is.character(arg)) 
            return(arg)
        escape(eval(arg, env))
    })
17: build_rd(format_name(name), "(", arglist, ")")
16: function_usage(x$value@generic, formals(x$value), s4method)
15: default_usage.s4method(partitum$object)
14: default_usage(partitum$object)
13: wrap_string(default_usage(partitum$object))
12: process_usage(block)
11: add_tag(rd, process_usage(block))
10: block_to_rd(block, base_path, parsed$env)
9: roc_process.rd_roclet(roc, parsed, base_path, options = options)
8: roc_process(roc, parsed, base_path, options = options)
7: FUN(X[[i]], ...)
6: lapply(roclets, roc_out)
5: unlist(lapply(roclets, roc_out))
4: roxygen2::roxygenise(pkg$path, roclets = roclets, load_code = ns_env)
3: force(code)
2: withr::with_envvar(r_env_vars(), roxygen2::roxygenise(pkg$path, 
       roclets = roclets, load_code = ns_env))
1: devtools::document(roclets = c("rd", "collate", "namespace", 
       "vignette"))

which seems like there may be some change using format_name, but I can't assess yet. I'll keep looking but currently unsure where the breakdown is. If I find, I'll try to make a PR.

Session information

> sessionInfo()
R version 3.3.0 (2016-05-03)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10.5 (Yosemite)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] extrantsr_1.1.15.0 colorout_1.1-0    

loaded via a namespace (and not attached):
 [1] hash_2.2.6           Rcpp_0.12.5          magrittr_1.5        
 [4] roxygen2_5.0.1.9000  splines_3.3.0        devtools_1.11.1.9000
 [7] munsell_0.4.3        lattice_0.20-33      colorspace_1.2-6    
[10] stringr_1.0.0        plyr_1.8.4           tools_3.3.0         
[13] parallel_3.3.0       grid_3.3.0           yaImpute_1.0-26     
[16] neuroim_0.0.6        nlme_3.1-128         mgcv_1.8-12         
[19] R.oo_1.20.0          oro.nifti_0.5.4      R.matlab_3.5.1      
[22] withr_1.0.2          iterators_1.0.8      matrixStats_0.50.2  
[25] rgl_0.95.1441        assertthat_0.1       abind_1.4-3         
[28] digest_0.6.9         WhiteStripe_1.1.3    Matrix_1.2-6        
[31] readr_0.2.2          R.utils_2.3.0        bitops_1.0-6        
[34] memoise_1.0.0        stringi_1.1.1        ANTsR_0.3.2         
[37] fslr_1.6.5.2         scales_0.4.0         R.methodsS3_1.7.1   
> devtools::session_info()
Session info -------------------------------------------------------------------
 setting  value                       
 version  R version 3.3.0 (2016-05-03)
 system   x86_64, darwin13.4.0        
 ui       X11                         
 language (EN)                        
 collate  en_US.UTF-8                 
 tz       America/New_York            
 date     2016-06-22                  

Packages -----------------------------------------------------------------------
 package     * version     date       source                             
 abind         1.4-3       2015-03-13 CRAN (R 3.2.0)                     
 ANTsR         0.3.2       2016-05-24 local                              
 assertthat    0.1         2013-12-06 CRAN (R 3.2.0)                     
 bitops        1.0-6       2013-08-17 CRAN (R 3.2.0)                     
 colorout    * 1.1-0       2015-04-20 Github (jalvesaq/colorout@1539f1f) 
 colorspace    1.2-6       2015-03-11 CRAN (R 3.2.0)                     
 devtools      1.11.1.9000 2016-06-22 Github (hadley/devtools@d247c17)   
 digest        0.6.9       2016-01-08 CRAN (R 3.2.3)                     
 extrantsr   * 1.1.15.0    <NA>       local                              
 fslr          1.6.5.2     2016-06-08 local                              
 hash          2.2.6       2013-02-21 CRAN (R 3.2.0)                     
 iterators     1.0.8       2015-10-13 CRAN (R 3.2.0)                     
 lattice       0.20-33     2015-07-14 CRAN (R 3.3.0)                     
 magrittr      1.5         2014-11-22 CRAN (R 3.2.0)                     
 Matrix        1.2-6       2016-05-02 CRAN (R 3.3.0)                     
 matrixStats   0.50.2      2016-04-24 CRAN (R 3.2.5)                     
 memoise       1.0.0       2016-01-29 CRAN (R 3.2.3)                     
 mgcv          1.8-12      2016-03-03 CRAN (R 3.3.0)                     
 munsell       0.4.3       2016-02-13 CRAN (R 3.2.3)                     
 neuroim       0.0.6       2016-01-07 CRAN (R 3.2.3)                     
 nlme          3.1-128     2016-05-10 CRAN (R 3.3.0)                     
 oro.nifti     0.5.4       2016-06-08 Github (bjw34032/oro.nifti@e0af126)
 plyr          1.8.4       2016-06-08 CRAN (R 3.3.0)                     
 R.matlab      3.5.1       2016-03-28 CRAN (R 3.2.4)                     
 R.methodsS3   1.7.1       2016-02-16 CRAN (R 3.2.3)                     
 R.oo          1.20.0      2016-02-17 CRAN (R 3.2.3)                     
 R.utils       2.3.0       2016-04-14 CRAN (R 3.2.5)                     
 Rcpp          0.12.5      2016-05-14 CRAN (R 3.2.5)                     
 readr         0.2.2       2015-10-22 CRAN (R 3.2.0)                     
 rgl           0.95.1441   2016-01-04 CRAN (R 3.2.3)                     
 roxygen2      5.0.1.9000  2016-06-22 Github (klutometis/roxygen@7133fd6)
 scales        0.4.0       2016-02-26 CRAN (R 3.2.3)                     
 stringi       1.1.1       2016-05-27 CRAN (R 3.3.0)                     
 stringr       1.0.0       2015-04-30 CRAN (R 3.2.0)                     
 WhiteStripe   1.1.3       2016-05-31 local                              
 withr         1.0.2       2016-06-20 CRAN (R 3.3.0)                     
 yaImpute      1.0-26      2015-07-20 CRAN (R 3.2.0)                     
@EricArcher
Copy link

EricArcher commented Jun 24, 2016

I can confirm that this error does not occur in R 3.2.4 revised, but does occur in 3.3.0.

The error I get can be replicated with the following object:

> x$value@defined
An object of class “signature”
       x 
"gtypes" 
> str(x$value@defined)
Formal class 'signature' [package "methods"] with 3 slots
  ..@ .Data  : chr "gtypes"
  ..@ names  : chr "x"
  ..@ package: chr "roxygen_devtest"

In R 3.2.4, this is the result I get:

> as.vector(x$value@defined, "character")
[1] "gtypes"

In R 3.3.0, I get the C stack error described above and in [https://github.com/r-lib/roxygen2/issues/475]

In the NEWS file for 3.3.0 there are these two lines that might be relevant:

C-LEVEL FACILITIES:

    * New API call R_orderVector1, a faster one-argument version of
      R_orderVector.


  BUG FIXES:

    * C-level asChar(x) is fixed for when x is not a vector, and it
      returns "TRUE"/"FALSE" instead of "T"/"F" for logical vectors.

@muschellij2
Copy link
Contributor Author

Thought this was fixed with 3.3.1 - it was not.

@EricArcher
Copy link

Based on a suggestion by Luke Tierney, I removed packages one-by-one to see if I could make the error go away with that. When I removed Matrix (v1.2-6 on R 3.3.1), I got no error. Matrix automatically reinstalls (same version), but all is good now.

@hadley
Copy link
Member

hadley commented Nov 3, 2016

This seems like a roxygen2 issue, not devtools.

@hadley hadley closed this as completed Nov 3, 2016
@lock
Copy link

lock bot commented Sep 18, 2018

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/

@lock lock bot locked and limited conversation to collaborators Sep 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants