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

segmentation fault on "diesel setup" #700

Open
alexkamp opened this Issue Feb 13, 2017 · 5 comments

Comments

Projects
None yet
4 participants
@alexkamp

alexkamp commented Feb 13, 2017

hey,

When I run "diesel setup" in the docker container https://hub.docker.com/r/liuchong/rustup/, I get a segmentation fault. A (zipped) core dump is attached.

core.zip

Best,
Alex

@sgrif

This comment has been minimized.

Member

sgrif commented Feb 15, 2017

Can you provide additional information, such as the version of Diesel CLI you were using, the version of Rust you were using, and whether DATABASE_URL was pointing at a Postgres, SQLite, or MySQL database?

@alexkamp

This comment has been minimized.

alexkamp commented Feb 16, 2017

I called diesel in a directory which contains a .env file with

DATABASE_URL=postgres://postgres:***@postgres/reminder

(of course the pwd is not ***).

cargo -V
cargo 0.16.0-nightly (6e0c18c 2017-01-27)

rustc -V
rustc 1.15.1 (021bd294c 2017-02-08)

diesel_cli v0.10.1

I just noticed that in fact no diesel-command works. Even diesel -v segfaults. That made me wonder whether there is something fishy about my setup, however, compiling a hello-world with rustc works as expected. Anything more I can try?

@sgrif

This comment has been minimized.

Member

sgrif commented Feb 16, 2017

If you can give a list of steps I could follow to reproduce that would be helpful. I agree that it's probably something fishy with your setup. Maybe try compiling a program that links diesel without using the CLI?

It could also be the loading of one of the c libraries. Do you still see a segfault if you do cargo install diesel_cli --no-default-features --features postges? Do you see it if you run an application linked against pq-sys?

@alexkamp

This comment has been minimized.

alexkamp commented Feb 16, 2017

First of all, thanks for your help!

The behaviour does not change for diesel_cli --no-default-features --features postgres. I can not execute a program which links against pq-sys.

I wrote a docker file and a shell script to reproduce the problem.

The script starts postgreSQL in a Docker container, then it builds a container with rustup and diesel in it, links it to the postgreSQL instance and opens a root shell into the container. On my machine, diesel setup fails within this container.

environment.tar.gz

Please mind:
(1) The script does not tidy up in the end. That is, both docker container and the image stay around.
(2) The script links the project files (an empty project created with cargo) into the container. On my machine, this works only if se linux is disabled.

@killercup killercup added bug cli labels Feb 17, 2017

@dbrgn

This comment has been minimized.

Contributor

dbrgn commented Apr 13, 2017

I'm also having segfaults for docker_cli in a musl based docker image.

Steps to reproduce:

$ docker run --rm -t -i clux/muslrust:stable /bin/bash
root@5caf11686839:/# apt-get update && apt-get install -y postgresql libpq-dev
root@5caf11686839:/# cargo install diesel_cli --no-default-features --features postgres
root@5caf11686839:/# /root/.cargo/bin/diesel 
Segmentation fault (core dumped)

When debugging the coredump:

# gdb /root/.cargo/bin/diesel core.357
Reading symbols from /root/.cargo/bin/diesel...done.
[New LWP 357]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `./diesel'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x0000000000547607 in __vdsosym ()
(gdb) bt
#0  0x0000000000547607 in __vdsosym ()
#1  0x00000000005463d3 in cgt_init ()
#2  0x00007ffc194bdce0 in ?? ()
#3  0x0000000000000000 in ?? ()

Does that help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment