-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Segfault when repeatedly calling endpoint and compiled in release mode #790
Comments
Unfortunately we're missing some debug symbols which could tell us where the issue lies. Can you enable debug symbols in release mode and try running valgrind again? See this stackoverflow question for how. |
@SergioBenitez Here is a https://gist.github.com/timvisee/07ce1fb24bd6d2014a07bada9e71e2fd I noticed I can also enable verbose logging, and full leak checking for extra details. If that may be useful, please let me know because these logs seem to be quite big. |
Thanks! This may be related to rust-lang/rust#54478. Please run valgrind with |
@timvisee I tried building your project to diagnose this, but it looks like it requires a native library In any case, I took a closer look at the source of your application. There is no I tried replicating what you have in your source code, minus the parts that touch the SDK, starting a Linux (Debian 9) server on a 24 core machine, and ramming it with 100s of millions of requests to try to elicit a seqfault. Alas, no segfault. I wonder if the use of the native library could be contributing here. One thing I would try is removing all of the calls to In any case, once you're able to run |
@SergioBenitez Thank you for attempting to find the problem so thoroughly. I'm sure you're correct that Rocket shouldn't be the culprit here as it doesn't have any The Leap SDK indeed requires user registration, and it is quite a challenge to install it properly anyway. If you're interested, I pulled the whole Leap SDK out of the project in the As I've mentioned. Fully removing the use of the One interesting finding is that the program doesn't seem to crash anymore when not running it through Anyhow, here are two different segfault traces with the |
Your latest traces from Would it be possible to compile to the |
@jebrosen First of all, thank you for looking into it. Interesting. Are you suggesting that I'll attempt to compile for the |
A minor update. I'm currently testing the project on a different machine (running Manjaro Linux), which shows different problems. First of all, the temporary patch for using the system allocator does not work on this system. It crashes anyway, no matter what allocator is used. Also, the project seems to crash immediately (without sending any request to Rocket) on this machine when I have a Leap Motion device connected to the computer through an USB port, in the project where the When running the project without the
By the way, if you believe I should be searching for the issue somewhere else, because it probably isn't directly related to Rocket, you can close this issue. |
No, not that. In the past I've had valgrind itself crash or mis-report because it didn't understand how jemalloc worked. Either valgrind or jemalloc has changed since and they appear to be compatible right now; I was just trying to point out that some of the reports might (still) be false positives.
I deploy to the Do you have |
I believe that what @jebrosen is suggesting - that Valgrind is causing the segfault due to its strange interactions with jemalloc - is correct (see rust-lang/rust#49183). @timvisee Do you see segfaults or incorrect outputs in your Rocket application, with or without jemalloc, without using valgrind? If not, I think there's sufficient evidence to close this issue. |
Given what we've learned, I'm fairly certain there isn't an issue with Rocket here. As such, I'm closing this out. |
Sadly because I'm quite busy at the moment, I couldn't experiment any further. So, sorry for me not responding. I'm sure you're right though. Thanks a bunch anyway for looking into the problem! |
I seem to be getting a segfault when repeatedly calling a Rocket endpoint, when running a build in release mode. I'm calling this endpoint form a browser using a
axios
GET
request. I'm not quite sure whether Rocket itself is causing this segfault, as I'm not too familiar with debugging and solving these issues. Because of that I'm mostly guessing in the wild and am trying attempting various things, which I'll try to report here. Maybe it's caused by a different crate or by the latest Rust nightly, in which case I will escalate the issue.Simplify endpoint/route
I attempted to simplify the Rocket endpoint as much as possible, by just returning a
Json<bool>
, and without doing any special logic inside the endpoint/route itself. The segfault still kept happening.The endpoint that was still causing segfaults when calling it can be seen here.
System allocator
The project uses the default allocator. Switching to the system allocator using the following code does prevent the segfault from happening. Using this shouldn't however be the solution:
Valgrind
I did run the project through
valgrind
with the default options, and got various different traces. I don't know whether these are useful as I'm not too familiar with these segfaults. Here are two of those traces however:And two other traces (Gist).
Question
So, the question is of course. What is causing these segfaults, and how can we solve it? Is it caused by an issue in Rocket, or in another crate. Or is it my wrongdoing?
I sadly have no idea at all what the cause could be. I saw quite a few
serde
related entries for (de)serializing JSON before thus thought thatserde
was the problem. However, the issue kept occurring when I started returning a plainString
.Version and system information:
v0.4-dev
@f857f81
(from git)Linux 4.15.0-33-generic x86_64
)rustc
rustc 1.31.0-nightly (423d81098 2018-10-08)
cargo
cargo 1.31.0-nightly (ad6e5c003 2018-09-28)
timvisee/cant-touch-this#89af935
Additional notes
--release
mode.46da03c
)String
(with"".into()
) instead of aJson
value doesn't prevent the segfault.valgrind
) logs as I've setlogging
tocritical
.The text was updated successfully, but these errors were encountered: