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

SIGSEGV in release build #508

Closed
apmanol opened this issue Nov 5, 2019 · 15 comments
Closed

SIGSEGV in release build #508

apmanol opened this issue Nov 5, 2019 · 15 comments
Labels

Comments

@apmanol
Copy link

apmanol commented Nov 5, 2019

Hello all,

thanks for this nice piece of software. Just updated in v.4.5.0 and unfortunately my old justfile s start to crash.

gdb --args  /tmp/just/target/release/just  lib_8w
r
Starting program: /tmp/just/target/release/just lib_8w
Missing separate debuginfos, use: dnf debuginfo-install glibc-2.29-22.fc30.x86_64
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
warning: `=` in assignments, exports, and aliases is being phased out on favor of `:=`
Please see this issue for more details: https://github.com/casey/just/issues/379
  |
8 | tool_chain = "-DCMAKE_TOOLCHAIN_FILE=$(realpath ./tools/share/cmake/toolchain-mips.cmake)"
  |            ^
[New Thread 0x7ffff7c22700 (LWP 21546)]
cd lib;CROSS_COMPILE=/opt/cross-mips-wp53/cross.mips/bin/mips-wp53-linux-gnu- MODULE_DEF=1 PRJNAME=W ./libbuild -v -C all && cd ..

Thread 1 "just" received signal SIGSEGV, Segmentation fault.
0x00005555555ac0ab in <&alloc::collections::btree::map::BTreeMap<K,V> as core::iter::traits::collect::IntoIterator>::into_iter ()
Missing separate debuginfos, use: dnf debuginfo-install libgcc-9.2.1-1.fc30.x86_64
(gdb) bt
#0  0x00005555555ac0ab in <&alloc::collections::btree::map::BTreeMap<K,V> as core::iter::traits::collect::IntoIterator>::into_iter ()
#1  0x0000555555592ca3 in <std::process::Command as just::command_ext::CommandExt>::export_environment_variables ()
#2  0x000055555558bc5f in just::recipe::Recipe::run ()
#3  0x00005555555c0b6d in just::justfile::Justfile::run_recipe ()
#4  0x00005555555c0106 in just::justfile::Justfile::run ()
#5  0x0000555555590d70 in just::run::run ()
#6  0x0000555555589387 in just::main ()
#7  0x00005555555893d3 in std::rt::lang_start::{{closure}} ()
#8  0x00005555556e3483 in std::rt::lang_start_internal::{{closure}} () at src/libstd/rt.rs:49
#9  std::panicking::try::do_call () at src/libstd/panicking.rs:296
#10 0x00005555556eb55a in __rust_maybe_catch_panic () at src/libpanic_unwind/lib.rs:80
#11 0x00005555556e3f8d in std::panicking::try () at src/libstd/panicking.rs:275
#12 std::panic::catch_unwind () at src/libstd/panic.rs:394
#13 std::rt::lang_start_internal () at src/libstd/rt.rs:48
#14 0x00005555555893c2 in main ()
(gdb) 

The problem doesn't appear in debug mode.

@casey
Copy link
Owner

casey commented Nov 5, 2019

Ahhh, yikes. Thank you for filing this issue, and sorry for the crash. Let me dig in to this.

@apmanol
Copy link
Author

apmanol commented Nov 5, 2019

Thanks for the prompt answer.

@casey
Copy link
Owner

casey commented Nov 5, 2019

Some questions to help me debug:

  • Which version of just were you using before?
  • Did you build from source, install a binary from the releases page, or install via a package manager? (And if it was from a package manager, which one?)
  • What OS and architecture are you using?
  • Would it be possible to attach the justfile that causes the crash? (Or, if it's sensitive, a snippet of it that causes the crash.)

@casey casey closed this as completed Nov 5, 2019
@casey casey reopened this Nov 5, 2019
@casey
Copy link
Owner

casey commented Nov 5, 2019

Whoops, didn't mean to close.

@apmanol
Copy link
Author

apmanol commented Nov 5, 2019

Some questions to help me debug:

  • Which version of just were you using before?

The previous 0.4.4

  • Did you build from source, install a binary from the releases page, or install via a package manager? (And if it was from a package manager, which one?)

From source, both debug/release versions

  • What OS and architecture are you using?\

Fedora 30, x86

  • Would it be possible to attach the justfile that causes the crash? (Or, if it's sensitive, a snippet of it that causes the crash.)

Sorry but I can't since it contains company internal names etc.

@casey casey added the bug label Nov 5, 2019
@casey
Copy link
Owner

casey commented Nov 5, 2019

Sorry but I can't since it contains company internal names etc.

No worries! Would it be possible to reduce it to just a snippet that causes the crash?

@apmanol
Copy link
Author

apmanol commented Nov 5, 2019

It is just the line in debug output nothing else:

 cat justfile
# Local Variables:
# mode: makefile
# End:
# vim: set ft=make :

#tool_chain = "-DCMAKE_TOOLCHAIN_FILE=$(realpath ./tools/share/cmake/toolchain-mips-wp8.cmake)"
#tool_chain = "-DCMAKE_TOOLCHAIN_FILE=$(realpath ./tools/share/cmake/toolchain-mips-wp8.cmake)"
tool_chain = "-DCMAKE_TOOLCHAIN_FILE=$(realpath ./tools/share/cmake/toolchain-mips-wp9.cmake)"
url:="srv2:/data/git"


lib_8w:
	cd lib;CROSS_COMPILE=/opt/cross-mips-wp53/cross.mips/bin/mips-wp53-linux-gnu- MODULE_DEF=1 PRJNAME=W ./libbuild -v -C all && cd ..

@casey
Copy link
Owner

casey commented Nov 5, 2019

What version of rust and cargo are you using?

It's a segmentation fault inside of a std::collections::btree::map::BTreeMap<K,V>::into_iter(), which makes me think that it might be a bug in rust itself. Barring compiler bugs, it should be impossible to cause a segfault in rust without using unsafe, and Just itself doesn't contain any uses of unsafe. However, it is possible that a dependency is using unsafe, and that dependency has a bug.

@casey
Copy link
Owner

casey commented Nov 5, 2019

I tried building Just v0.4.5 with rust 1.38, and currently nightly, in release mode, and wasn't able to reproduce the crash with the justfile snippet above.

@apmanol
Copy link
Author

apmanol commented Nov 5, 2019

Indeed, I did the same test and had the same result, it seems to work with the nightly.

@casey
Copy link
Owner

casey commented Nov 5, 2019

What's the stable version of rust which crashed?

@apmanol
Copy link
Author

apmanol commented Nov 5, 2019

rustc --version
rustc 1.38.0 (625451e37 2019-09-23)

@casey
Copy link
Owner

casey commented Nov 5, 2019

I tried to reproduce the issue on a linux box (Although it's NixOS, and not Fedora.) and I wasn't able to. I think this is an issue with rustc/cargo itself, and not with Just. I would file an issue on rust-lang/rust, but it might be hard to track down if it isn't reproducible on other machines.

I'm going to close this issue for now, since I think it isn't Just-specific. I might try uninstalling and reinstalling the toolchain, and possibly running cargo clean, just in case it's a transient issue with a corrupted artifact.

@casey casey closed this as completed Nov 5, 2019
@apmanol
Copy link
Author

apmanol commented Nov 5, 2019

Thanks a lot for your effort! I will use the nightly build for now.

@casey
Copy link
Owner

casey commented Nov 5, 2019

My pleasure, and sorry we weren't able to get to the root of the problem!

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

No branches or pull requests

2 participants