Skip to content

segfault in shape code with pipes #2834

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
erickt opened this issue Jul 7, 2012 · 7 comments
Closed

segfault in shape code with pipes #2834

erickt opened this issue Jul 7, 2012 · 7 comments
Labels
A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.
Milestone

Comments

@erickt
Copy link
Contributor

erickt commented Jul 7, 2012

proto! streamp {
    open:send<T: send> {
        data(T) -> open<T>
    }
}

fn rendezvous() {
   let (c, s) = streamp::init();
   let streams: ~[streamp::client::open<int>] = ~[c];

   #error("%?", streams[0]);
}

fn main(args: ~[str]) {
   os::getenv("FOO");
   rendezvous();
}

segfaults with:

0x00000001003f33cc in shape::ctxt<shape::data<shape::log, shape::ptr> >::get_variant_sp (this=0x1018ffe00, tinfo=@0x1018ffba0, variant_id=4303535105) at rust_shape.h:348
348     const uint8_t *variant_ptr = tables->tags + variant_offset;
(gdb) bt
#0  0x00000001003f33cc in shape::ctxt<shape::data<shape::log, shape::ptr> >::get_variant_sp (this=0x1018ffe00, tinfo=@0x1018ffba0, variant_id=4303535105) at rust_shape.h:348
#1  0x00000001003f33ed in shape::ctxt<shape::data<shape::log, shape::ptr> >::get_variant_name (this=<value temporarily unavailable, due to optimizations>, tinfo=<value temporarily unavailable, due to optimizations>, variant_id=<value temporarily unavailable, due to optimizations>) at rust_shape.h:359
#2  0x00000001003f6320 in shape::log::walk_tag2 () at /Users/etryzelaar/Projects/rust/rust/src/rt/rust_shape.h:1217
#3  0x00000001003f6320 in shape::data<shape::log, shape::ptr>::walk_tag1 (this=0x1018ffe00, tinfo=@0x1018ffba0) at rust_shape.h:1124
#4  0x00000001003f64ec in shape::ctxt<shape::data<shape::log, shape::ptr> >::walk_tag0 (this=<value temporarily unavailable, due to optimizations>) at rust_shape.h:415
#5  0x00000001003f3063 in shape::log::walk_res2 (this=0x1018ffe00, dtor=<value temporarily unavailable, due to optimizations>, end_sp=0x100006149 "") at /Users/etryzelaar/rust/rust/src/rt/rust_shape.cpp:476
#6  0x00000001003f61e9 in shape::ctxt<shape::data<shape::log, shape::ptr> >::walk_res0 (this=0x1018ffe00) at rust_shape.h:954
#7  0x00000001003f28e6 in basic_string [inlined] () at /usr/include/c++/4.2.1/bits/basic_string.h:513
#8  0x00000001003f28e6 in _Alloc_hider [inlined] () at /usr/include/c++/4.2.1/bits/basic_string.h:2067
#9  0x00000001003f28e6 in basic_string [inlined] () at /Users/etryzelaar/rust/rust/src/rt/rust_shape.cpp:262
#10 0x00000001003f28e6 in std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::str () at /Users/etryzelaar/rust/rust/src/rt/rust_shape.cpp:130
#11 std::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >::str () at /usr/include/c++/4.2.1/sstream:572
#12 0x00000001003f28e6 in shape_log_str (tydesc=0x100007af0, data=0x100508da0 "\001??") at /Users/etryzelaar/rust/rust/src/rt/rust_shape.cpp:515
#13 0x000000010004fbca in shape_log_str__c_stack_shim ()
#14 0x00000001003fd90b in __morestack ()
@killerswan
Copy link
Contributor

Note: seen at commits 4bb13c6 and b5f5676.

@eholk
Copy link
Contributor

eholk commented Jul 9, 2012

Thanks, I'll take a look!

@eholk
Copy link
Contributor

eholk commented Jul 9, 2012

Huh, if I comment out the getenv call, then it works.

@eholk
Copy link
Contributor

eholk commented Jul 9, 2012

Ah, it seems that the shape code has valgrind errors...

==18505== Thread 3:
==18505== Use of uninitialised value of size 8
==18505==    at 0x3FD749: shape::data<shape::log, shape::ptr>::walk_tag1(shape::tag_info&) (in /Users/eholk/Documents/projects/mozilla/rust/build/x86_64-apple-darwin/stage1/lib/rustc/x86_64-apple-darwin/lib/librustrt.dylib)
==18505==    by 0x3FD34A: shape::ctxt<shape::data<shape::log, shape::ptr> >::walk_tag0() (in /Users/eholk/Documents/projects/mozilla/rust/build/x86_64-apple-darwin/stage1/lib/rustc/x86_64-apple-darwin/lib/librustrt.dylib)
==18505==    by 0x3FEEF7: shape::ctxt<shape::data<shape::log, shape::ptr> >::walk() (in /Users/eholk/Documents/projects/mozilla/rust/build/x86_64-apple-darwin/stage1/lib/rustc/x86_64-apple-darwin/lib/librustrt.dylib)
==18505==    by 0x3FB9D3: shape::log::walk_res2(shape::rust_fn const*, unsigned char const*) (in /Users/eholk/Documents/projects/mozilla/rust/build/x86_64-apple-darwin/stage1/lib/rustc/x86_64-apple-darwin/lib/librustrt.dylib)
==18505==    by 0x3FEFA7: shape::ctxt<shape::data<shape::log, shape::ptr> >::walk() (in /Users/eholk/Documents/projects/mozilla/rust/build/x86_64-apple-darwin/stage1/lib/rustc/x86_64-apple-darwin/lib/librustrt.dylib)
==18505==    by 0x3FB851: shape_log_str (in /Users/eholk/Documents/projects/mozilla/rust/build/x86_64-apple-darwin/stage1/lib/rustc/x86_64-apple-darwin/lib/librustrt.dylib)
==18505==    by 0x5CA49: shape_log_str__c_stack_shim (in /Users/eholk/Documents/projects/mozilla/rust/build/x86_64-apple-darwin/stage1/lib/rustc/x86_64-apple-darwin/lib/libcore-d27e4777a53c3e50-0.2.dylib)
==18505==    by 0x4038FB: __morestack (in /Users/eholk/Documents/projects/mozilla/rust/build/x86_64-apple-darwin/stage1/lib/rustc/x86_64-apple-darwin/lib/librustrt.dylib)
==18505== 
==18505== Use of uninitialised value of size 8
==18505==    at 0x3FD77D: shape::data<shape::log, shape::ptr>::walk_tag1(shape::tag_info&) (in /Users/eholk/Documents/projects/mozilla/rust/build/x86_64-apple-darwin/stage1/lib/rustc/x86_64-apple-darwin/lib/librustrt.dylib)
==18505==    by 0x3FD34A: shape::ctxt<shape::data<shape::log, shape::ptr> >::walk_tag0() (in /Users/eholk/Documents/projects/mozilla/rust/build/x86_64-apple-darwin/stage1/lib/rustc/x86_64-apple-darwin/lib/librustrt.dylib)
==18505==    by 0x3FEEF7: shape::ctxt<shape::data<shape::log, shape::ptr> >::walk() (in /Users/eholk/Documents/projects/mozilla/rust/build/x86_64-apple-darwin/stage1/lib/rustc/x86_64-apple-darwin/lib/librustrt.dylib)
==18505==    by 0x3FB9D3: shape::log::walk_res2(shape::rust_fn const*, unsigned char const*) (in /Users/eholk/Documents/projects/mozilla/rust/build/x86_64-apple-darwin/stage1/lib/rustc/x86_64-apple-darwin/lib/librustrt.dylib)
==18505==    by 0x3FEFA7: shape::ctxt<shape::data<shape::log, shape::ptr> >::walk() (in /Users/eholk/Documents/projects/mozilla/rust/build/x86_64-apple-darwin/stage1/lib/rustc/x86_64-apple-darwin/lib/librustrt.dylib)
==18505==    by 0x3FB851: shape_log_str (in /Users/eholk/Documents/projects/mozilla/rust/build/x86_64-apple-darwin/stage1/lib/rustc/x86_64-apple-darwin/lib/librustrt.dylib)
==18505==    by 0x5CA49: shape_log_str__c_stack_shim (in /Users/eholk/Documents/projects/mozilla/rust/build/x86_64-apple-darwin/stage1/lib/rustc/x86_64-apple-darwin/lib/libcore-d27e4777a53c3e50-0.2.dylib)
==18505==    by 0x4038FB: __morestack (in /Users/eholk/Documents/projects/mozilla/rust/build/x86_64-apple-darwin/stage1/lib/rustc/x86_64-apple-darwin/lib/librustrt.dylib)
==18505== 
rust: ~"res(some(1))"
==18505== Warning: client switching stacks?  SP change: 0x100076370 --> 0xb0021e70
==18505==          to suppress, use: --max-stackframe=1342522624 or greater
==18505== 
==18505== HEAP SUMMARY:
==18505==     in use at exit: 227,990 bytes in 989 blocks
==18505==   total heap usage: 1,596 allocs, 607 frees, 1,414,871 bytes allocated
==18505== 
==18505== LEAK SUMMARY:
==18505==    definitely lost: 0 bytes in 0 blocks
==18505==    indirectly lost: 0 bytes in 0 blocks
==18505==      possibly lost: 0 bytes in 0 blocks
==18505==    still reachable: 227,990 bytes in 989 blocks
==18505==         suppressed: 0 bytes in 0 blocks
==18505== Rerun with --leak-check=full to see details of leaked memory
==18505== 
==18505== For counts of detected and suppressed errors, rerun with: -v
==18505== Use --track-origins=yes to see where uninitialised values come from
==18505== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 120 from 8)

@ghost ghost assigned catamorphism Jul 9, 2012
@eholk
Copy link
Contributor

eholk commented Jul 9, 2012

Tim, can you take a look? I think it might be related to shape code for classes.

@catamorphism
Copy link
Contributor

May be related to #2724

eholk added a commit that referenced this issue Jul 11, 2012
@catamorphism
Copy link
Contributor

Since both shape glue and classes as we know them are supposedly going away, I'm calling this "postponed".

celinval pushed a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
Version 0.1.39 of the `tracing` crate was yanked last week, causing the
cargo audit CI workflow to throw an error (see [this action
run](https://github.com/model-checking/kani/actions/runs/6593068605/job/17914928240)
for an example). This PR upgrades `tracing` to version to 0.1.40.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.
Projects
None yet
Development

No branches or pull requests

4 participants