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

rustc::middle::typeck::check::regionmanip debug! output attempt diverges on libstd.rs #10037

Closed
pnkfelix opened this issue Oct 23, 2013 · 5 comments

Comments

@pnkfelix
Copy link
Member

Configure invocation:
configure --enable-debug --enable-optimize --enable-ccache --enable-clang --prefix=~/opt/rust-dbg

Command line:

% RUST_LOG=rustc::middle::typeck::check::regionmanip ../../rust-clean/objdir-dbgopt/x86_64-apple-darwin/stage1/bin/rustc --cfg stage1  -O --cfg rtopt --cfg debug -Z no-debug-borrows --target=x86_64-apple-darwin  -D warnings --out-dir x86_64-apple-darwin/stage1/lib/rustc/x86_64-apple-darwin/lib /Users/pnkfelix/Dev/Mozilla/rust.git/src/libstd/std.rs

(End of) output:

result of replace_bound_regions_in_fn_sig: new_self_ty=None, fn_sig=fn[<V7959>, <V7960>, <V7961>, <V7962>, <V7963>, <V7964>] -> <V7965>
replace_bound_regions_in_fn_sig(self_ty=None, fn_sig=fn[<V7959>, <V7960>, <V7961>, <V7962>, <V7963>, <V7964>] -> <V7965>, all_tys=~[~"<V7959>", ~"<V7960>", ~"<V7961>", ~"<V7962>", ~"<V7963>", ~"<V7964>", ~"<V7965>"])
result of replace_bound_regions_in_fn_sig: new_self_ty=None, fn_sig=fn[<V7959>, <V7960>, <V7961>, <V7962>, <V7963>, <V7964>] -> <V7965>
replace_bound_regions_in_fn_sig(self_ty=None, fn_sig=fn[<V7956>, <V7957>] -> <V7958>, all_tys=~[~"<V7956>", ~"<V7957>", ~"<V7958>"])
result of replace_bound_regions_in_fn_sig: new_self_ty=None, fn_sig=fn[<V7956>, <V7957>] -> <V7958>
Bus error: 10

Snippet of stack trace (gathered via ( echo r ; echo bt ) | RUST_LOG=rustc::middle::typeck::check::regionmanip gdb --args ../../rust-clean/objdir-dbgopt/x86_64-apple-darwin/stage1/bin/rustc --cfg stage1 -O --cfg rtopt --cfg debug -Z no-debug-borrows --target=x86_64-apple-darwin -D warnings --out-dir x86_64-apple-darwin/stage1/lib/rustc/x86_64-apple-darwin/lib /Users/pnkfelix/Dev/Mozilla/rust.git/src/libstd/std.rs > /tmp/l):

#0  0x00007fff8b403749 in szone_malloc_should_clear ()
#1  0x00007fff8b3f6183 in malloc_zone_malloc ()
#2  0x00007fff8b3f6bd7 in malloc ()
#3  0x000000010001ebeb in rt::global_heap::malloc_raw::h9885e2e075f1d537aF::v0.9$x2dpre ()
#4  0x000000010003a6e3 in str::raw::from_buf_len::h66cfe6ec26abd11a3::v0.9$x2dpre ()
#5  0x000000010007771a in os::last_os_error::strerror::hbb9bd078e3eb8619aP::v0.9$x2dpre ()
#6  0x00000001000c7b77 in rt::io::native::file::Writer$FileDesc::write::hfc348125316ee38nOam::v0.9$x2dpre ()
#7  0x00000001000c9d6d in rt::io::native::stdio::Writer$StdOut::write::hfc348125316ee38AkaZ::v0.9$x2dpre ()
#8  0x000000010009b264 in fmt::Formatter::run::h55c2577e39ab471tCa8::v0.9$x2dpre ()
#9  0x00000001000ad929 in rt::util::dumb_println::h55eb493af5a38939am::v0.9$x2dpre ()
#10 0x00000001000ad6b1 in rust_stack_exhausted ()
#11 0x00000001000ffc88 in __morestack ()
#12 0x000000010001ebdc in rt::global_heap::malloc_raw::h9885e2e075f1d537aF::v0.9$x2dpre ()
#13 0x000000010007771a in os::last_os_error::strerror::hbb9bd078e3eb8619aP::v0.9$x2dpre ()
#14 0x00000001000c7b77 in rt::io::native::file::Writer$FileDesc::write::hfc348125316ee38nOam::v0.9$x2dpre ()
#15 0x00000001000ad966 in rt::util::dumb_println::h55eb493af5a38939am::v0.9$x2dpre ()
#16 0x0000000100029180 in rt::util::abort::hf2c3fded91cbadbbaM::v0.9$x2dpre ()
#17 0x00000001000f1cba in rt::local_ptr::unsafe_borrow::hcf79c4b7ae9fec6dan::v0.9$x2dpre ()
#18 0x0000000100035b38 in local_data::get_local_map::h4b4be06db643ef3aaS::v0.9$x2dpre ()
#19 0x000000010008b45c in condition::Condition::raise::h801fcffa999afff98Vat::v0.9$x2dpre ()
#20 0x00000001000c7b9b in rt::io::native::file::Writer$FileDesc::write::hfc348125316ee38nOam::v0.9$x2dpre ()
#21 0x00000001000ad966 in rt::util::dumb_println::h55eb493af5a38939am::v0.9$x2dpre ()
#22 0x0000000100029180 in rt::util::abort::hf2c3fded91cbadbbaM::v0.9$x2dpre ()
#23 0x00000001000f1cba in rt::local_ptr::unsafe_borrow::hcf79c4b7ae9fec6dan::v0.9$x2dpre ()
#24 0x0000000100035b38 in local_data::get_local_map::h4b4be06db643ef3aaS::v0.9$x2dpre ()
#25 0x000000010008b45c in condition::Condition::raise::h801fcffa999afff98Vat::v0.9$x2dpre ()
#26 0x00000001000c7b9b in rt::io::native::file::Writer$FileDesc::write::hfc348125316ee38nOam::v0.9$x2dpre ()
#27 0x00000001000ad966 in rt::util::dumb_println::h55eb493af5a38939am::v0.9$x2dpre ()
[...]
#97753 0x00000001000ad966 in rt::util::dumb_println::h55eb493af5a38939am::v0.9$x2dpre ()
#97754 0x0000000100029180 in rt::util::abort::hf2c3fded91cbadbbaM::v0.9$x2dpre ()
#97755 0x00000001000f1cba in rt::local_ptr::unsafe_borrow::hcf79c4b7ae9fec6dan::v0.9$x2dpre ()
#97756 0x0000000100035b38 in local_data::get_local_map::h4b4be06db643ef3aaS::v0.9$x2dpre ()
#97757 0x000000010008b45c in condition::Condition::raise::h801fcffa999afff98Vat::v0.9$x2dpre ()
#97758 0x00000001000c7b9b in rt::io::native::file::Writer$FileDesc::write::hfc348125316ee38nOam::v0.9$x2dpre ()
#97759 0x00000001000ad966 in rt::util::dumb_println::h55eb493af5a38939am::v0.9$x2dpre ()
#97760 0x0000000100029180 in rt::util::abort::hf2c3fded91cbadbbaM::v0.9$x2dpre ()
#97761 0x00000001000f1cba in rt::local_ptr::unsafe_borrow::hcf79c4b7ae9fec6dan::v0.9$x2dpre ()
#97762 0x0000000100035b38 in local_data::get_local_map::h4b4be06db643ef3aaS::v0.9$x2dpre ()
#97763 0x000000010008b45c in condition::Condition::raise::h801fcffa999afff98Vat::v0.9$x2dpre ()
#97764 0x00000001000c7b9b in rt::io::native::file::Writer$FileDesc::write::hfc348125316ee38nOam::v0.9$x2dpre ()
#97765 0x00000001000ad966 in rt::util::dumb_println::h55eb493af5a38939am::v0.9$x2dpre ()
#97766 0x0000000100029180 in rt::util::abort::hf2c3fded91cbadbbaM::v0.9$x2dpre ()
#97767 0x00000001000f1cba in rt::local_ptr::unsafe_borrow::hcf79c4b7ae9fec6dan::v0.9$x2dpre ()
#97768 0x0000000100035b38 in local_data::get_local_map::h4b4be06db643ef3aaS::v0.9$x2dpre ()
#97769 0x000000010008b45c in condition::Condition::raise::h801fcffa999afff98Vat::v0.9$x2dpre ()
#97770 0x00000001000c7b9b in rt::io::native::file::Writer$FileDesc::write::hfc348125316ee38nOam::v0.9$x2dpre ()
#97771 0x00000001000c9d6d in rt::io::native::stdio::Writer$StdOut::write::hfc348125316ee38AkaZ::v0.9$x2dpre ()
#97772 0x000000010009b264 in fmt::Formatter::run::h55c2577e39ab471tCa8::v0.9$x2dpre ()
#97773 0x00000001000ad929 in rt::util::dumb_println::h55eb493af5a38939am::v0.9$x2dpre ()
#97774 0x00000001000adba5 in rt::task::begin_unwind::anon::expr_fn::aO ()
#97775 0x0000000100031ab9 in rt::local::Local$Task::borrow::anon::expr_fn::dva7a8 ()
#97776 0x0000000100028b1c in rt::local_ptr::borrow::he698a24ea7b1886bat::v0.9$x2dpre ()
#97777 0x00000001000319ee in rt::local::Local$Task::borrow::h2f215968fb234bccdva7::v0.9$x2dpre ()
#97778 0x0000000100093a95 in rt::task::begin_unwind::h89e154cd0915671aH::v0.9$x2dpre ()
#97779 0x0000000100093772 in sys::__extensions__::fail_with::anon::anon::expr_fn::a3 ()
#97780 0x000000010009363d in c_str::with_c_str::anon::expr_fn::aYa0 ()
#97781 0x000000010009351d in c_str::ToCStr$__extensions__::with_c_str::hc6798931b183a7gEaW::v0.9$x2dpre ()
#97782 0x0000000100093721 in sys::__extensions__::fail_with::anon::expr_fn::a2 ()
#97783 0x000000010009363d in c_str::with_c_str::anon::expr_fn::aYa0 ()
#97784 0x000000010009351d in c_str::ToCStr$__extensions__::with_c_str::hc6798931b183a7gEaW::v0.9$x2dpre ()
#97785 0x00000001000056f2 in sys::FailWithCause$__extensions__::fail_with::hd96679812a86c367G9at::v0.9$x2dpre ()
#97786 0x000000010008b804 in condition::Condition::raise::h801fcffa999afff98Vat::v0.9$x2dpre ()
#97787 0x00000001000c7b9b in rt::io::native::file::Writer$FileDesc::write::hfc348125316ee38nOam::v0.9$x2dpre ()
#97788 0x00000001000c9d6d in rt::io::native::stdio::Writer$StdOut::write::hfc348125316ee38AkaZ::v0.9$x2dpre ()
#97789 0x000000010009b264 in fmt::Formatter::run::h55c2577e39ab471tCa8::v0.9$x2dpre ()
#97790 0x00000001000ad929 in rt::util::dumb_println::h55eb493af5a38939am::v0.9$x2dpre ()
#97791 0x00000001010b86e0 in middle::typeck::check::regionmanip::replace_bound_regions_in_fn_sig::ha131bf3caa2f916ai::v0.9$x2dpre ()
#97792 0x0000000101160db9 in middle::typeck::infer::InferCtxt::replace_bound_regions_with_fresh_regions::h6229dae3b2ba7432yhaf::v0.9$x2dpre ()
#97793 0x00000001011ba7d5 in middle::typeck::infer::sub::Combine$Sub::fn_sigs::hffc1b3cae2d11aaa6qaX::v0.9$x2dpre ()
#97794 0x00000001011ae011 in middle::typeck::infer::combine::super_tys::h4651ad7651a66b6bac::v0.9$x2dpre ()
#97795 0x000000010113f8d7 in middle::typeck::infer::sub::Combine$Sub::tys::h70a0b2591d487306qar::v0.9$x2dpre ()
#97796 0x00000001011cc4a8 in middle::typeck::infer::can_mk_subty::anon::anon::expr_fn::am ()
#97797 0x00000001011cc1bd in middle::typeck::infer::InferCtxt::probe::anon::expr_fn::mlaial ()
#97798 0x000000010114595d in util::common::indent::h665c34ba52f194af::v0.9$x2dpre ()
#97799 0x00000001011cc019 in middle::typeck::infer::can_mk_subty::anon::expr_fn::ah ()
#97800 0x000000010114595d in util::common::indent::h665c34ba52f194af::v0.9$x2dpre ()
#97801 0x0000000101116f26 in middle::typeck::infer::can_mk_subty::hb8281706426fc9aX::v0.9$x2dpre ()
#97802 0x000000010120ba1f in middle::typeck::coherence::CoherenceChecker::polytypes_unify::h3772bdda9deb4e498taK::v0.9$x2dpre ()
#97803 0x000000010120b4d5 in middle::typeck::coherence::__extensions__::check_implementation_coherence_of::anon::anon::expr_fn::aJ ()
#97804 0x000000010120ace1 in middle::typeck::coherence::CoherenceChecker::iter_impls_of_trait::h8c7b9953917741f8taG::v0.9$x2dpre ()
#97805 0x000000010120b032 in middle::typeck::coherence::__extensions__::check_implementation_coherence_of::anon::expr_fn::aH ()
#97806 0x000000010120ace1 in middle::typeck::coherence::CoherenceChecker::iter_impls_of_trait::h8c7b9953917741f8taG::v0.9$x2dpre ()
#97807 0x0000000101207440 in middle::typeck::coherence::CoherenceChecker::check_implementation_coherence::hf3d16eaf7d57388taZ::v0.9$x2dpre ()
#97808 0x00000001012071eb in middle::typeck::coherence::CoherenceChecker::check_coherence::hf76be5da2cc3f528taO::v0.9$x2dpre ()
#97809 0x000000010120d78f in middle::typeck::coherence::check_coherence::h3d83ca4ffafc7edat::v0.9$x2dpre ()
#97810 0x000000010120ff92 in middle::typeck::check_crate::h90848f87b76e54cdaS::v0.9$x2dpre ()
#97811 0x00000001014c0166 in driver::driver::phase_3_run_analysis_passes::h16e47e1dad7312a2::v0.9$x2dpre ()
#97812 0x00000001014c3768 in driver::driver::compile_input::h785884bca1fab7fam::v0.9$x2dpre ()
#97813 0x00000001014e67c1 in run_compiler::h81db11ff1cf953aX::v0.9$x2dpre ()
#97814 0x00000001014f8c7d in main_args::anon::expr_fn::a0 ()
#97815 0x00000001014f729d in monitor::anon::expr_fn::ai ()
#97816 0x00000001014f4bfe in task::TaskBuilder::try::anon::expr_fn::mTaDak ()
#97817 0x000000010005ad25 in task::spawn::spawn_raw::anon::expr_fn::aa ()
#97818 0x00000001000ad26e in rt::task::__extensions__::build_start_wrapper::anon::anon::expr_fn::ae ()
#97819 0x00000001000abb04 in rt::task::__extensions__::run::anon::expr_fn::ap ()
#97820 0x0000000102e4e603 in rust_try (f=<value temporarily unavailable, due to optimizations>, fptr=<value temporarily unavailable, due to optimizations>, env=<value temporarily unavailable, due to optimizations>) at rust_builtin.cpp:513
#97821 0x00000001000ab8a3 in rt::task::Task::run::h199ab8d6eb226980uiam::v0.9$x2dpre ()
#97822 0x00000001000acf3a in rt::task::__extensions__::build_start_wrapper::anon::expr_fn::a5 ()
@pnkfelix
Copy link
Member Author

@alexcrichton has pointed out to me that #9901 might help with this. It depends on what is causing the condition above to be signaled (repeatedly). Still, seems bad to me that we can get into the above infinite loop.

@alexcrichton
Copy link
Member

The infinite loop is an unfortunate side effect of failing. Right now whenever a task fails, it will print that it fails before checking to see whether it's already failing. If this printing raises a condition (an I/O error), then you'll fail because of no handler and start the cycle all over again.

The infinite loop would be better dealt with if the condition weren't raised on (or caught explicitly), but the condition definitely shouldn't be raised after #9901 lands. Regardless, I believe that removing conditions will help expose the error going on here so we can deal with it better.

@pnkfelix
Copy link
Member Author

@alexcrichton the work-around I adopted locally was to hack dumb_println in std::rt::util to keep a flag in a static mut to track whether we are in the dynamic extent of the fmt::writeln call within. Not really a great long term solution (since two failing tasks would then race on the set/unset of the global flag), but it at least yields a more reasonable stack to traverse in gdb.

@alexcrichton
Copy link
Member

@pnkfelix, this works as-is now (just rand after #9901 landed), so I believe that this can be closed now. The dumb_println method shouldn't ever be called in a normal situation, it's mainly for debugging the runtime and printing something out when things go seriously wrong.

@pnkfelix
Copy link
Member Author

Yes it seems to be fixed post #9901.

bors pushed a commit to rust-lang-ci/rust that referenced this issue Jul 25, 2022
This change fixes issue rust-lang#10037, in more or less the most naive fashion
possible.

We continue to start with the hardcoded default of "fun_name", and now append a
counter to the end of it if that name is already in scope.

In the future, we can probably apply more heuristics here to wind up with more
useful names by default, but for now this resolves the immediate problem.
bors added a commit to rust-lang-ci/rust that referenced this issue Jul 25, 2022
…on-duplicate-name, r=DorianListens

fix: Extract Function produces duplicate fn names

This change fixes rust-lang#10037, in more or less the most naive fashion
possible.

We continue to start with the hardcoded default of "fun_name", and now append a
counter to the end of it if that name is already in scope.

In the future, we can probably apply more heuristics here to wind up with more
useful names by default, but for now this resolves the immediate problem.
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

2 participants