Skip to content

Instantly share code, notes, and snippets.

@vjcitn
Created October 11, 2024 11:55
Show Gist options
  • Save vjcitn/c4c4e99314f0d77d58148b7d19cbedae to your computer and use it in GitHub Desktop.
Save vjcitn/c4c4e99314f0d77d58148b7d19cbedae to your computer and use it in GitHub Desktop.
triggers segfault on ubuntu 24.04 under R 4.4.1, when compiled with rmarkdown::render
---
title: "Triggers a curl/httr segfault during R CMD build"
author: Hervé Pagès
output:
BiocStyle::html_document:
toc: true
toc_depth: 2
vignette: >
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
This vignette triggers a curl segfault when built with
`R CMD build curlminitest` on Ubuntu 24.04 and Intel Mac.
The segfault typically occurs inside `curl::curl_fetch_disk()`.
```{r}
library(httr)
url1 <- "https://en.wikipedia.org/wiki/Bioconductor"
response1 <- GET(url1)
url2 <- "ftp://ftp.ensembl.org/pub/release-71/gtf/caenorhabditis_elegans/Caenorhabditis_elegans.WBcel235.71.gtf.gz"
response2a <- GET(url2, write_disk(tempfile()))
response2b <- GET(url2, write_disk(tempfile()))
```
@vjcitn
Copy link
Author

vjcitn commented Oct 11, 2024

Without gdb we see

> rmarkdown::render("curlminitest.Rmd")


processing file: curlminitest.Rmd
  |...................................                 |  67% [unnamed-chunk-1]
 *** caught segfault ***
address (nil), cause 'unknown'

Traceback:
 1: curl::curl_fetch_disk(url, x$path, handle = handle)
 2: request_fetch.write_disk(req$output, req$url, handle)
 3: request_fetch(req$output, req$url, handle)
 4: request_perform(req, hu$handle$handle)
 5: GET(url2, write_disk(tempfile()))
 6: eval(expr, envir)
 7: eval(expr, envir)
 8: withVisible(eval(expr, envir))
 9: withCallingHandlers(code, message = function (cnd) {    watcher$capture_plot_and_output()    if (on_message$capture) {        watcher$push
(cnd)    }    if (on_message$silence) {        invokeRestart("muffleMessage")    }}, warning = function (cnd) {    if (getOption("warn") >= 2 
|| getOption("warn") < 0) {        return()    }    watcher$capture_plot_and_output()    if (on_warning$capture) {        cnd <- sanitize_call
(cnd)        watcher$push(cnd)    }    if (on_warning$silence) {        invokeRestart("muffleWarning")    }}, error = function (cnd) {    watc
her$capture_plot_and_output()    cnd <- sanitize_call(cnd)    watcher$push(cnd)    switch(on_error, continue = invokeRestart("eval_continue"),
         stop = invokeRestart("eval_stop"), error = invokeRestart("eval_error",             cnd))})
10: eval(call)
11: eval(call)
12: with_handlers({    for (expr in tle$exprs) {        ev <- withVisible(eval(expr, envir))        watcher$capture_plot_and_output()        w
atcher$print_value(ev$value, ev$visible, envir)    }    TRUE}, handlers)
13: doWithOneRestart(return(expr), restart)
14: withOneRestart(expr, restarts[[1L]])

@vjcitn
Copy link
Author

vjcitn commented Oct 11, 2024

> sessionInfo()
R version 4.4.1 Patched (2024-09-30 r87215)
Platform: x86_64-pc-linux-gnu
Running under: Ubuntu 24.04.1 LTS

Matrix products: default
BLAS:   /usr/local/lib/R/lib/libRblas.so 
LAPACK: /usr/local/lib/R/lib/libRlapack.so;  LAPACK version 3.12.0

locale:
 [1] LC_CTYPE=C.UTF-8       LC_NUMERIC=C           LC_TIME=C.UTF-8       
 [4] LC_COLLATE=C.UTF-8     LC_MONETARY=C.UTF-8    LC_MESSAGES=C.UTF-8   
 [7] LC_PAPER=C.UTF-8       LC_NAME=C              LC_ADDRESS=C          
[10] LC_TELEPHONE=C         LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C   

time zone: Etc/UTC
tzcode source: system (glibc)

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

other attached packages:
[1] httr_1.4.7       BiocStyle_2.32.1

loaded via a namespace (and not attached):
 [1] digest_0.6.37       R6_2.5.1            bookdown_0.40      
 [4] fastmap_1.2.0       xfun_0.48           cachem_1.1.0       
 [7] knitr_1.48          htmltools_0.5.8.1   rmarkdown_2.28     
[10] lifecycle_1.0.4     cli_3.6.3           sass_0.4.9         
[13] jquerylib_0.1.4     compiler_4.4.1      tools_4.4.1        
[16] curl_5.2.3          evaluate_1.0.1      bslib_0.8.0        
[19] yaml_2.3.10         BiocManager_1.30.25 jsonlite_1.8.9     
[22] rlang_1.1.4   

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment