Skip to content

Infinite recursion in librustc::metadata::decoder #8707

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

Closed
SimonSapin opened this issue Aug 23, 2013 · 7 comments
Closed

Infinite recursion in librustc::metadata::decoder #8707

SimonSapin opened this issue Aug 23, 2013 · 7 comments

Comments

@SimonSapin
Copy link
Contributor

I’m working on a patch for Servo (commit c12c7a6) that only adds a bunch of code in its "script" crate. Servo before my patch builds fine. The same code in its own crate builds fine. The script crate itself with my code added builds fine. It’s only Servo’s "main" crate, which links against "script", that sends rust in an infinite loop.

gdb shows the stack trace below, except it goes to 3000 or so frames after a few minutes, and growing.

Rust version: rustc 0.8-pre (72b50e7 2013-08-16 01:56:16 -0700)
Colorized stack trace: http://pastebin.com/Tg7APRi2

#0  0x00007fc049d5095b in hashmap::__extensions__::bucket_for_key_with_hash_50288::anon::expr_fn_50301 ()
   from lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#1  0x00007fc049d5055f in hashmap::__extensions__::bucket_sequence_50290::_f480b8be39c3ec7::_0$x2e8$x2dpre ()
   from lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#2  0x00007fc049d5049b in hashmap::__extensions__::bucket_for_key_with_hash_50288::_1fab551126e8674a::_0$x2e8$x2dpre ()
   from lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#3  0x00007fc049d503eb in hashmap::__extensions__::bucket_for_key_50286::_e8c863cbc639f::_0$x2e8$x2dpre ()
   from lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#4  0x00007fc049d502f9 in hashmap::__extensions__::find_50283::_ebf445d0cf0c6b1::_0$x2e8$x2dpre ()
   from lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#5  0x00007fc049d4e089 in middle::resolve::__extensions__::meth_50280::add_child::_9bc551b669fa7eeb::_0$x2e8$x2dpre ()
   from lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#6  0x00007fc049d634af in middle::resolve::__extensions__::build_reduced_graph_for_external_crate::anon::expr_fn_50939 ()
   from lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#7  0x00007fc04a527ae8 in metadata::decoder::__extensions__::meth_92212::process_item_and_pop_name::_ed3a72451bee9133::_0$x2e8$x2dpre ()
   from lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#8  0x00007fc04a528da9 in metadata::decoder::__extensions__::each_child_of_module_or_crate::anon::expr_fn_92220 ()
   from lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#9  0x00007fc04b07512a in ebml::reader::tagged_docs::_669199c64346a9a7::_0$x2e8$x2dpre ()
   from lib/libextra-a7c050cfd46b2c9a-0.8-pre.so
#10 0x00007fc04a52843f in metadata::decoder::__extensions__::meth_92217::each_child_of_module_or_crate::_10e45c12b3c2e244::_0$x2e8$x2dpre ()
   from lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#11 0x00007fc04a5282e2 in metadata::decoder::__extensions__::meth_92215::each_item_of_module::_182d9722d1c9f691::_0$x2e8$x2dpre ()
   from lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#12 0x00007fc04a527c4d in metadata::decoder::__extensions__::meth_92212::process_item_and_pop_name::_ed3a72451bee9133::_0$x2e8$x2dpre ()
   from lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#13 0x00007fc04a528da9 in metadata::decoder::__extensions__::each_child_of_module_or_crate::anon::expr_fn_92220 ()
   from lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#14 0x00007fc04b07512a in ebml::reader::tagged_docs::_669199c64346a9a7::_0$x2e8$x2dpre ()
   from lib/libextra-a7c050cfd46b2c9a-0.8-pre.so
#15 0x00007fc04a52843f in metadata::decoder::__extensions__::meth_92217::each_child_of_module_or_crate::_10e45c12b3c2e244::_0$x2e8$x2dpre ()
   from lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#16 0x00007fc04a5282e2 in metadata::decoder::__extensions__::meth_92215::each_item_of_module::_182d9722d1c9f691::_0$x2e8$x2dpre ()
   from lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#17 0x00007fc04a527c4d in metadata::decoder::__extensions__::meth_92212::process_item_and_pop_name::_ed3a72451bee9133::_0$x2e8$x2dpre ()
   from lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#18 0x00007fc04a5295f8 in metadata::decoder::__extensions__::each_child_of_module_or_crate::anon::expr_fn_92222 ()
   from lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
@metajack
Copy link
Contributor

@pcwalton this looks like your domain. This is blocking the style system unless we can find a workaround. Ideas?

@pcwalton
Copy link
Contributor

each_path problem? I removed that method recently. Try upgrading Rust.

@SimonSapin
Copy link
Contributor Author

I still have the same issue on rustc 0.8-pre (c822d10 2013-08-27 11:35:51 -0700). The stack trace looks very similar

#0  0x00007ff33c973ab8 in str::__extensions__::meth_53755::next::_a327b7413cb432e1::_0$x2e8$x2dpre ()
   from lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#1  0x00007ff33c97383d in str::__extensions__::meth_53749::next::_236ae8d43b4b690::_0$x2e8$x2dpre ()
   from lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#2  0x00007ff33c972fa5 in vec::__extensions__::from_iterator_53719::_63c065d1b2675735::_0$x2e8$x2dpre ()
   from lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#3  0x00007ff33c972ea6 in iterator::Iterator::collect_53716::_70c43414f099a697::_0$x2e8$x2dpre ()
   from lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#4  0x00007ff33c96fb5d in middle::resolve::__extensions__::build_reduced_graph_for_external_crate::anon::expr_fn_53714 ()
   from lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#5  0x00007ff33d2a2640 in metadata::decoder::__extensions__::meth_94926::process_item_and_pop_name::_98bc6c9258a918de::_0$x2e8$x2dpre ()
   from lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#6  0x00007ff33d2a443a in metadata::decoder::__extensions__::each_child_of_module_or_crate::anon::expr_fn_94936 ()
   from lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#7  0x00007ff33dec0aee in ebml::reader::tagged_docs::_54b95af320ce4fde::_0$x2e8$x2dpre ()
   from lib/libextra-a7c050cfd46b2c9a-0.8-pre.so
#8  0x00007ff33d29630c in metadata::decoder::each_reexport::_38ad7c4b4254dae::_0$x2e8$x2dpre ()
   from lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#9  0x00007ff33d2a319d in metadata::decoder::__extensions__::meth_94931::each_child_of_module_or_crate::_7411f6a824c25f::_0$x2e8$x2dpre ()
   from lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#10 0x00007ff33d2a2f1e in metadata::decoder::__extensions__::meth_94929::each_item_of_module::_182d9722d1c9f691::_0$x2e8$x2dpre ()
   from lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#11 0x00007ff33d2a27b2 in metadata::decoder::__extensions__::meth_94926::process_item_and_pop_name::_98bc6c9258a918de::_0$x2e8$x2dpre ()
   from lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#12 0x00007ff33d2a443a in metadata::decoder::__extensions__::each_child_of_module_or_crate::anon::expr_fn_94936 ()
   from lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#13 0x00007ff33dec0aee in ebml::reader::tagged_docs::_54b95af320ce4fde::_0$x2e8$x2dpre ()
   from lib/libextra-a7c050cfd46b2c9a-0.8-pre.so
#14 0x00007ff33d29630c in metadata::decoder::each_reexport::_38ad7c4b4254dae::_0$x2e8$x2dpre ()
   from lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#15 0x00007ff33d2a319d in metadata::decoder::__extensions__::meth_94931::each_child_of_module_or_crate::_7411f6a824c25f::_0$x2e8$x2dpre ()
   from lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#16 0x00007ff33d2a2f1e in metadata::decoder::__extensions__::meth_94929::each_item_of_module::_182d9722d1c9f691::_0$x2e8$x2dpre ()
   from lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#17 0x00007ff33d2a27b2 in metadata::decoder::__extensions__::meth_94926::process_item_and_pop_name::_98bc6c9258a918de::_0$x2e8$x2dpre ()
   from lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so

@SimonSapin
Copy link
Contributor Author

@pcwalton did you make your changes more recently than that?

@metajack
Copy link
Contributor

@pcwalton It looks like your patch didn't land? #8657

@SimonSapin
Copy link
Contributor Author

And I actually don’t see each_path in either stack trace.

@SimonSapin
Copy link
Contributor Author

Upgrading to Rust 0ac3e02 fixed this for me.

flip1995 pushed a commit to flip1995/rust that referenced this issue Apr 21, 2022
Add `await_holding_invalid_type` lint

changelog: [`await_holding_invalid_type`]

This lint allows users to create a denylist of types which are not allowed to be
held across await points. This is essentially a re-implementation of the
language-level [`must_not_suspend`
lint](rust-lang#83310). That lint has a lot of
work still to be done before it will reach Rust stable, and in the meantime
there are a lot of types which can trip up developers if they are used
improperly.

I originally implemented this specifically for `tracing::span::Entered`, until I discovered rust-lang#8434 and read the commentary on that PR. Given this implementation is fully user configurable, doesn't tie clippy to any one particular crate, and introduces no additional dependencies, it seems more appropriate.
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

3 participants