-
Notifications
You must be signed in to change notification settings - Fork 85
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
Assertion failures when running on Fedora 28 #133
Comments
Can you provide the output of |
Not exactly, because this happens on running
i.e. R aborts and dumps core. However, it seems that building the site with
|
Sorry, I meant, can you run |
Does the crash happen with a bare site -- if you run |
Yes, the The crash also happens with freshly created site. Also, it seems that the older version 1.3.6 of |
One more quick comment: thanks for the detailed report with the stack trace from gdb. Right now I'm trying to figure out a minimal case to reproduce the problem, since I haven't been able to do so locally (on my Mac). Off the top of my head, some variables that might matter are:
And it would also be good to be able to reproduce the problem at a lower level, like with just the servr package, or, even better, just httpuv. Do you know if this problem happens with R 3.5.0 (not patched)? |
I think I tested with R 3.5.0 built from the released tarball (i.e. without patches from svn branch) and got the same crash. However I built those binaries using the RPM spec which by default uses hardening flags. I'll try verifying this, but I think with R built from the sources as such (i.e. the configure && make && make install routine) it worked fine. |
I'm able to reproduce what may be the same problem using
The output:
EDIT: I just realized that the first crash might be because it's already serving the site before I ran |
@jar1karp Can you test if this causes the crash for you with 1.4.2? library(httpuv)
startServer("0.0.0.0", 8000, list())
startServer("0.0.0.0", 8000, list())
startServer("0.0.0.0", 8001, list()) |
No, here's the output
|
OK, I've reproduced the problem using Docker. Dockerfile:
Commands to run:
Visiting http://localhost:4321 with a browser works fine. However, if you try to connect with a websocket, it causes the crash. To do this, run the following in another terminal: R
devtools::install_github('rstudio/websocket')
library(websocket)
ws <- WebsocketClient$new("ws://localhost:4321/",
onOpen = function() cat("Connection opened\n"),
onMessage = function(msg) cat("Client got msg: ", msg, "\n"),
onClose = function() cat("Client disconnected\n")
) Output from running under gdb
|
@jcheng5 and I were able to get a truly minimal C++ example. This works on Linux. test.c: #include <vector>
#include <iostream>
int main() {
std::vector<char> buf;
printf("%p\n", &buf[0]);
return 0;
} Compile and run:
The error:
The problem is that we use the construct |
It looks like that compilation flag was turned on by default in Fedora 28: https://fedoraproject.org/wiki/Changes/HardeningFlags28 |
Fix #133: Assertion failures when running on Fedora 28
Ran into this doing Pro Server work on an Ubuntu Bionic (18) VM, with a Debug build of the product. Server would assert and terminate on startup. This is same issue that httpuv project was hitting here: rstudio/httpuv#133 Debug build uses _GLIBCXX_ASSERTIONS and which asserts on usage of this pattern: &v[0], where "v" is a vector Take address of first element of a potentially empty vector is undefined behavior in C++. Also can't just use vector::data(), because the return value of data() may or may not be nullptr for an empty vector, per C++ docs. (D'oh) So added `safe_vec_addr` as used by httuv. I only fixed the one case that was preventing me from starting the server with a Debug build. I will open an issue to do a comprehensive survey of the codebase to find other potential problems of this sort and/or fix them as I hit them.
Hi,
Below is a backtrace from gdb that I get by calling blogdown::serve_site(). This happens both with version 1.4.2 on CRAN and also if I install latest master from github. I'm running R version 3.5.0 Patched (2018-05-03 r74699) on Fedora 28 x86_64.
In case anyone else has the same problem: this worked previously with httpuv version 1.3.6 and seems that at least temporarily the crash can be avoided by installing the old version by
devtools::install_version('httpuv', '1.3.6')
.The text was updated successfully, but these errors were encountered: