rstudio / httpuv

HTTP and WebSocket server package for R
Other
229 stars 86 forks source link

Fix #133: Assertion failures when running on Fedora 28 #136

Closed jcheng5 closed 6 years ago

jcheng5 commented 6 years ago

The issue was due to an idiom we were using all over the place, to get a pointer to the head of a std::vector:

std::vector<char> buf;
char* pBuf = &buf[0];

This fails on Fedora 28 due to _GLIBCXX_ASSERTIONS being defined, which causes std::vector to range check on indexing operations.

Test notes

Use this Dockerfile:

FROM fedora:latest

RUN dnf install -y R pandoc gdb
# If you have weird compile problems, it might be because -j4 causes the container
# to run out of memory. You can reduce the number or coment this out if needed.
RUN echo "MAKEFLAGS=-j4" > ~/.Renviron
RUN R -e "install.packages('shiny', repos = c(CRAN='https://cloud.r-project.org'), INSTALL_opts = '--no-help --no-html')"

Build the docker image:

docker build -t r-fedora .

Run the docker image:

docker run --rm -ti -p 4321:4321 --security-opt seccomp=unconfined r-fedora /bin/bash

Run a Shiny app using:

R --quiet -e 'shiny::runExample("01_hello", host = "0.0.0.0", port = 4321L, launch.browser = FALSE)'

Then launch a web browser and point it to http://localhost:4321. It should fail and crash R.

Now install the fix:

R --quiet -e 'install.packages("remotes", repos = c(CRAN="https://cloud.r-project.org")); remotes::install_github("rstudio/httpuv@joe/bugfix/safe-addr")'

and run the Shiny app again. This time it should work.

jcheng5 commented 6 years ago

@wch I think this is the only sane path forward; I'm not going to make a separate PR that suppresses it.