Skip to content
This repository has been archived by the owner on Jun 19, 2021. It is now read-only.

instant segfault on start #200

Closed
zetok opened this issue Sep 10, 2016 · 9 comments
Closed

instant segfault on start #200

zetok opened this issue Sep 10, 2016 · 9 comments

Comments

@zetok
Copy link

zetok commented Sep 10, 2016

Rust 1.11
Plantex 0be02cf

Starting program: /home/zetok/git_zetok/rust/plantex/target/debug/plantex 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
INFO:plantex: Launching local server
[New Thread 0x7ffff6bff700 (LWP 5275)]
INFO:plantex: ~~~~~~~~~~ Plantex started ~~~~~~~~~~
INFO:server: starting server on 127.0.0.1:42501
[New Thread 0x7ffff65ff700 (LWP 5276)]
INFO:client::game: connecting to 127.0.0.1:42501
INFO:server::server: client connected from 127.0.0.1:45616
[New Thread 0x7fffe80f7700 (LWP 5361)]
INFO:client::game: OpenGL context was successfully built
INFO:client::game: Version of context: OpenGL 4.1
INFO:client::game: Supported GLSL version: GLSL 4.1
INFO:client::game: Free GPU memory (estimated): 4082MB
[New Thread 0x7fffe65ff700 (LWP 5438)]
INFO:client::renderer: time to resize framebuffer with dimensions 1148,1034
INFO:client::game: ______ _             _            
INFO:client::game: | ___ \ |           | |  
INFO:client::game: | |_/ / | __ _ _ __ | |_ _____  __
INFO:client::game: |  __/| |/ _` | '_ \| __/ _ \ \/ /
INFO:client::game: | |   | | (_| | | | | ||  __/>  < 
INFO:client::game: \_|   |_|\__,_|_| |_|\__\___/_/\_\

Program received signal SIGSEGV, Segmentation fault.
0x00007fffe8d489c0 in llvm::Value::getName() const () from /usr/lib64/libLLVMCore.so.3.7
(gdb) bt
#0  0x00007fffe8d489c0 in llvm::Value::getName() const () from /usr/lib64/libLLVMCore.so.3.7
#1  0x00007fffef7c7cc7 in (anonymous namespace)::SITypeRewriter::visitCallInst(llvm::CallInst&) ()
   from /usr/lib64/libLLVMAMDGPUCodeGen.so.3.7
#2  0x00007fffef7c8a1e in (anonymous namespace)::SITypeRewriter::runOnFunction(llvm::Function&) ()
   from /usr/lib64/libLLVMAMDGPUCodeGen.so.3.7
#3  0x00007fffe8d22fad in llvm::FPPassManager::runOnFunction(llvm::Function&) () from /usr/lib64/libLLVMCore.so.3.7
#4  0x00007fffe8d23443 in llvm::FPPassManager::runOnModule(llvm::Module&) () from /usr/lib64/libLLVMCore.so.3.7
#5  0x00007fffe8d236f1 in llvm::legacy::PassManagerImpl::run(llvm::Module&) () from /usr/lib64/libLLVMCore.so.3.7
#6  0x00007fffe9fccffd in LLVMTargetMachineEmit(LLVMOpaqueTargetMachine*, LLVMOpaqueModule*, llvm::raw_pwrite_stream&, LLVMCodeGenFileType, char**) () from /usr/lib64/libLLVMTarget.so.3.7
#7  0x00007fffe9fcd2ce in LLVMTargetMachineEmitToMemoryBuffer () from /usr/lib64/libLLVMTarget.so.3.7
#8  0x00007ffff12bedd4 in radeon_llvm_compile (M=M@entry=0x7fffe3e65c80, binary=binary@entry=0x7fffe6eb1a90, 
    gpu_family=<optimized out>, tm=tm@entry=0x7ffff6d33c00, debug=debug@entry=0x7ffff6ca58f0)
    at /var/tmp/portage/media-libs/mesa-12.0.1/work/mesa-12.0.1/src/gallium/drivers/radeon/radeon_llvm_emit.c:235
#9  0x00007ffff12301b0 in si_compile_llvm (sscreen=sscreen@entry=0x7ffff6d33000, binary=binary@entry=0x7fffe6eb1a90, 
    conf=conf@entry=0x7fffe6eb1ae8, tm=tm@entry=0x7ffff6d33c00, mod=mod@entry=0x7fffe3e65c80, 
    debug=debug@entry=0x7ffff6ca58f0, processor=3, name=0x7ffff1395100 "TGSI shader")
    at /var/tmp/portage/media-libs/mesa-12.0.1/work/mesa-12.0.1/src/gallium/drivers/radeonsi/si_shader.c:6166
#10 0x00007ffff123218b in si_compile_tgsi_shader (sscreen=sscreen@entry=0x7ffff6d33000, tm=tm@entry=0x7ffff6d33c00, 
    shader=shader@entry=0x7fffe6eb1a00, is_monolithic=is_monolithic@entry=true, debug=debug@entry=0x7ffff6ca58f0)
    at /var/tmp/portage/media-libs/mesa-12.0.1/work/mesa-12.0.1/src/gallium/drivers/radeonsi/si_shader.c:6561
#11 0x00007ffff1232ae9 in si_shader_create (sscreen=0x7ffff6d33000, tm=0x7ffff6d33c00, shader=shader@entry=0x7fffe6eb1a00, 
    debug=debug@entry=0x7ffff6ca58f0)
    at /var/tmp/portage/media-libs/mesa-12.0.1/work/mesa-12.0.1/src/gallium/drivers/radeonsi/si_shader.c:7527
#12 0x00007ffff123e01d in si_shader_select_with_key (ctx=ctx@entry=0x7ffff6ca5000, state=0x7ffff6ca5d88, key=0x7ffffffeaa20)
    at /var/tmp/portage/media-libs/mesa-12.0.1/work/mesa-12.0.1/src/gallium/drivers/radeonsi/si_state_shaders.c:993
#13 0x00007ffff123e170 in si_shader_select (ctx=ctx@entry=0x7ffff6ca5000, state=state@entry=0x7ffff6ca5d88)
    at /var/tmp/portage/media-libs/mesa-12.0.1/work/mesa-12.0.1/src/gallium/drivers/radeonsi/si_state_shaders.c:1021
#14 0x00007ffff123f5fb in si_update_shaders (sctx=sctx@entry=0x7ffff6ca5000)
    at /var/tmp/portage/media-libs/mesa-12.0.1/work/mesa-12.0.1/src/gallium/drivers/radeonsi/si_state_shaders.c:1955
#15 0x00007ffff123adb6 in si_draw_vbo (ctx=0x7ffff6ca5000, info=0x7ffffffeae70)
    at /var/tmp/portage/media-libs/mesa-12.0.1/work/mesa-12.0.1/src/gallium/drivers/radeonsi/si_state_draw.c:905
#16 0x00007ffff10e59e4 in u_vbuf_draw_vbo (mgr=0x7ffff6d54e00, info=<optimized out>)
    at /var/tmp/portage/media-libs/mesa-12.0.1/work/mesa-12.0.1/src/gallium/auxiliary/util/u_vbuf.c:1163
#17 0x00007ffff0f199ea in st_draw_vbo (ctx=0x7fffe75137c0, prims=<optimized out>, nr_prims=1, ib=0x7ffffffeaf50, 
    index_bounds_valid=<optimized out>, min_index=4294967295, max_index=4294967295, tfb_vertcount=0x0, stream=0, indirect=0x0)
    at /var/tmp/portage/media-libs/mesa-12.0.1/work/mesa-12.0.1/src/mesa/state_tracker/st_draw.c:251
#18 0x00007ffff0ed902a in vbo_validated_drawrangeelements (ctx=ctx@entry=0x7fffe75137c0, mode=mode@entry=14, 
    index_bounds_valid=index_bounds_valid@entry=0 '\000', start=start@entry=4294967295, end=end@entry=4294967295, 
    count=count@entry=4443, type=5125, indices=0x0, basevertex=0, numInstances=13, baseInstance=0)
    at /var/tmp/portage/media-libs/mesa-12.0.1/work/mesa-12.0.1/src/mesa/vbo/vbo_exec_array.c:849
#19 0x00007ffff0ed90be in vbo_exec_DrawElementsInstanced (mode=14, count=4443, type=5125, indices=0x0, numInstances=13)
    at /var/tmp/portage/media-libs/mesa-12.0.1/work/mesa-12.0.1/src/mesa/vbo/vbo_exec_array.c:1030
#20 0x000055555566ff03 in glium::gl::{{impl}}::DrawElementsInstanced (self=0x7fffe7566450, mode=14, count=4443, type_=5125, 
    indices=0x0, instancecount=13)
    at /home/zetok/git_zetok/rust/plantex/target/debug/build/glium-5a0f6022dd6fde54/out/gl_bindings.rs:8303
#21 0x0000555555695308 in glium::ops::draw::draw<glium::uniforms::uniforms::UniformsStorage<[f32; 3], glium::uniforms::uniforms::UniformsStorage<[f32; 3], glium::uniforms::uniforms::UniformsStorage<[f32; 3], glium::uniforms::uniforms::UniformsStorage<[[f32; 4]; 4], glium::uniforms::uniforms::UniformsStorage<glium::uniforms::sampler::Sampler<glium::texture::texture2d::Texture2d>, glium::uniforms::uniforms::UniformsStorage<[f32; 3], glium::uniforms::uniforms::UniformsStorage<[[f32; 4]; 4], glium::uniforms::uniforms::UniformsStorage<[[f32; 4]; 4], glium::uniforms::uniforms::EmptyUniforms>>>>>>>>,(&glium::vertex::buffer::VertexBuffer<client::view::plant_view::Vertex>, glium::vertex::PerInstance)> (context=0x7fffe7566450, framebuffer=..., 
    vertex_buffers=..., indices=..., program=0x7ffff6cd8990, uniforms=0x7ffffffede18, draw_parameters=0x7ffffffeccb0, 
---Type <return> to continue, or q <return> to quit---
    dimensions=...) at /home/zetok/.cargo/git/checkouts/glium-1d278ab6db4cdf7b/unifast/src/ops/draw.rs:225
#22 0x00005555556936cf in glium::framebuffer::{{impl}}::draw<(&glium::vertex::buffer::VertexBuffer<client::view::plant_view::Vertex>, glium::vertex::PerInstance),&glium::index::buffer::IndexBuffer<u32>,glium::uniforms::uniforms::UniformsStorage<[f32; 3], glium::uniforms::uniforms::UniformsStorage<[f32; 3], glium::uniforms::uniforms::UniformsStorage<[f32; 3], glium::uniforms::uniforms::UniformsStorage<[[f32; 4]; 4], glium::uniforms::uniforms::UniformsStorage<glium::uniforms::sampler::Sampler<glium::texture::texture2d::Texture2d>, glium::uniforms::uniforms::UniformsStorage<[f32; 3], glium::uniforms::uniforms::UniformsStorage<[[f32; 4]; 4], glium::uniforms::uniforms::UniformsStorage<[[f32; 4]; 4], glium::uniforms::uniforms::EmptyUniforms>>>>>>>>> (
    self=0x7ffffffef3b0, vb=..., ib=0x7fffe6a0d318, program=0x7ffff6cd8990, uniforms=0x7ffffffede18, 
    draw_parameters=0x7ffffffeccb0)
    at /home/zetok/.cargo/git/checkouts/glium-1d278ab6db4cdf7b/unifast/src/framebuffer/mod.rs:315
#23 0x0000555555692bc1 in client::view::plant_view::{{impl}}::draw<glium::framebuffer::SimpleFrameBuffer> (
    self=0x7fffe6a0ccc0, surface=0x7ffffffef3b0, camera=0x7ffffffefc70, shadow_map=0x7fffffff04c0, 
    depth_view_proj=0x7ffffffef548, daytime=0x7fffffff2d48, sun_dir=...)
    at /home/zetok/git_zetok/rust/plantex/client/src/view/plant_view.rs:148
#24 0x0000555555684129 in client::world::world_view::{{impl}}::draw<glium::framebuffer::SimpleFrameBuffer> (
    self=0x7fffe6871840, surface=0x7ffffffef3b0, camera=0x7ffffffefc70, shadow_map=0x7fffffff04c0, 
    depth_view_proj=0x7ffffffef548, daytime=0x7fffffff2d48, sun_dir=...)
    at /home/zetok/git_zetok/rust/plantex/client/src/world/world_view.rs:171
#25 0x000055555560aff3 in client::renderer::{{impl}}::render (self=0x7fffffff03b8, world_view=0x7fffe6871840, 
    camera=0x7ffffffefc70, daytime=0x7fffffff2d48, sun=0x7fffffff1d28, weather=0x7fffffff2d58, sky_view=0x7fffffff24f8)
    at /home/zetok/git_zetok/rust/plantex/client/src/renderer.rs:359
#26 0x00005555555e0d68 in client::game::{{impl}}::run (self=...) at /home/zetok/git_zetok/rust/plantex/client/src/game.rs:118
#27 0x00005555555b5575 in client::start_game (config=..., server=...)
    at /home/zetok/git_zetok/rust/plantex/client/src/lib.rs:47
#28 0x000055555559b200 in plantex::main () at /home/zetok/git_zetok/rust/plantex/plantex/main.rs:32
#29 0x0000555555b98649 in std::panicking::try::call::hca715a47aa047c49 ()
#30 0x0000555555ba061c in __rust_try ()
#31 0x0000555555ba05bf in __rust_maybe_catch_panic ()
#32 0x0000555555b980ef in std::rt::lang_start::h162055cb2e4b9fe7 ()
#33 0x00005555555a27fa in main ()
@jonas-schievink
Copy link
Contributor

Backtrace looks like a driver issue (and possibly glium). Which graphics card and driver are you using, exactly (including versions)?

@bjorn3
Copy link

bjorn3 commented Sep 10, 2016

It seems like @zetok uses radeon:

#8 0x00007ffff12bedd4 in radeon_llvm_compile (M=M@entry=0x7fffe3e65c80, binary=binary@entry=0x7fffe6eb1a90,
gpu_family=, tm=tm@entry=0x7ffff6d33c00, debug=debug@entry=0x7ffff6ca58f0)
at /var/tmp/portage/media-libs/mesa-12.0.1/work/mesa-12.0.1/src/gallium/drivers/radeon/radeon_llvm_emit.c:235

Does plantex use any non standard shader code?

@LukasKalbertodt
Copy link
Member

Does plantex use any non standard shader code?

We actually never ran a GLSL validator on all shader files, but I don't know of any special shader code 😕 So far we tested with Nvidia cards (OpenGL implementations which permit many strange things) and Intel cards (so far it seemed like those OpenGL implementations reject all shader code that is not valid by the GLSL standard).

Whatever it is, a segfault is never expected behavior. Since plantex doesn't use any unsafe code at all, I'm pretty sure it's either a bug in glium or a bug in the OpenGL implementation of Radeon that glium did not prevent.

@zetok
Copy link
Author

zetok commented Sep 10, 2016

Which graphics card and driver are you using, exactly (including versions)?

GPU: Advanced Micro Devices, Inc. [AMD/ATI] Hawaii PRO [Radeon R9 290]
Kernel: 4.6.3 with with a custom patch revert that makes freeze during gaming ~non-existent
Driver: radeon
Mesa: 12.0.1
Xorg: 1.17.4

Any other info I could supply?

@LukasKalbertodt
Copy link
Member

LukasKalbertodt commented Sep 10, 2016

If you want, you could test a few glium examples:

git clone https://github.com/tomaka/glium.git
cd glium
cargo run --example <name>

Interesting examples would be teapot, instancing and tessellation. Does one of those fail with the same error?

@bjorn3
Copy link

bjorn3 commented Sep 10, 2016

Could you print the local vars of frame #11?

@zetok
Copy link
Author

zetok commented Sep 10, 2016

@bjorn3 sure, but I don't really use gdb much, so would you mind supplying a command?

@zetok
Copy link
Author

zetok commented Sep 10, 2016

@LukasKalbertodt looks like tessellation one segfaults too :s

@LukasKalbertodt
Copy link
Member

Well, I guess then there is nothing we can do about it...

As it seems to have something to do with tessellation, you can try starting plantex without tessellation, as described here: #199

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

No branches or pull requests

4 participants