gdal icon indicating copy to clipboard operation
gdal copied to clipboard

Run tests with ASan to debug spurious failure

Open frewsxcv opened this issue 4 years ago • 7 comments

Background: https://github.com/georust/gdal/pull/164#issuecomment-783607743

We should try turning on the address sanitizer (ASan) in CI to see if anything helpful surfaces: https://doc.rust-lang.org/beta/unstable-book/compiler-flags/sanitizer.html

frewsxcv avatar Feb 22 '21 19:02 frewsxcv

this is a good idea. how would we add it to CI?

jdroenner avatar Feb 23 '21 07:02 jdroenner

#0  0x00007f9f54343a7b in void std::vector<WMSMiniDriverFactory*, std::allocator<WMSMiniDriverFactory*> >::_M_realloc_insert<WMSMiniDriverFactory* const&>(__gnu_cxx::__normal_iterator<WMSMiniDriverFactory**, std::vector<WMSMiniDriverFactory*, std::allocator<WMSMiniDriverFactory*> > >, WMSMiniDriverFactory* const&) () from /usr/lib/libgdal.so.26
#1  0x00007f9f543439be in WMSMiniDriverManager::Register(WMSMiniDriverFactory*) () from /usr/lib/libgdal.so.26
#2  0x00007f9f54551281 in GDALRegister_WMS () from /usr/lib/libgdal.so.26
#3  0x00007f9f5421e3fa in GDALAllRegister () from /usr/lib/libgdal.so.26
#4  0x0000561ff9a6194a in gdal::driver::_register_drivers::{{closure}} () at /home/me/Projects/georust/gdal/src/driver.rs:19
#5  0x0000561ff9a69977 in std::sync::once::{{impl}}::call_once::{{closure}}<closure-0> () at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sync/once.rs:261
#6  0x0000561ff9b47be2 in std::sync::once::Once::call_inner () at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d//library/std/src/sync/once.rs:418
#7  0x0000561ff9a698ff in std::sync::once::Once::call_once<closure-0> (self=0x561ff9bdb0d0 <gdal::driver::START>, f=...) at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sync/once.rs:261
#8  0x0000561ff9a760e3 in gdal::driver::_register_drivers () at /home/me/Projects/georust/gdal/src/driver.rs:18
#9  0x0000561ff9a76123 in gdal::driver::Driver::get (name=...) at /home/me/Projects/georust/gdal/src/driver.rs:31
#10 0x0000561ff9a26b53 in gdal::raster::tests::test_create () at /home/me/Projects/georust/gdal/src/raster/tests.rs:190
#11 0x0000561ff9a47b6d in gdal::raster::tests::test_create::{{closure}} () at /home/me/Projects/georust/gdal/src/raster/tests.rs:189
#12 0x0000561ff9a69c5e in core::ops::function::FnOnce::call_once<closure-0,()> () at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:227
#13 0x0000561ff9aba966 in core::ops::function::FnOnce::call_once<fn(),()> () at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/core/src/ops/function.rs:227
#14 test::__rust_begin_short_backtrace<fn()> () at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d//library/test/src/lib.rs:568
#15 0x0000561ff9ab8fbe in alloc::boxed::{{impl}}::call_once<(),FnOnce<()>,alloc::alloc::Global> () at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/alloc/src/boxed.rs:1546
#16 std::panic::{{impl}}::call_once<(),alloc::boxed::Box<FnOnce<()>, alloc::alloc::Global>> () at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/std/src/panic.rs:344
#17 std::panicking::try::do_call<std::panic::AssertUnwindSafe<alloc::boxed::Box<FnOnce<()>, alloc::alloc::Global>>,()> () at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/std/src/panicking.rs:379
#18 std::panicking::try<(),std::panic::AssertUnwindSafe<alloc::boxed::Box<FnOnce<()>, alloc::alloc::Global>>> () at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/std/src/panicking.rs:343
#19 std::panic::catch_unwind<std::panic::AssertUnwindSafe<alloc::boxed::Box<FnOnce<()>, alloc::alloc::Global>>,()> () at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/std/src/panic.rs:431
#20 test::run_test_in_process () at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d//library/test/src/lib.rs:590
#21 test::run_test::run_test_inner::{{closure}} () at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d//library/test/src/lib.rs:487
#22 0x0000561ff9a9061a in test::run_test::run_test_inner::{{closure}} () at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d//library/test/src/lib.rs:512
#23 std::sys_common::backtrace::__rust_begin_short_backtrace<closure-1,()> () at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/std/src/sys_common/backtrace.rs:125
#24 0x0000561ff9a94fa6 in std::thread::{{impl}}::spawn_unchecked::{{closure}}::{{closure}}<closure-1,()> () at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/std/src/thread/mod.rs:474
#25 std::panic::{{impl}}::call_once<(),closure-0> () at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/std/src/panic.rs:344
#26 std::panicking::try::do_call<std::panic::AssertUnwindSafe<closure-0>,()> () at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/std/src/panicking.rs:379
#27 std::panicking::try<(),std::panic::AssertUnwindSafe<closure-0>> () at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/std/src/panicking.rs:343
#28 std::panic::catch_unwind<std::panic::AssertUnwindSafe<closure-0>,()> () at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/std/src/panic.rs:431
#29 std::thread::{{impl}}::spawn_unchecked::{{closure}}<closure-1,()> () at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/std/src/thread/mod.rs:473
#30 core::ops::function::FnOnce::call_once<closure-0,()> () at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/core/src/ops/function.rs:227
#31 0x0000561ff9b5155a in alloc::boxed::{{impl}}::call_once<(),FnOnce<()>,alloc::alloc::Global> () at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/alloc/src/boxed.rs:1546
#32 alloc::boxed::{{impl}}::call_once<(),alloc::boxed::Box<FnOnce<()>, alloc::alloc::Global>,alloc::alloc::Global> () at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/alloc/src/boxed.rs:1546
#33 std::sys::unix::thread::{{impl}}::new::thread_start () at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d//library/std/src/sys/unix/thread.rs:71
#34 0x00007f9f53acc299 in start_thread () from /usr/lib/libpthread.so.0
#35 0x00007f9f538a7053 in clone () from /usr/lib/libc.so.6

lnicola avatar Feb 23 '21 07:02 lnicola

Looks like we have two _register_drivers functions.

lnicola avatar Feb 23 '21 07:02 lnicola

Last time I tried, using ASAN from Rust was pretty painful, so maybe we can punt on this until the next intermittent failure.

lnicola avatar Feb 23 '21 07:02 lnicola

Opened a draft PR with ASan support if anyone is curious what the changes would be like: https://github.com/georust/gdal/pull/167

frewsxcv avatar Feb 23 '21 15:02 frewsxcv

We should definitely run our CI with a leak check so that we don't need manually overseeing all potential VSIFrees and GDALAttributeReleases.

Why don't we just fix a nightly for that and quarterly update the nightly?

ChristianBeilschmidt avatar Jan 27 '22 09:01 ChristianBeilschmidt

Is this covered by https://github.com/georust/gdal/pull/398?

metasim avatar May 22 '23 19:05 metasim