-
Notifications
You must be signed in to change notification settings - Fork 423
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
Set up an automated valgrind test #69
Comments
It is always a good idea to run code/tests through valgrind. One could simply run the current tests (without docs) through valgrind, and add more that use yet uncovered code path. Something interesting too would be to add code coverage to make sure as much as possible is covered. And then even fuzzing; I've heard good things of |
Note that jemalloc removed valgrind support (see jemalloc/jemalloc@9a8add1) but this does not seems to be included in rust's version of a jemalloc. Rust uses jemalloc @ 33184bf69813087bf1885b0993685f9d03320c69 plus a couple of patches, which is jemalloc 4.1.0 plus four patches. |
Well, I read this recent blog post on using Valgrind for this very purpose, and we are still advised to change the memory allocation system (using the nightly |
Great read, thanks. Maybe an optional combination |
We might copy the suggestion at rust-lang/rust#28224 (comment), which is to add a
Then we can build on the nightly channel with |
So I've experimented running the tests through valgrind, but it's not as trivial as it looks. First, as mentioned above, using jemalloc (the default memory allocator in rust) will confuse valgrind. So one has to build the tests using the system allocator, which is only available when using a nightly build of rust. This means Travis would need to be setup to run nightly, possibly in addition to stable rust. Second (and most importantly), we don't want to run cargo through valgrind, but the tests binaries. This means the command used to run the tests should not be something like "Normally" people would run valgrind directly on the test binaries, for example
Cargo will set a working environment for the binaries so it can run them. It also knows exactly what to run. So it's sad that can't directly run Instead of using valgrind, we could try out the different sanitizers as provided by llvm. See here for more information: https://github.com/japaric/rust-san
when adding a simple This is not perfect; the implementation is not bug free nor finished. I'm also not seeing where the allocation was performed (as shown in the link example) but at least it's catching it. What I think should be done is to first extend the Travis configuration to allow stable/beta/nightly rust. This would allow adding more testing pieces, like sanitizers or valgrind. I'll open a PR about this. |
I'd like to see how a compiler-based sanitizer works when interacting with code it didn't compile, i.e. what happens when we allocate something through libtensorflow.so and then don't release that. I assume that the offsets in that stack trace could be traced back to a line of code via |
This partially addresses tensorflow#69, but it requires us to build TensorFlow from source, which is too slow to do on Travis.
This partially addresses tensorflow#69, but it requires us to build TensorFlow from source, which is too slow to do on Travis.
This partially addresses tensorflow#69, but it requires us to build TensorFlow from source, which is too slow to do on Travis.
* As part of tensorflow#69 refactor to break views from core dataset manipulation * tensorflow#69 Allow for navigatable data sets that are wide
Not usually necessary for Rust, but since we're doing a lot of unsafe stuff with pointers, we should have a valgrind test. Ideally, Travis would run it and fail the build if there are issues.
The text was updated successfully, but these errors were encountered: