Skip to content
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

Diesel Segfaults on host, but not development machine #813

Closed
skeleten opened this issue Mar 19, 2017 · 31 comments
Closed

Diesel Segfaults on host, but not development machine #813

skeleten opened this issue Mar 19, 2017 · 31 comments

Comments

@skeleten
Copy link

skeleten commented Mar 19, 2017

Hello,
I'm in the progress of writing a small discord bot using diesel.
However my application seems to receive a segfault on my VPS host (uname -a: Linux ubuntu-512mb-fra1-01 4.4.0-67-generic #88-Ubuntu SMP Wed Mar 8 16:34:45 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux; its the smallest size of an digitalocean droplet).
It does not do so on my development machine (uname -a: Linux charon 4.10.2-1-ARCH #1 SMP PREEMPT Mon Mar 13 17:13:41 CET 2017 x86_64 GNU/Linux)

Within GDB I get the following message for the segfautl:

Thread 1 "skellybot" received signal SIGSEGV, Segmentation fault.
0x0000555555a4d5f7 in je_tcache_dalloc_small (binind=<optimized out>, ptr=0x7ffff1ca5880, tcache=0x7ffff1c0c000, tsd=<optimized out>, slow_path=<optimized out>)
at /checkout/src/liballoc_jemalloc/../jemalloc/include/jemalloc/internal/tcache.h:42

bt gives me the following stacktrace:

#0  0x0000555555a4d5f7 in je_tcache_dalloc_small (binind=<optimized out>, ptr=0x7ffff1ca5880, tcache=0x7ffff1c0c000, tsd=<optimized out>, slow_path=<optimized out>)
    at /checkout/src/liballoc_jemalloc/../jemalloc/include/jemalloc/internal/tcache.h:422                                                                           
#1  je_arena_dalloc (tcache=0x7ffff1c0c000, ptr=0x7ffff1ca5880, tsd=<optimized out>, slow_path=<optimized out>)
    at /checkout/src/liballoc_jemalloc/../jemalloc/include/jemalloc/internal/arena.h:1370                      
#2  je_idalloctm (is_metadata=false, tcache=0x7ffff1c0c000, ptr=0x7ffff1ca5880, tsd=<optimized out>, slow_path=<optimized out>) at include/jemalloc/internal/jemalloc_internal.h:1055
#3  je_iqalloc (tcache=0x7ffff1c0c000, ptr=0x7ffff1ca5880, tsd=<optimized out>, slow_path=<optimized out>) at include/jemalloc/internal/jemalloc_internal.h:1079
#4  ifree (slow_path=false, tcache=0x7ffff1c0c000, ptr=0x7ffff1ca5880, tsd=<optimized out>) at /checkout/src/liballoc_jemalloc/../jemalloc/src/jemalloc.c:1819
#5  free (ptr=0x7ffff1ca5880) at /checkout/src/liballoc_jemalloc/../jemalloc/src/jemalloc.c:1922
#6  0x00007ffff7bb09d9 in ?? () from /usr/lib/x86_64-linux-gnu/libpq.so.5
#7  0x0000555555627670 in diesel::pg::connection::raw::{{impl}}::drop (self=0x7fffffff92e0)
    at /home/skeleten/.cargo/registry/src/github.com-1ecc6299db9ec823/diesel-0.11.4/src/pg/connection/raw.rs:95
#8  0x00005555555e53e1 in drop::hc00e4affa891dcbd () at /checkout/src/libcore/iter/iterator.rs:139
#9  0x00005555555e4411 in drop::h82bb99e6329dd1c6 () at /checkout/src/libcore/iter/iterator.rs:139
#10 0x000055555560ee02 in skellybot::user_seen (ctx=0x7fffffffb478, uid=0x7fffffffa1c0) at /home/skeleten/Source/skeleten/skellybot/src/main.rs:139
#11 0x000055555560de02 in skellybot::message_create_event (ctx=0x7fffffffb478, msg=Message = {...}) at /home/skeleten/Source/skeleten/skellybot/src/main.rs:113
#12 0x000055555560c7ee in skellybot::run () at /home/skeleten/Source/skeleten/skellybot/src/main.rs:89
#13 0x000055555560b5e7 in skellybot::main () at /home/skeleten/Source/skeleten/skellybot/src/main.rs:32
#14 0x0000555555a44146 in std::panicking::try::do_call<fn(),()> () at /checkout/src/libstd/panicking.rs:454
#15 0x0000555555a4b4fb in panic_unwind::__rust_maybe_catch_panic () at /checkout/src/libpanic_unwind/lib.rs:98
#16 0x0000555555a44bf7 in std::panicking::try<(),fn()> () at /checkout/src/libstd/panicking.rs:433
#17 std::panic::catch_unwind<fn(),()> () at /checkout/src/libstd/panic.rs:361
#18 std::rt::lang_start () at /checkout/src/libstd/rt.rs:57
#19 0x0000555555615fe3 in main ()

The complete source code I'm runnning can be found under https://github.com/skeleten/skellybot/tree/ece2a04ec61eaa8a1e62ecc3997aa0b7e4e99c6a

The Segfaults happens after receiving the first message which is processed here https://github.com/skeleten/skellybot/blob/ece2a04ec61eaa8a1e62ecc3997aa0b7e4e99c6a/src/main.rs#L111

@killercup
Copy link
Member

I'm really bad at debugging stuff like this, so all I can offer is a bunch of links to source code.

In your stacktrace, I see the following line from diesel

#7  0x0000555555627670 in diesel::pg::connection::raw::{{impl}}::drop (self=0x7fffffff92e0)
   at /home/skeleten/.cargo/registry/src/github.com-1ecc6299db9ec823/diesel-0.11.4/src/pg/connection/raw.rs:95

which is this code:

unsafe { PQfinish(self.internal_connection) };

(Of course the segfault is in unsafe code!)

Looking further, it seems that this drop is called at the end of the user_seen function, when conn goes out of scope. It was called here. The connection comes from this function, which basically just calls diesel's PgConnection::establish(&db_url).

@skeleten
Copy link
Author

The intrigung part in my opinion is, that user_seen executes before (on the ServerCreate event) but only segfaults, when called by the message_create_event function. Is there any additional information I can provide?

@sgrif
Copy link
Member

sgrif commented Mar 19, 2017

Are you compiling on the host itself, or from your development machine? Can you confirm that the versions of libpq are the same?

@skeleten
Copy link
Author

It seems my development machine is using

local/postgresql-libs 9.6.1-3
    Libraries for use with PostgreSQL

while on my host machine it is libpq-dev is 9.5.6-0ubuntu0.16.04

@sgrif
Copy link
Member

sgrif commented Mar 19, 2017

Are you compiling on the host or target? (I don't think that should cause a segfault, but good to rule out)

@sgrif
Copy link
Member

sgrif commented Mar 19, 2017

Also do you know whether the connection actually successfully established or not? Can you check if user_seen was going to return an Ok or Err had it not segfaulted? It seems like the most likely cause is that we're not handling some error condition properly.

@skeleten
Copy link
Author

I'm compiling on my development macheni (as server does not seem to have the resources needed to compile the crate)

@skeleten
Copy link
Author

Stepping through the function with GDB implies its establishing the connection successfully (it does not return early)

@sgrif
Copy link
Member

sgrif commented Mar 19, 2017

Can you try statically linking libpq? (export PQ_LIB_STATIC = 1 and then cargo clean should do it)

@skeleten
Copy link
Author

It seems it won't let me compile on my Arch machine

error: could not find native static library `pq`, perhaps an -L flag is missing?

error: Could not compile `pq-sys`.

This also happens under a OpenSUSE WSL.

@skeleten
Copy link
Author

I updated the postgres version on my host to 9.6.2 and built it on an ubuntu version with the same version. It still segfaults though.

@sgrif
Copy link
Member

sgrif commented Mar 19, 2017

Thanks. You've given me information to reproduce, so I will try to look into it (to be honest though I don't have any ideas). The only thing I can think to try is to compile on your host machine.

@skeleten
Copy link
Author

Trying to compile on my host machine literally runs out of memory :( Maybe I'll upscale it for a bit to try out, though

@skeleten
Copy link
Author

skeleten commented Mar 19, 2017

I did upsize the droplet to be able to actually compile it on the host; it still shows the same behaviour though.
Edit: On my local VM (Ubuntu 16.04) it works seems to work just fine as well.

@sgrif
Copy link
Member

sgrif commented Dec 16, 2017

Closing as this issue has been stale for a while, and there's still nothing actionable we can do. If this issue is still occurring or you can provide additional information, let me know and I'll reopen.

@sgrif sgrif closed this as completed Dec 16, 2017
@gnmerritt
Copy link

I'm seeing what appears to be a similar segfault when running cargo test on travis-ci or in the travis docker container. The tests pass fine on my mac, and it seems that the problem started when I added multiple tests that make PG connections.

Happy to try and help run this down, please let me know what additional information I can provide.

diesel 1.3.3, postgres 9.2.24

$ uname -a
Linux d63a69da3a83 4.9.93-linuxkit-aufs #1 SMP Wed Jun 6 16:55:56 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
$ rustc --version
rustc 1.32.0-nightly (451987d86 2018-11-01)
$ cargo --version
cargo 1.32.0-nightly (1fa308820 2018-10-31)
...
#21 0x00007f9d33a30837 in ?? () from /usr/lib/x86_64-linux-gnu/libpq.so.5
#22 0x00007f9d33a308d6 in PQfinish () from /usr/lib/x86_64-linux-gnu/libpq.so.5
#23 0x000055bae32e2f76 in _$LT$diesel..pg..connection..raw..RawConnection$u20$as$u20$core..ops..drop..Drop$GT$::drop::h9d3078a13338664b (self=0x7f9d23062240)
    at /home/travis/.cargo/registry/src/github.com-1ecc6299db9ec823/diesel-1.3.3/src/pg/connection/raw.rs:101
#24 0x000055bae201746f in core::ptr::drop_in_place::h7521eae5e9bdbb05 () at /rustc/451987d86c89b38ddd8c4c124f1b9b6d4ded6983/src/libcore/ptr.rs:194
...

example failing job on travis: https://travis-ci.org/otterandrye/photothing-api/jobs/449963414

@gnmerritt
Copy link

there's nothing helpful in the DB logs either, just seeing the connections drop when the test binary segfaults:

2018-11-05 03:33:29 UTC LOG: could not receive data from client: Connection reset by peer

@Shnatsel
Copy link

Shnatsel commented Dec 8, 2018

If you could compile Diesel with address sanitizer it might be able to provide more specific information on where and why the segfault is happening. You'll need a nightly compiler and pass one flag to it, see https://github.com/japaric/rust-san for details.

@weiznich
Copy link
Member

weiznich commented Dec 9, 2018

For me this looks like a bug inside of libpq, because if you look at the code we are passing a pointer to PQfinish that is guaranteed to be not null. Therefore it would be great to know what exact version of libpq is causing this.
Additional side node: We are running our tests on travis to, so this seems not to be the only condition to reproduce this.

@gnmerritt
Copy link

gnmerritt commented Dec 9, 2018

I filed an issue against rocket with some more information: rwf2/Rocket#829.

I'll try rust-san next time I'm on the appropriate machine and report back. I've got the failure reproduced in a docker container with my rocket app.

One other thing: I noticed in the libpq docs that you're supposed to call PQfinish even on failed connection attempts so I wonder if that's relevant.

@weiznich
Copy link
Member

weiznich commented Dec 9, 2018

Drop and therefore PQfinish is called in every case if RawConnection goes out of scope, independently if this is an error case, a success case or a panic (if rustc does not use panic=abort)
So for me this is an additional indicator that this may be an issue in libpq or a internal used library. To fill a bug report there we need a reproducible test case for this. The first step there would be to get the exact version of libpq.

@gnmerritt
Copy link

Here's the libpq versions on the container where things are failing:

$ dpkg --list | grep libpq
ii  libpq-dev                                11.0-1.pgdg14.04+2                         amd64        header files for libpq5 (PostgreSQL library)
ii  libpq5:amd64                             11.0-1.pgdg14.04+2                         amd64        PostgreSQL C client library

I'm working on getting the environment needed to reproduce into a Dockerfile, will post here once I've got the same failure.

@gnmerritt
Copy link

Ok, I've got the segfault reproducible in a container. Here's the Dockerfile: https://github.com/gnmerritt/diesel-explosion/blob/master/Dockerfile. It's libpq versions are:

ii  libpq-dev                                11.1-1.pgdg14.04+1                         amd64        header files for libpq5 (PostgreSQL library)
ii  libpq5:amd64                             11.1-1.pgdg14.04+1                         amd64        PostgreSQL C client library

To reproduce you just need to docker build & docker run the container - after it fails you can optionally start a shell and explore with gdb etc. Please let me know if there's anything else I can do to help here, we're well out of my usual comfort zone :-D

@weiznich
Copy link
Member

I've tried to dig a bit into this. The first thing that I've tried was to disable all unrelated tests, till only that one that triggers the bug is left. Turns out that there is no single test triggering this. At least photos::test::photo_create_get and s3::test::upload_unauthorized needs to be run to trigger this. If I run only on of them the segfault does not happen.
So next step was looking at the code of both tests. Turns out only photos::test::photo_create_get does something with a database, the s3 test does not create a database connection. For me that's a sign that the problem is not database related, but somewhere else.
Next thing I've tried was to minimize the code in both test cases. For the photos test, only the setup needs to be run, for the s3 test everything needs to be run. After those changes the segfault only happens sometimes 😟 See the attached patch for the exact changes. If I try to strip down the photos test even more I begin to see OpenSSL related errors:

OpenSSL error 1
BUG: rust-openssl lock 1 already unlocked, aborting
Aborted (core dumped)
OpenSSL error 2
ssl_ciph.c(403): OpenSSL internal error, assertion failed: ssl_mac_secret_size[SSL_MD_MD5_IDX] >= 0
Aborted (core dumped)

Next stop was trying to get some backtraces to see what's exactly happen here. Turns out there are different backtraces for the same crash. All those have in common that the segfault happens inside of jemalloc during deallocation of something. One (the last one) of those backtraces does not show libpq or anything diesel related, so in my opinion this is clearly not diesel related at this point, the error must be somewhere else.

So blind guessing what is happening here: Both, libpq and rusoto seems to depend on openssl. Somehow someone get's openssl into some state that does something really strange (possibly corrupting the allocator??). Therefore the crashes that we observe are only the results of the actual error.

Backtrace 1
#0  0x00005555569ea783 in je_arena_bitselm_get_mutable (chunk=0x7ffff1c00000, pageind=<optimized out>)
    at /rustc/8876906867b2db3c7177d69dd020c40d89177f86/src/liballoc_jemalloc/../jemalloc/include/jemalloc/internal/arena.h:710
#1  je_arena_mapbitsp_get_mutable (chunk=0x7ffff1c00000, pageind=<optimized out>)
    at /rustc/8876906867b2db3c7177d69dd020c40d89177f86/src/liballoc_jemalloc/../jemalloc/include/jemalloc/internal/arena.h:788
#2  je_arena_mapbitsp_get_const (chunk=0x7ffff1c00000, pageind=<optimized out>)
    at /rustc/8876906867b2db3c7177d69dd020c40d89177f86/src/liballoc_jemalloc/../jemalloc/include/jemalloc/internal/arena.h:795
#3  je_arena_mapbits_get (chunk=0x7ffff1c00000, pageind=<optimized out>)
    at /rustc/8876906867b2db3c7177d69dd020c40d89177f86/src/liballoc_jemalloc/../jemalloc/include/jemalloc/internal/arena.h:809
#4  arena_run_reg_dalloc (run=<optimized out>, ptr=<optimized out>)
    at /rustc/8876906867b2db3c7177d69dd020c40d89177f86/src/liballoc_jemalloc/../jemalloc/src/arena.c:306
#5  arena_dalloc_bin_locked_impl (tsdn=<optimized out>, arena=<optimized out>, chunk=<optimized out>, ptr=<optimized out>, bitselm=<optimized out>,
    junked=<optimized out>) at /rustc/8876906867b2db3c7177d69dd020c40d89177f86/src/liballoc_jemalloc/../jemalloc/src/arena.c:2963
#6  0x0000555556a019b7 in je_tcache_bin_flush_small (tsd=<optimized out>, tcache=<optimized out>, tbin=0x7ffff22e42a8, binind=<optimized out>, rem=10)
    at /rustc/8876906867b2db3c7177d69dd020c40d89177f86/src/liballoc_jemalloc/../jemalloc/src/tcache.c:137
#7  0x00005555569dff8c in je_tcache_dalloc_small (tsd=0x7ffff1c00000, tcache=<optimized out>, ptr=<optimized out>, binind=20, slow_path=false)
    at /rustc/8876906867b2db3c7177d69dd020c40d89177f86/src/liballoc_jemalloc/../jemalloc/include/jemalloc/internal/tcache.h:419
#8  je_arena_dalloc (tsdn=<optimized out>, ptr=<optimized out>, tcache=<optimized out>, slow_path=false)
    at /rustc/8876906867b2db3c7177d69dd020c40d89177f86/src/liballoc_jemalloc/../jemalloc/include/jemalloc/internal/arena.h:1441
#9  je_idalloctm (is_metadata=false, slow_path=false, tsdn=<optimized out>, ptr=<optimized out>, tcache=<optimized out>)
    at include/jemalloc/internal/jemalloc_internal.h:1170
#10 je_iqalloc (tsd=<optimized out>, ptr=<optimized out>, tcache=<optimized out>, slow_path=<optimized out>)
    at include/jemalloc/internal/jemalloc_internal.h:1187
#11 ifree (tsd=<optimized out>, ptr=<optimized out>, tcache=<optimized out>, slow_path=<optimized out>)
    at /rustc/8876906867b2db3c7177d69dd020c40d89177f86/src/liballoc_jemalloc/../jemalloc/src/jemalloc.c:1896
#12 0x0000555556912645 in _$LT$diesel..pg..connection..raw..RawConnection$u20$as$u20$core..ops..drop..Drop$GT$::drop::h03caa4735911d86e (self=0x7ffff1c3c300)
    at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/diesel-1.3.3/src/pg/connection/raw.rs:101
#13 0x000055555575dbfe in core::ptr::drop_in_place::h9acbcd85800b00a4 () at libcore/ptr.rs:194
#14 0x0000555555756aa1 in core::ptr::drop_in_place::h04c2dc3962a5d1f7 () at libcore/ptr.rs:194
#15 0x00005555557579fe in core::ptr::drop_in_place::h1e2f8d0938f10505 () at libcore/ptr.rs:194
#16 0x000055555575e3be in core::ptr::drop_in_place::ha2e9101fbdea6a2a () at libcore/ptr.rs:194
#17 0x000055555575923d in core::ptr::drop_in_place::h42cc81964b1f195e () at libcore/ptr.rs:194
#18 0x00005555556b3b7c in _$LT$alloc..vec..Vec$LT$T$GT$$u20$as$u20$core..ops..drop..Drop$GT$::drop::hd46f22b389075231 (self=0x7ffff1cf8bb0)
    at liballoc/vec.rs:2108
#19 0x0000555555759a01 in core::ptr::drop_in_place::h4a35b8241e83c0ab () at libcore/ptr.rs:194
#20 0x000055555575ff41 in core::ptr::drop_in_place::hc0444852ccad62a7 () at libcore/ptr.rs:194
#21 0x000055555575e06e in core::ptr::drop_in_place::h9de0a46a68ac3b72 () at libcore/ptr.rs:194
#22 0x000055555575fcd4 in core::ptr::drop_in_place::hbbff7e05e32b76eb () at libcore/ptr.rs:194
#23 0x000055555575793e in core::ptr::drop_in_place::h1a968a0ac74f0681 () at libcore/ptr.rs:194
#24 0x000055555575d024 in core::ptr::drop_in_place::h8f7222ad5e89af57 () at libcore/ptr.rs:194
#25 0x00005555557bd539 in _$LT$alloc..sync..Arc$LT$T$GT$$GT$::drop_slow::he1a7f7be16948ef1 (self=0x7ffff21fcf78) at liballoc/sync.rs:535
#26 0x00005555557bdb48 in _$LT$alloc..sync..Arc$LT$T$GT$$u20$as$u20$core..ops..drop..Drop$GT$::drop::h4bb6017166197e6e (self=0x7ffff21fcf78)
    at liballoc/sync.rs:986
#27 0x000055555575703e in core::ptr::drop_in_place::h0e05b11abafd7c66 () at libcore/ptr.rs:194
#28 0x000055555575da1e in core::ptr::drop_in_place::h987a6d498314de68 () at libcore/ptr.rs:194
#29 0x000055555566b333 in photothing_api::photos::test::setup::h51c6ea83ff6502ca () at src/photos.rs:89
#30 0x000055555566b6a4 in photothing_api::photos::test::photo_create_get::h2a3c0f07075334d1 () at src/photos.rs:94
#31 0x0000555555805022 in photothing_api::photos::test::photo_create_get::_$u7b$$u7b$closure$u7d$$u7d$::h4f2d22478459737e () at src/photos.rs:93
#32 0x0000555555755dbe in core::ops::function::FnOnce::call_once::h72028cabb6f107ca () at libcore/ops/function.rs:238
#33 0x000055555582ad4f in {{closure}} () at libtest/lib.rs:1468
#34 call_once<closure,()> () at libcore/ops/function.rs:238
#35 _$LT$F$u20$as$u20$alloc..boxed..FnBox$LT$A$GT$$GT$::call_box::he56a774394cbb882 () at liballoc/boxed.rs:661
Backtrace 2
#0  0x00005555569ea783 in je_arena_bitselm_get_mutable (chunk=0x7fffecc00000, pageind=<optimized out>)
    at /rustc/8876906867b2db3c7177d69dd020c40d89177f86/src/liballoc_jemalloc/../jemalloc/include/jemalloc/internal/arena.h:710
#1  je_arena_mapbitsp_get_mutable (chunk=0x7fffecc00000, pageind=<optimized out>)
    at /rustc/8876906867b2db3c7177d69dd020c40d89177f86/src/liballoc_jemalloc/../jemalloc/include/jemalloc/internal/arena.h:788
#2  je_arena_mapbitsp_get_const (chunk=0x7fffecc00000, pageind=<optimized out>)
    at /rustc/8876906867b2db3c7177d69dd020c40d89177f86/src/liballoc_jemalloc/../jemalloc/include/jemalloc/internal/arena.h:795
#3  je_arena_mapbits_get (chunk=0x7fffecc00000, pageind=<optimized out>)
    at /rustc/8876906867b2db3c7177d69dd020c40d89177f86/src/liballoc_jemalloc/../jemalloc/include/jemalloc/internal/arena.h:809
#4  arena_run_reg_dalloc (run=<optimized out>, ptr=<optimized out>)
    at /rustc/8876906867b2db3c7177d69dd020c40d89177f86/src/liballoc_jemalloc/../jemalloc/src/arena.c:306
#5  arena_dalloc_bin_locked_impl (tsdn=<optimized out>, arena=<optimized out>, chunk=<optimized out>, ptr=<optimized out>, bitselm=<optimized out>,
    junked=<optimized out>) at /rustc/8876906867b2db3c7177d69dd020c40d89177f86/src/liballoc_jemalloc/../jemalloc/src/arena.c:2963
#6  0x0000555556a019b7 in je_tcache_bin_flush_small (tsd=<optimized out>, tcache=<optimized out>, tbin=0x7ffff22e4068, binind=<optimized out>, rem=100)
    at /rustc/8876906867b2db3c7177d69dd020c40d89177f86/src/liballoc_jemalloc/../jemalloc/src/tcache.c:137
#7  0x00005555569dff8c in je_tcache_dalloc_small (tsd=0x7fffecc00000, tcache=<optimized out>, ptr=<optimized out>, binind=2, slow_path=false)
    at /rustc/8876906867b2db3c7177d69dd020c40d89177f86/src/liballoc_jemalloc/../jemalloc/include/jemalloc/internal/tcache.h:419
#8  je_arena_dalloc (tsdn=<optimized out>, ptr=<optimized out>, tcache=<optimized out>, slow_path=false)
    at /rustc/8876906867b2db3c7177d69dd020c40d89177f86/src/liballoc_jemalloc/../jemalloc/include/jemalloc/internal/arena.h:1441
#9  je_idalloctm (is_metadata=false, slow_path=false, tsdn=<optimized out>, ptr=<optimized out>, tcache=<optimized out>)
    at include/jemalloc/internal/jemalloc_internal.h:1170
#10 je_iqalloc (tsd=<optimized out>, ptr=<optimized out>, tcache=<optimized out>, slow_path=<optimized out>)
    at include/jemalloc/internal/jemalloc_internal.h:1187
#11 ifree (tsd=<optimized out>, ptr=<optimized out>, tcache=<optimized out>, slow_path=<optimized out>)
    at /rustc/8876906867b2db3c7177d69dd020c40d89177f86/src/liballoc_jemalloc/../jemalloc/src/jemalloc.c:1896
#12 0x00007ffff77fe00d in CRYPTO_free () from /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
#13 0x00007ffff78a599d in ASN1_primitive_free () from /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
#14 0x00007ffff78a5d0f in ASN1_template_free () from /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
#15 0x00007ffff78a5baa in ?? () from /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
#16 0x00007ffff78a5d0f in ASN1_template_free () from /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
#17 0x00007ffff78a5baa in ?? () from /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
#18 0x00007ffff78a5d0f in ASN1_template_free () from /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
#19 0x00007ffff78a5baa in ?? () from /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
#20 0x00007ffff78a5c65 in ASN1_item_free () from /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
#21 0x00007ffff757bff3 in ?? () from /usr/lib/x86_64-linux-gnu/libpq.so.5
#22 0x00007ffff7563756 in ?? () from /usr/lib/x86_64-linux-gnu/libpq.so.5
#23 0x00007ffff7563837 in ?? () from /usr/lib/x86_64-linux-gnu/libpq.so.5
#24 0x00007ffff75638d6 in PQfinish () from /usr/lib/x86_64-linux-gnu/libpq.so.5
#25 0x0000555556912645 in _$LT$diesel..pg..connection..raw..RawConnection$u20$as$u20$core..ops..drop..Drop$GT$::drop::h03caa4735911d86e (self=0x7ffff1c3c240)
    at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/diesel-1.3.3/src/pg/connection/raw.rs:101
#26 0x000055555575dbfe in core::ptr::drop_in_place::h9acbcd85800b00a4 () at libcore/ptr.rs:194
#27 0x0000555555756aa1 in core::ptr::drop_in_place::h04c2dc3962a5d1f7 () at libcore/ptr.rs:194
#28 0x00005555557579fe in core::ptr::drop_in_place::h1e2f8d0938f10505 () at libcore/ptr.rs:194
#29 0x000055555575e3be in core::ptr::drop_in_place::ha2e9101fbdea6a2a () at libcore/ptr.rs:194
#30 0x000055555575923d in core::ptr::drop_in_place::h42cc81964b1f195e () at libcore/ptr.rs:194
#31 0x00005555556b3b7c in _$LT$alloc..vec..Vec$LT$T$GT$$u20$as$u20$core..ops..drop..Drop$GT$::drop::hd46f22b389075231 (self=0x7ffff1cf8bb0)
    at liballoc/vec.rs:2108
#32 0x0000555555759a01 in core::ptr::drop_in_place::h4a35b8241e83c0ab () at libcore/ptr.rs:194
#33 0x000055555575ff41 in core::ptr::drop_in_place::hc0444852ccad62a7 () at libcore/ptr.rs:194
#34 0x000055555575e06e in core::ptr::drop_in_place::h9de0a46a68ac3b72 () at libcore/ptr.rs:194
#35 0x000055555575fcd4 in core::ptr::drop_in_place::hbbff7e05e32b76eb () at libcore/ptr.rs:194
#36 0x000055555575793e in core::ptr::drop_in_place::h1a968a0ac74f0681 () at libcore/ptr.rs:194
Backtrace 3
#0  0x00005555569ea783 in je_arena_bitselm_get_mutable (chunk=0x7ffff1600000, pageind=<optimized out>)
    at /rustc/8876906867b2db3c7177d69dd020c40d89177f86/src/liballoc_jemalloc/../jemalloc/include/jemalloc/internal/arena.h:710
#1  je_arena_mapbitsp_get_mutable (chunk=0x7ffff1600000, pageind=<optimized out>)
    at /rustc/8876906867b2db3c7177d69dd020c40d89177f86/src/liballoc_jemalloc/../jemalloc/include/jemalloc/internal/arena.h:788
#2  je_arena_mapbitsp_get_const (chunk=0x7ffff1600000, pageind=<optimized out>)
    at /rustc/8876906867b2db3c7177d69dd020c40d89177f86/src/liballoc_jemalloc/../jemalloc/include/jemalloc/internal/arena.h:795
#3  je_arena_mapbits_get (chunk=0x7ffff1600000, pageind=<optimized out>)
    at /rustc/8876906867b2db3c7177d69dd020c40d89177f86/src/liballoc_jemalloc/../jemalloc/include/jemalloc/internal/arena.h:809
#4  arena_run_reg_dalloc (run=<optimized out>, ptr=<optimized out>)
    at /rustc/8876906867b2db3c7177d69dd020c40d89177f86/src/liballoc_jemalloc/../jemalloc/src/arena.c:306
#5  arena_dalloc_bin_locked_impl (tsdn=<optimized out>, arena=<optimized out>, chunk=<optimized out>, ptr=<optimized out>, bitselm=<optimized out>,
    junked=<optimized out>) at /rustc/8876906867b2db3c7177d69dd020c40d89177f86/src/liballoc_jemalloc/../jemalloc/src/arena.c:2963
#6  0x0000555556a019b7 in je_tcache_bin_flush_small (tsd=<optimized out>, tcache=<optimized out>, tbin=0x7ffff22e42a8, binind=<optimized out>, rem=0)
    at /rustc/8876906867b2db3c7177d69dd020c40d89177f86/src/liballoc_jemalloc/../jemalloc/src/tcache.c:137
#7  0x0000555556a02781 in tcache_destroy (tsd=0x7ffff21ff4f8, tcache=0x7ffff22e4000)
    at /rustc/8876906867b2db3c7177d69dd020c40d89177f86/src/liballoc_jemalloc/../jemalloc/src/tcache.c:371
#8  0x0000555556a025a5 in je_tcache_cleanup (tsd=0x7ffff21ff4f8)
    at /rustc/8876906867b2db3c7177d69dd020c40d89177f86/src/liballoc_jemalloc/../jemalloc/src/tcache.c:410
#9  0x0000555556a02efc in je_tsd_cleanup (arg=0x7ffff21ff4f8) at /rustc/8876906867b2db3c7177d69dd020c40d89177f86/src/liballoc_jemalloc/../jemalloc/src/tsd.c:82
#10 0x00007ffff6f33f82 in __nptl_deallocate_tsd () at pthread_create.c:158
#11 0x00007ffff6f34197 in start_thread (arg=0x7ffff21ff700) at pthread_create.c:325
#12 0x00007ffff6a4b03d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

cc @sfackler as openssl maintainer (because of the rust-openssl error while minimizing), @matthewkmayer as rusoto maintainer (because the second required test depends heavily on rusoto)

@matthewkmayer
Copy link

This looks like an interesting bug!

Let's try using rustls with 0.35.0 of Rusoto). That should remove any use of openssl from Rusoto, thus reducing the suspected areas of code. That should let us figure out where this issue should be filed, since it doesn't appear to be a diesel issue. 😄

@gnmerritt
Copy link

gnmerritt commented Dec 11, 2018

I'll give rusttls a try now and report back.

Other random piece of intel: this seems to have something to do with the travis-ci containers, I wasn't able to reproduce the segfault with either of FROM debian:sid or FROM debian:testing in the docker image.

@weiznich
Copy link
Member

I've managed to write a "simple" program that reproduces this issue:

// diesel = {version = "=1.3.3", features = ["postgres", "r2d2"]}
extern crate diesel;
// reqwest = "=0.9.5"
extern crate reqwest;

use std::thread;
use std::env;
use reqwest::Client;
use diesel::r2d2::*;
use diesel::*;

type PgPool = Pool<ConnectionManager<PgConnection>>;

pub fn init_db_pool() -> PgPool {
    let db = env::var("DATABASE_URL").expect("missing database url");
    let manager = ConnectionManager::<PgConnection>::new(db);
    Pool::new(manager).expect("db pool")
}

fn request() {
        let url = "https://google.com";
        let _res = Client::new().put(url)
            .body("some content")
            .send()
            .expect("request failed");
}

fn main() {
        for i in 0..10 {
                println!("Try {:?}", i);
                let b = thread::spawn(|| {request()});
                let a = thread::spawn(|| {let _ = init_db_pool();});
                a.join();
                b.join();
        }
}

Running this code in the docker container provided above does the following for me:

  • Dead lock
  • Segfault with various stack traces

(This does also happen on newer nightlies, so this does not depend on the rustc version)

@matthewkmayer This means this is not a rusoto issue
@seanmonstar Any idea on this (The second part is reqwest).

@Munksgaard
Copy link

Munksgaard commented Jun 18, 2019

I've run into a similar issue (and mistakenly opened #2092). Here's my code to reproduce:

use diesel::pg::PgConnection;
use diesel::connection::Connection;

fn main() {
    let connection = PgConnection::establish("postgres://USER:PASSWORD@localhost/")
        .unwrap_or_else(|e| panic!("Error connecting to database, {:?}", e));

    let res = reqwest::get("https://example.com").unwrap();

    panic!("");
}

Two funny parts: Removing the reqwest-part causes the program to fail normally, and leaving out the password/username of the postgres connection string also causes the program to fail normally.

Edit:
These are the dependencies used:

reqwest = "0.9.18"
diesel = { version = "1.4.2", features = ["postgres"] }

@Munksgaard
Copy link

Munksgaard commented Jun 20, 2019

Actually, I don't even need the panic in there:

use diesel::pg::PgConnection;
use diesel::connection::Connection;

fn main() {
    let connection = PgConnection::establish("postgres://USER:PASSWORD@localhost/")
        .unwrap_or_else(|e| panic!("Error connecting to database, {:?}", e));

    let res = reqwest::get("https://example.com").unwrap();
}

The code above is still failing for me.

More details
$ cargo run
   Compiling diesel-bug v0.1.0 (/home/munksgaard/tmp/reqwest-bug)
warning: unused variable: `connection`
 --> src/main.rs:5:9
  |
5 |     let connection = PgConnection::establish("postgres://munksgaard:xyz@localhost/")
  |         ^^^^^^^^^^ help: consider prefixing with an underscore: `_connection`
  |
  = note: #[warn(unused_variables)] on by default

warning: unused variable: `res`
 --> src/main.rs:8:9
  |
8 |     let res = reqwest::get("https://example.com").unwrap();
  |         ^^^ help: consider prefixing with an underscore: `_res`

    Finished dev [unoptimized + debuginfo] target(s) in 8.14s
     Running `target/debug/diesel-bug`
*** Error in `target/debug/diesel-bug': free(): invalid size: 0x000055e6ac20e480 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7f5800aff7e5]
/lib/x86_64-linux-gnu/libc.so.6(+0x8037a)[0x7f5800b0837a]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7f5800b0c53c]
/usr/lib/x86_64-linux-gnu/libpq.so.5(+0xb930)[0x7f580169c930]
target/debug/diesel-bug(_ZN84_$LT$diesel..pg..connection..raw..RawConnection$u20$as$u20$core..ops..drop..Drop$GT$4drop17haffb5d1d3d8c27c4E+0x27)[0x55e6ab901d77]
target/debug/diesel-bug(+0x2780cf)[0x55e6ab1bb0cf]
target/debug/diesel-bug(+0x277fa1)[0x55e6ab1bafa1]
target/debug/diesel-bug(+0x27a882)[0x55e6ab1bd882]
target/debug/diesel-bug(+0x277590)[0x55e6ab1ba590]
target/debug/diesel-bug(+0x9da8b3)[0x55e6ab91d8b3]
target/debug/diesel-bug(__rust_maybe_catch_panic+0x1a)[0x55e6ab921bda]
target/debug/diesel-bug(_ZN3std2rt19lang_start_internal17heab3881d5637455dE+0x35d)[0x55e6ab91e47d]
target/debug/diesel-bug(+0x277569)[0x55e6ab1ba569]
target/debug/diesel-bug(+0x27a8ca)[0x55e6ab1bd8ca]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7f5800aa8830]
target/debug/diesel-bug(+0x277419)[0x55e6ab1ba419]
======= Memory map: ========
55e6aaf43000-55e6abb43000 r-xp 00000000 00:2b 1078985                    /home/munksgaard/tmp/reqwest-bug/target/debug/diesel-bug
55e6abd42000-55e6abdaa000 r--p 00bff000 00:2b 1078985                    /home/munksgaard/tmp/reqwest-bug/target/debug/diesel-bug
55e6abdaa000-55e6abdab000 rw-p 00c67000 00:2b 1078985                    /home/munksgaard/tmp/reqwest-bug/target/debug/diesel-bug
55e6ac1bd000-55e6ac226000 rw-p 00000000 00:00 0                          [heap]
7f57dc000000-7f57dc021000 rw-p 00000000 00:00 0 
7f57dc021000-7f57e0000000 ---p 00000000 00:00 0 
7f57e4000000-7f57e4021000 rw-p 00000000 00:00 0 
7f57e4021000-7f57e8000000 ---p 00000000 00:00 0 
7f57e8000000-7f57e8021000 rw-p 00000000 00:00 0 
7f57e8021000-7f57ec000000 ---p 00000000 00:00 0 
7f57ec000000-7f57ec021000 rw-p 00000000 00:00 0 
7f57ec021000-7f57f0000000 ---p 00000000 00:00 0 
7f57f4000000-7f57f4109000 rw-p 00000000 00:00 0 
7f57f4109000-7f57f8000000 ---p 00000000 00:00 0 
7f57fad09000-7f57fad0e000 r-xp 00000000 08:01 4199562                    /lib/x86_64-linux-gnu/libnss_dns-2.23.so
7f57fad0e000-7f57faf0e000 ---p 00005000 08:01 4199562                    /lib/x86_64-linux-gnu/libnss_dns-2.23.so
7f57faf0e000-7f57faf0f000 r--p 00005000 08:01 4199562                    /lib/x86_64-linux-gnu/libnss_dns-2.23.so
7f57faf0f000-7f57faf10000 rw-p 00006000 08:01 4199562                    /lib/x86_64-linux-gnu/libnss_dns-2.23.so
7f57faf10000-7f57faf12000 r-xp 00000000 08:01 4198928                    /lib/x86_64-linux-gnu/libnss_mdns4_minimal.so.2
7f57faf12000-7f57fb111000 ---p 00002000 08:01 4198928                    /lib/x86_64-linux-gnu/libnss_mdns4_minimal.so.2
7f57fb111000-7f57fb112000 r--p 00001000 08:01 4198928                    /lib/x86_64-linux-gnu/libnss_mdns4_minimal.so.2
7f57fb112000-7f57fb113000 rw-p 00002000 08:01 4198928                    /lib/x86_64-linux-gnu/libnss_mdns4_minimal.so.2
7f57fb113000-7f57fb114000 ---p 00000000 00:00 0 
7f57fb114000-7f57fb314000 rw-p 00000000 00:00 0 
7f57fb314000-7f57fb315000 ---p 00000000 00:00 0 
7f57fb315000-7f57fb515000 rw-p 00000000 00:00 0 
7f57fb515000-7f57fb516000 ---p 00000000 00:00 0 
7f57fb516000-7f57fb716000 rw-p 00000000 00:00 0 
7f57fb716000-7f57fb717000 ---p 00000000 00:00 0 
7f57fb717000-7f57fb917000 rw-p 00000000 00:00 0 
7f57fb917000-7f57fb918000 ---p 00000000 00:00 0 
7f57fb918000-7f57fbb18000 rw-p 00000000 00:00 0 
7f57fbb18000-7f57fbb23000 r-xp 00000000 08:01 4199564                    /lib/x86_64-linux-gnu/libnss_nis-2.23.so
7f57fbb23000-7f57fbd22000 ---p 0000b000 08:01 4199564                    /lib/x86_64-linux-gnu/libnss_nis-2.23.so
7f57fbd22000-7f57fbd23000 r--p 0000a000 08:01 4199564                    /lib/x86_64-linux-gnu/libnss_nis-2.23.so
7f57fbd23000-7f57fbd24000 rw-p 0000b000 08:01 4199564                    /lib/x86_64-linux-gnu/libnss_nis-2.23.so
7f57fbd24000-7f57fbd3a000 r-xp 00000000 08:01 4199574                    /lib/x86_64-linux-gnu/libnsl-2.23.so
7f57fbd3a000-7f57fbf39000 ---p 00016000 08:01 4199574                    /lib/x86_64-linux-gnu/libnsl-2.23.so
7f57fbf39000-7f57fbf3a000 r--p 00015000 08:01 4199574                    /lib/x86_64-linux-gnu/libnsl-2.23.so
7f57fbf3a000-7f57fbf3b000 rw-p 00016000 08:01 4199574                    /lib/x86_64-linux-gnu/libnsl-2.23.so
7f57fbf3b000-7f57fbf3d000 rw-p 00000000 00:00 0 
7f57fbf3d000-7f57fbf45000 r-xp 00000000 08:01 4199586                    /lib/x86_64-linux-gnu/libnss_compat-2.23.so
7f57fbf45000-7f57fc144000 ---p 00008000 08:01 4199586                    /lib/x86_64-linux-gnu/libnss_compat-2.23.so
7f57fc144000-7f57fc145000 r--p 00007000 08:01 4199586                    /lib/x86_64-linux-gnu/libnss_compat-2.23.so
7f57fc145000-7f57fc146000 rw-p 00008000 08:01 4199586                    /lib/x86_64-linux-gnu/libnss_compat-2.23.so
7f57fc146000-7f57fc151000 r-xp 00000000 08:01 4199578                    /lib/x86_64-linux-gnu/libnss_files-2.23.so
7f57fc151000-7f57fc350000 ---p 0000b000 08:01 4199578                    /lib/x86_64-linux-gnu/libnss_files-2.23.so
7f57fc350000-7f57fc351000 r--p 0000a000 08:01 4199578                    /lib/x86_64-linux-gnu/libnss_files-2.23.so
7f57fc351000-7f57fc352000 rw-p 0000b000 08:01 4199578                    /lib/x86_64-linux-gnu/libnss_files-2.23.so
7f57fc352000-7f57fc358000 rw-p 00000000 00:00 0 
7f57fc358000-7f57fc35f000 r-xp 00000000 08:01 5513482                    /usr/lib/x86_64-linux-gnu/libffi.so.6.0.4
7f57fc35f000-7f57fc55e000 ---p 00007000 08:01 5513482                    /usr/lib/x86_64-linux-gnu/libffi.so.6.0.4
7f57fc55e000-7f57fc55f000 r--p 00006000 08:01 5513482                    /usr/lib/x86_64-linux-gnu/libffi.so.6.0.4
7f57fc55f000-7f57fc560000 rw-p 00007000 08:01 5513482                    /usr/lib/x86_64-linux-gnu/libffi.so.6.0.4
7f57fc560000-7f57fc569000 r-xp 00000000 08:01 4199572                    /lib/x86_64-linux-gnu/libcrypt-2.23.so
7f57fc569000-7f57fc768000 ---p 00009000 08:01 4199572                    /lib/x86_64-linux-gnu/libcrypt-2.23.so
7f57fc768000-7f57fc769000 r--p 00008000 08:01 4199572                    /lib/x86_64-linux-gnu/libcrypt-2.23.so
7f57fc769000-7f57fc76a000 rw-p 00009000 08:01 4199572                    /lib/x86_64-linux-gnu/libcrypt-2.23.so
7f57fc76a000-7f57fc798000 rw-p 00000000 00:00 0 
7f57fc798000-7f57fc867000 r-xp 00000000 08:01 5510127                    /usr/lib/x86_64-linux-gnu/libsqlite3.so.0.8.6
7f57fc867000-7f57fca66000 ---p 000cf000 08:01 5510127                    /usr/lib/x86_64-linux-gnu/libsqlite3.so.0.8.6
7f57fca66000-7f57fca69000 r--p 000ce000 08:01 5510127                    /usr/lib/x86_64-linux-gnu/libsqlite3.so.0.8.6
7f57fca69000-7f57fca6b000 rw-p 000d1000 08:01 5510127                    /usr/lib/x86_64-linux-gnu/libsqlite3.so.0.8.6
7f57fca6b000-7f57fca6c000 rw-p 00000000 00:00 0 
7f57fca6c000-7f57fcab3000 r-xp 00000000 08:01 5514391                    /usr/lib/x86_64-linux-gnu/libhx509.so.5.0.0
7f57fcab3000-7f57fccb2000 ---p 00047000 08:01 5514391                    /usr/lib/x86_64-linux-gnu/libhx509.so.5.0.0
7f57fccb2000-7f57fccb4000 r--p 00046000 08:01 5514391                    /usr/lib/x86_64-linux-gnu/libhx509.so.5.0.0
7f57fccb4000-7f57fccb6000 rw-p 00048000 08:01 5514391                    /usr/lib/x86_64-linux-gnu/libhx509.so.5.0.0
7f57fccb6000-7f57fccb7000 rw-p 00000000 00:00 0 
7f57fccb7000-7f57fccc5000 r-xp 00000000 08:01 5523342                    /usr/lib/x86_64-linux-gnu/libheimbase.so.1.0.0
7f57fccc5000-7f57fcec4000 ---p 0000e000 08:01 5523342                    /usr/lib/x86_64-linux-gnu/libheimbase.so.1.0.0
7f57fcec4000-7f57fcec5000 r--p 0000d000 08:01 5523342                    /usr/lib/x86_64-linux-gnu/libheimbase.so.1.0.0
7f57fcec5000-7f57fcec6000 rw-p 0000e000 08:01 5523342                    /usr/lib/x86_64-linux-gnu/libheimbase.so.1.0.0
7f57fcec6000-7f57fceed000 r-xp 00000000 08:01 5523347                    /usr/lib/x86_64-linux-gnu/libwind.so.0.0.0
7f57fceed000-7f57fd0ed000 ---p 00027000 08:01 5523347                    /usr/lib/x86_64-linux-gnu/libwind.so.0.0.0
7f57fd0ed000-7f57fd0ee000 r--p 00027000 08:01 5523347                    /usr/lib/x86_64-linux-gnu/libwind.so.0.0.0
7f57fd0ee000-7f57fd0ef000 rw-p 00028000 08:01 5523347                    /usr/lib/x86_64-linux-gnu/libwind.so.0.0.0
7f57fd0ef000-7f57fd16e000 r-xp 00000000 08:01 5513615                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.3.0
7f57fd16e000-7f57fd36d000 ---p 0007f000 08:01 5513615                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.3.0
7f57fd36d000-7f57fd36e000 r--p 0007e000 08:01 5513615                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.3.0
7f57fd36e000-7f57fd36f000 rw-p 0007f000 08:01 5513615                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.3.0
7f57fd36f000-7f57fd3a1000 r-xp 00000000 08:01 5509104                    /usr/lib/x86_64-linux-gnu/libhogweed.so.4.2
7f57fd3a1000-7f57fd5a0000 ---p 00032000 08:01 5509104                    /usr/lib/x86_64-linux-gnu/libhogweed.so.4.2
7f57fd5a0000-7f57fd5a1000 r--p 00031000 08:01 5509104                    /usr/lib/x86_64-linux-gnu/libhogweed.so.4.2
7f57fd5a1000-7f57fd5a2000 rw-p 00032000 08:01 5509104                    /usr/lib/x86_64-linux-gnu/libhogweed.so.4.2
7f57fd5a2000-7f57fd5d6000 r-xp 00000000 08:01 5509107                    /usr/lib/x86_64-linux-gnu/libnettle.so.6.2
7f57fd5d6000-7f57fd7d5000 ---p 00034000 08:01 5509107                    /usr/lib/x86_64-linux-gnu/libnettle.so.6.2
7f57fd7d5000-7f57fd7d7000 r--p 00033000 08:01 5509107                    /usr/lib/x86_64-linux-gnu/libnettle.so.6.2
7f57fd7d7000-7f57fd7d8000 rw-p 00035000 08:01 5509107                    /usr/lib/x86_64-linux-gnu/libnettle.so.6.2
7f57fd7d8000-7f57fd7e9000 r-xp 00000000 08:01 5505213                    /usr/lib/x86_64-linux-gnu/libtasn1.so.6.5.1
7f57fd7e9000-7f57fd9e9000 ---p 00011000 08:01 5505213                    /usr/lib/x86_64-linux-gnu/libtasn1.so.6.5.1
7f57fd9e9000-7f57fd9ea000 r--p 00011000 08:01 5505213                    /usr/lib/x86_64-linux-gnu/libtasn1.so.6.5.1
7f57fd9ea000-7f57fd9eb000 rw-p 00012000 08:01 5505213                    /usr/lib/x86_64-linux-gnu/libtasn1.so.6.5.1
7f57fd9eb000-7f57fda1c000 r-xp 00000000 08:01 5509928                    /usr/lib/x86_64-linux-gnu/libidn.so.11.6.15
7f57fda1c000-7f57fdc1c000 ---p 00031000 08:01 5509928                    /usr/lib/x86_64-linux-gnu/libidn.so.11.6.15
7f57fdc1c000-7f57fdc1d000 r--p 00031000 08:01 5509928                    /usr/lib/x86_64-linux-gnu/libidn.so.11.6.15
7f57fdc1d000-7f57fdc1e000 rw-p 00032000 08:01 5509928                    /usr/lib/x86_64-linux-gnu/libidn.so.11.6.15
7f57fdc1e000-7f57fdc77000 r-xp 00000000 08:01 5514504                    /usr/lib/x86_64-linux-gnu/libp11-kit.so.0.1.0
7f57fdc77000-7f57fde76000 ---p 00059000 08:01 5514504                    /usr/lib/x86_64-linux-gnu/libp11-kit.so.0.1.0
7f57fde76000-7f57fde80000 r--p 00058000 08:01 5514504                    /usr/lib/x86_64-linux-gnu/libp11-kit.so.0.1.0
7f57fde80000-7f57fde82000 rw-p 00062000 08:01 5514504                    /usr/lib/x86_64-linux-gnu/libp11-kit.so.0.1.0
7f57fde82000-7f57fde9b000 r-xp 00000000 08:01 4194332                    /lib/x86_64-linux-gnu/libz.so.1.2.8
7f57fde9b000-7f57fe09a000 ---p 00019000 08:01 4194332                    /lib/x86_64-linux-gnu/libz.so.1.2.8
7f57fe09a000-7f57fe09b000 r--p 00018000 08:01 4194332                    /lib/x86_64-linux-gnu/libz.so.1.2.8
7f57fe09b000-7f57fe09c000 rw-p 00019000 08:01 4194332                    /lib/x86_64-linux-gnu/libz.so.1.2.8
7f57fe09c000-7f57fe0b1000 r-xp 00000000 08:01 5505376                    /usr/lib/x86_64-linux-gnu/libroken.so.18.1.0
7f57fe0b1000-7f57fe2b0000 ---p 00015000 08:01 5505376                    /usr/lib/x86_64-linux-gnu/libroken.so.18.1.0
7f57fe2b0000-7f57fe2b1000 r--p 00014000 08:01 5505376                    /usr/lib/x86_64-linux-gnu/libroken.so.18.1.0
7f57fe2b1000-7f57fe2b2000 rw-p 00015000 08:01 5505376                    /usr/lib/x86_64-linux-gnu/libroken.so.18.1.0
7f57fe2b2000-7f57fe2e2000 r-xp 00000000 08:01 5513189                    /usr/lib/x86_64-linux-gnu/libhcrypto.so.4.1.0
7f57fe2e2000-7f57fe4e2000 ---p 00030000 08:01 5513189                    /usr/lib/x86_64-linux-gnu/libhcrypto.so.4.1.0
7f57fe4e2000-7f57fe4e3000 r--p 00030000 08:01 5513189                    /usr/lib/x86_64-linux-gnu/libhcrypto.so.4.1.0
7f57fe4e3000-7f57fe4e4000 rw-p 00031000 08:01 5513189                    /usr/lib/x86_64-linux-gnu/libhcrypto.so.4.1.0
7f57fe4e4000-7f57fe4e5000 rw-p 00000000 00:00 0 
7f57fe4e5000-7f57fe584000 r-xp 00000000 08:01 5523338                    /usr/lib/x86_64-linux-gnu/libasn1.so.8.0.0
7f57fe584000-7f57fe783000 ---p 0009f000 08:01 5523338                    /usr/lib/x86_64-linux-gnu/libasn1.so.8.0.0
7f57fe783000-7f57fe784000 r--p 0009e000 08:01 5523338                    /usr/lib/x86_64-linux-gnu/libasn1.so.8.0.0
7f57fe784000-7f57fe787000 rw-p 0009f000 08:01 5523338                    /usr/lib/x86_64-linux-gnu/libasn1.so.8.0.0
7f57fe787000-7f57fe80b000 r-xp 00000000 08:01 5523353                    /usr/lib/x86_64-linux-gnu/libkrb5.so.26.0.0
7f57fe80b000-7f57fea0a000 ---p 00084000 08:01 5523353                    /usr/lib/x86_64-linux-gnu/libkrb5.so.26.0.0
7f57fea0a000-7f57fea0d000 r--p 00083000 08:01 5523353                    /usr/lib/x86_64-linux-gnu/libkrb5.so.26.0.0
7f57fea0d000-7f57fea10000 rw-p 00086000 08:01 5523353                    /usr/lib/x86_64-linux-gnu/libkrb5.so.26.0.0
7f57fea10000-7f57fea11000 rw-p 00000000 00:00 0 
7f57fea11000-7f57fea19000 r-xp 00000000 08:01 5513840                    /usr/lib/x86_64-linux-gnu/libheimntlm.so.0.1.0
7f57fea19000-7f57fec18000 ---p 00008000 08:01 5513840                    /usr/lib/x86_64-linux-gnu/libheimntlm.so.0.1.0
7f57fec18000-7f57fec19000 r--p 00007000 08:01 5513840                    /usr/lib/x86_64-linux-gnu/libheimntlm.so.0.1.0
7f57fec19000-7f57fec1a000 rw-p 00008000 08:01 5513840                    /usr/lib/x86_64-linux-gnu/libheimntlm.so.0.1.0
7f57fec1a000-7f57fec1d000 r-xp 00000000 08:01 4198884                    /lib/x86_64-linux-gnu/libkeyutils.so.1.5
7f57fec1d000-7f57fee1c000 ---p 00003000 08:01 4198884                    /lib/x86_64-linux-gnu/libkeyutils.so.1.5
7f57fee1c000-7f57fee1d000 r--p 00002000 08:01 4198884                    /lib/x86_64-linux-gnu/libkeyutils.so.1.5
7f57fee1d000-7f57fee1e000 rw-p 00003000 08:01 4198884                    /lib/x86_64-linux-gnu/libkeyutils.so.1.5
7f57fee1e000-7f57fef41000 r-xp 00000000 08:01 5505921                    /usr/lib/x86_64-linux-gnu/libgnutls.so.30.6.2
7f57fef41000-7f57ff140000 ---p 00123000 08:01 5505921                    /usr/lib/x86_64-linux-gnu/libgnutls.so.30.6.2
7f57ff140000-7f57ff14b000 r--p 00122000 08:01 5505921                    /usr/lib/x86_64-linux-gnu/libgnutls.so.30.6.2
7f57ff14b000-7f57ff14d000 rw-p 0012d000 08:01 5505921                    /usr/lib/x86_64-linux-gnu/libgnutls.so.30.6.2
7f57ff14d000-7f57ff14e000 rw-p 00000000 00:00 0 
7f57ff14e000-7f57ff18b000 r-xp 00000000 08:01 5523361                    /usr/lib/x86_64-linux-gnu/libgssapi.so.3.0.0
7f57ff18b000-7f57ff38b000 ---p 0003d000 08:01 5523361                    /usr/lib/x86_64-linux-gnu/libgssapi.so.3.0.0
7f57ff38b000-7f57ff38c000 r--p 0003d000 08:01 5523361                    /usr/lib/x86_64-linux-gnu/libgssapi.so.3.0.0
7f57ff38c000-7f57ff38e000 rw-p 0003e000 08:01 5523361                    /usr/lib/x86_64-linux-gnu/libgssapi.so.3.0.0
7f57ff38e000-7f57ff38f000 rw-p 00000000 00:00 0 
7f57ff38f000-7f57ff3a8000 r-xp 00000000 08:01 5508482                    /usr/lib/x86_64-linux-gnu/libsasl2.so.2.0.25
7f57ff3a8000-7f57ff5a8000 ---p 00019000 08:01 5508482                    /usr/lib/x86_64-linux-gnu/libsasl2.so.2.0.25
7f57ff5a8000-7f57ff5a9000 r--p 00019000 08:01 5508482                    /usr/lib/x86_64-linux-gnu/libsasl2.so.2.0.25
7f57ff5a9000-7f57ff5aa000 rw-p 0001a000 08:01 5508482                    /usr/lib/x86_64-linux-gnu/libsasl2.so.2.0.25
7f57ff5aa000-7f57ff5c1000 r-xp 00000000 08:01 4199570                    /lib/x86_64-linux-gnu/libresolv-2.23.so
7f57ff5c1000-7f57ff7c1000 ---p 00017000 08:01 4199570                    /lib/x86_64-linux-gnu/libresolv-2.23.so
7f57ff7c1000-7f57ff7c2000 r--p 00017000 08:01 4199570                    /lib/x86_64-linux-gnu/libresolv-2.23.so
7f57ff7c2000-7f57ff7c3000 rw-p 00018000 08:01 4199570                    /lib/x86_64-linux-gnu/libresolv-2.23.so
7f57ff7c3000-7f57ff7c5000 rw-p 00000000 00:00 0 
7f57ff7c5000-7f57ff7d2000 r-xp 00000000 08:01 5506897                    /usr/lib/x86_64-linux-gnu/liblber-2.4.so.2.10.5
7f57ff7d2000-7f57ff9d2000 ---p 0000d000 08:01 5506897                    /usr/lib/x86_64-linux-gnu/liblber-2.4.so.2.10.5
7f57ff9d2000-7f57ff9d3000 r--p 0000d000 08:01 5506897                    /usr/lib/x86_64-linux-gnu/liblber-2.4.so.2.10.5
7f57ff9d3000-7f57ff9d4000 rw-p 0000e000 08:01 5506897                    /usr/lib/x86_64-linux-gnu/liblber-2.4.so.2.10.5
7f57ff9d4000-7f57ff9de000 r-xp 00000000 08:01 5508815                    /usr/lib/x86_64-linux-gnu/libkrb5support.so.0.1
7f57ff9de000-7f57ffbdd000 ---p 0000a000 08:01 5508815                    /usr/lib/x86_64-linux-gnu/libkrb5support.so.0.1
7f57ffbdd000-7f57ffbde000 r--p 00009000 08:01 5508815                    /usr/lib/x86_64-linux-gnu/libkrb5support.so.0.1
7f57ffbde000-7f57ffbdf000 rw-p 0000a000 08:01 5508815                    /usr/lib/x86_64-linux-gnu/libkrb5support.so.0.1
7f57ffbdf000-7f57ffbe2000 r-xp 00000000 08:01 4198832                    /lib/x86_64-linux-gnu/libcom_err.so.2.1
7f57ffbe2000-7f57ffde1000 ---p 00003000 08:01 4198832                    /lib/x86_64-linux-gnu/libcom_err.so.2.1
7f57ffde1000-7f57ffde2000 r--p 00002000 08:01 4198832                    /lib/x86_64-linux-gnu/libcom_err.so.2.1
7f57ffde2000-7f57ffde3000 rw-p 00003000 08:01 4198832                    /lib/x86_64-linux-gnu/libcom_err.so.2.1
7f57ffde3000-7f57ffe0f000 r-xp 00000000 08:01 5508816                    /usr/lib/x86_64-linux-gnu/libk5crypto.so.3.1
7f57ffe0f000-7f580000e000 ---p 0002c000 08:01 5508816                    /usr/lib/x86_64-linux-gnu/libk5crypto.so.3.1
7f580000e000-7f5800010000 r--p 0002b000 08:01 5508816                    /usr/lib/x86_64-linux-gnu/libk5crypto.so.3.1
7f5800010000-7f5800011000 rw-p 0002d000 08:01 5508816                    /usr/lib/x86_64-linux-gnu/libk5crypto.so.3.1
7f5800011000-7f5800012000 rw-p 00000000 00:00 0 
7f5800012000-7f58000d5000 r-xp 00000000 08:01 5507212                    /usr/lib/x86_64-linux-gnu/libkrb5.so.3.3
7f58000d5000-7f58002d5000 ---p 000c3000 08:01 5507212                    /usr/lib/x86_64-linux-gnu/libkrb5.so.3.3
7f58002d5000-7f58002e2000 r--p 000c3000 08:01 5507212                    /usr/lib/x86_64-linux-gnu/libkrb5.so.3.3
7f58002e2000-7f58002e4000 rw-p 000d0000 08:01 5507212                    /usr/lib/x86_64-linux-gnu/libkrb5.so.3.3
7f58002e4000-7f5800331000 r-xp 00000000 08:01 5506901                    /usr/lib/x86_64-linux-gnu/libldap_r-2.4.so.2.10.5
7f5800331000-7f5800530000 ---p 0004d000 08:01 5506901                    /usr/lib/x86_64-linux-gnu/libldap_r-2.4.so.2.10.5
7f5800530000-7f5800532000 r--p 0004c000 08:01 5506901                    /usr/lib/x86_64-linux-gnu/libldap_r-2.4.so.2.10.5
7f5800532000-7f5800533000 rw-p 0004e000 08:01 5506901                    /usr/lib/x86_64-linux-gnu/libldap_r-2.4.so.2.10.5
7f5800533000-7f5800535000 rw-p 00000000 00:00 0 
7f5800535000-7f580057c000 r-xp 00000000 08:01 5506824                    /usr/lib/x86_64-linux-gnu/libgssapi_krb5.so.2.2
7f580057c000-7f580077b000 ---p 00047000 08:01 5506824                    /usr/lib/x86_64-linux-gnu/libgssapi_krb5.so.2.2
7f580077b000-7f580077d000 r--p 00046000 08:01 5506824                    /usr/lib/x86_64-linux-gnu/libgssapi_krb5.so.2.2
7f580077d000-7f580077f000 rw-p 00048000 08:01 5506824                    /usr/lib/x86_64-linux-gnu/libgssapi_krb5.so.2.2
7f580077f000-7f5800887000 r-xp 00000000 08:01 4199590                    /lib/x86_64-linux-gnu/libm-2.23.so
7f5800887000-7f5800a86000 ---p 00108000 08:01 4199590                    /lib/x86_64-linux-gnu/libm-2.23.so
7f5800a86000-7f5800a87000 r--p 00107000 08:01 4199590                    /lib/x86_64-linux-gnu/libm-2.23.so
7f5800a87000-7f5800a88000 rw-p 00108000 08:01 4199590                    /lib/x86_64-linux-gnu/libm-2.23.so
7f5800a88000-7f5800c48000 r-xp 00000000 08:01 4199584                    /lib/x86_64-linux-gnu/libc-2.23.so
7f5800c48000-7f5800e48000 ---p 001c0000 08:01 4199584                    /lib/x86_64-linux-gnu/libc-2.23.so
7f5800e48000-7f5800e4c000 r--p 001c0000 08:01 4199584                    /lib/x86_64-linux-gnu/libc-2.23.so
7f5800e4c000-7f5800e4e000 rw-p 001c4000 08:01 4199584                    /lib/x86_64-linux-gnu/libc-2.23.so
7f5800e4e000-7f5800e52000 rw-p 00000000 00:00 0 
7f5800e52000-7f5800e68000 r-xp 00000000 08:01 4198861                    /lib/x86_64-linux-gnu/libgcc_s.so.1
7f5800e68000-7f5801067000 ---p 00016000 08:01 4198861                    /lib/x86_64-linux-gnu/libgcc_s.so.1
7f5801067000-7f5801068000 rw-p 00015000 08:01 4198861                    /lib/x86_64-linux-gnu/libgcc_s.so.1
7f5801068000-7f5801080000 r-xp 00000000 08:01 4199558                    /lib/x86_64-linux-gnu/libpthread-2.23.so
7f5801080000-7f580127f000 ---p 00018000 08:01 4199558                    /lib/x86_64-linux-gnu/libpthread-2.23.so
7f580127f000-7f5801280000 r--p 00017000 08:01 4199558                    /lib/x86_64-linux-gnu/libpthread-2.23.so
7f5801280000-7f5801281000 rw-p 00018000 08:01 4199558                    /lib/x86_64-linux-gnu/libpthread-2.23.so
7f5801281000-7f5801285000 rw-p 00000000 00:00 0 
7f5801285000-7f580128c000 r-xp 00000000 08:01 4198980                    /lib/x86_64-linux-gnu/librt-2.23.so
7f580128c000-7f580148b000 ---p 00007000 08:01 4198980                    /lib/x86_64-linux-gnu/librt-2.23.so
7f580148b000-7f580148c000 r--p 00006000 08:01 4198980                    /lib/x86_64-linux-gnu/librt-2.23.so
7f580148c000-7f580148d000 rw-p 00007000 08:01 4198980                    /lib/x86_64-linux-gnu/librt-2.23.so
7f580148d000-7f5801490000 r-xp 00000000 08:01 4199554                    /lib/x86_64-linux-gnu/libdl-2.23.so
7f5801490000-7f580168f000 ---p 00003000 08:01 4199554                    /lib/x86_64-linux-gnu/libdl-2.23.so
7f580168f000-7f5801690000 r--p 00002000 08:01 4199554                    /lib/x86_64-linux-gnu/libdl-2.23.so
7f5801690000-7f5801691000 rw-p 00003000 08:01 4199554                    /lib/x86_64-linux-gnu/libdl-2.23.so
7f5801691000-7f58016d6000 r-xp 00000000 08:01 5507070                    /usr/lib/x86_64-linux-gnu/libpq.so.5.11
7f58016d6000-7f58018d6000 ---p 00045000 08:01 5507070                    /usr/lib/x86_64-linux-gnu/libpq.so.5.11
7f58018d6000-7f58018d9000 r--p 00045000 08:01 5507070                    /usr/lib/x86_64-linux-gnu/libpq.so.5.11
7f58018d9000-7f58018da000 rw-p 00048000 08:01 5507070                    /usr/lib/x86_64-linux-gnu/libpq.so.5.11
7f58018da000-7f5801af5000 r-xp 00000000 08:01 4194333                    /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
7f5801af5000-7f5801cf4000 ---p 0021b000 08:01 4194333                    /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
7f5801cf4000-7f5801d10000 r--p 0021a000 08:01 4194333                    /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
7f5801d10000-7f5801d1c000 rw-p 00236000 08:01 4194333                    /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
7f5801d1c000-7f5801d1f000 rw-p 00000000 00:00 0 
7f5801d1f000-7f5801d7d000 r-xp 00000000 08:01 4194367                    /lib/x86_64-linux-gnu/libssl.so.1.0.0
7f5801d7d000-7f5801f7d000 ---p 0005e000 08:01 4194367                    /lib/x86_64-linux-gnu/libssl.so.1.0.0
7f5801f7d000-7f5801f81000 r--p 0005e000 08:01 4194367                    /lib/x86_64-linux-gnu/libssl.so.1.0.0
7f5801f81000-7f5801f88000 rw-p 00062000 08:01 4194367                    /lib/x86_64-linux-gnu/libssl.so.1.0.0
7f5801f88000-7f5801fae000 r-xp 00000000 08:01 4199556                    /lib/x86_64-linux-gnu/ld-2.23.so
7f580216f000-7f5802182000 rw-p 00000000 00:00 0 
7f58021a9000-7f58021ad000 rw-p 00000000 00:00 0 
7f58021ad000-7f58021ae000 r--p 00025000 08:01 4199556                    /lib/x86_64-linux-gnu/ld-2.23.so
7f58021ae000-7f58021af000 rw-p 00026000 08:01 4199556                    /lib/x86_64-linux-gnu/ld-2.23.so
7f58021af000-7f58021b0000 rw-p 00000000 00:00 0 
7fff523dd000-7fff523ff000 rw-p 00000000 00:00 0                          [stack]
7fff52569000-7fff5256c000 r--p 00000000 00:00 0                          [vvar]
7fff5256c000-7fff5256e000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
Aborted (core dumped)

@weiznich
Copy link
Member

@Munksgaard There is not much the diesel team can do here.
As far as I remember my debugging results from last December this is caused by a wired interaction inside of openssl which is used by libpq and reqwest.
One possible solution is to enable the native-tls feature on reqwest to remove openssl there.

@Munksgaard
Copy link

@weiznich As far as I can see there's no native-tls feature on reqwest 0.9.18. There's default-tls, default-tls-vendored and rustls-tls. It sounds like the default (default-tls) is to use the native-tls library. I'm having the same problem with either of those features.

I understand that you don't have a lot of options here, but it's nice to get these things noted for anyone else with the same problem. I still don't quite understand why such a simple program crashes everything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants