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

Segfault after unloading chunk on custom server #234

Open
macmv opened this issue Mar 16, 2022 · 0 comments
Open

Segfault after unloading chunk on custom server #234

macmv opened this issue Mar 16, 2022 · 0 comments

Comments

@macmv
Copy link
Contributor

macmv commented Mar 16, 2022

Unloading a chunk causes a segfault:

#0  0x00007ffff2c04fc9 in  () at /usr/lib/libGLdispatch.so.0
#1  0x0000555555a944dd in glow::gl46::call_atomic_ptr_2arg<(), i32, *const u32> (name=..., ptr=<optimized out>, a=1, b=0x7fffe8ff56f4)
    at /home/macmv/.cargo/registry/src/github.com-1ecc6299db9ec823/glow-0.10.0/src/gl46.rs:4313
#2  glow::gl46::struct_commands::GlFns::DeleteVertexArrays (self=<optimized out>, n=1, arrays=0x7fffe8ff56f4) at /home/macmv/.cargo/registry/src/github.com-1ecc6299db9ec823/glow-0.10.0/src/gl46.rs:10909
#3  glow::native::{impl#2}::delete_vertex_array (self=<optimized out>, vertex_array=108) at /home/macmv/.cargo/registry/src/github.com-1ecc6299db9ec823/glow-0.10.0/src/native.rs:389
#4  0x000055555582abb8 in leafish::gl::{impl#10}::drop (self=0x7fff903e8a30) at src/gl/mod.rs:678
#5  core::ptr::drop_in_place<leafish::gl::VertexArray> () at /rustc/335ffbfa547df94ac236f5c56130cecf99c8d82b/library/core/src/ptr/mod.rs:188
#6  core::ptr::drop_in_place<leafish::render::ChunkRenderInfo> () at /rustc/335ffbfa547df94ac236f5c56130cecf99c8d82b/library/core/src/ptr/mod.rs:188
#7  core::ptr::drop_in_place<core::option::Option<leafish::render::ChunkRenderInfo>> () at /rustc/335ffbfa547df94ac236f5c56130cecf99c8d82b/library/core/src/ptr/mod.rs:188
#8  core::ptr::drop_in_place<leafish::render::ChunkBuffer> () at /rustc/335ffbfa547df94ac236f5c56130cecf99c8d82b/library/core/src/ptr/mod.rs:188
#9  core::ptr::drop_in_place<core::cell::UnsafeCell<leafish::render::ChunkBuffer>> () at /rustc/335ffbfa547df94ac236f5c56130cecf99c8d82b/library/core/src/ptr/mod.rs:188
#10 core::ptr::drop_in_place<lock_api::rwlock::RwLock<parking_lot::raw_rwlock::RawRwLock, leafish::render::ChunkBuffer>> () at /rustc/335ffbfa547df94ac236f5c56130cecf99c8d82b/library/core/src/ptr/mod.rs:188
#11 0x00005555556e13cd in alloc::sync::Arc<lock_api::rwlock::RwLock<parking_lot::raw_rwlock::RawRwLock, leafish::render::ChunkBuffer>>::drop_slow<lock_api::rwlock::RwLock<parking_lot::raw_rwlock::RawRwLock, leafish::render:
:ChunkBuffer>> (self=<optimized out>) at /rustc/335ffbfa547df94ac236f5c56130cecf99c8d82b/library/alloc/src/sync.rs:1092
#12 0x00005555558426ab in alloc::sync::{impl#27}::drop<lock_api::rwlock::RwLock<parking_lot::raw_rwlock::RawRwLock, leafish::render::ChunkBuffer>> (self=0x1)
    at /rustc/335ffbfa547df94ac236f5c56130cecf99c8d82b/library/alloc/src/sync.rs:1688
#13 core::ptr::drop_in_place<alloc::sync::Arc<lock_api::rwlock::RwLock<parking_lot::raw_rwlock::RawRwLock, leafish::render::ChunkBuffer>>> ()
    at /rustc/335ffbfa547df94ac236f5c56130cecf99c8d82b/library/core/src/ptr/mod.rs:188
#14 core::ptr::drop_in_place<leafish::world::chunk::chunk_section::ChunkSection> () at /rustc/335ffbfa547df94ac236f5c56130cecf99c8d82b/library/core/src/ptr/mod.rs:188
#15 0x000055555583aba9 in core::ptr::drop_in_place<core::option::Option<leafish::world::chunk::chunk_section::ChunkSection>> () at /rustc/335ffbfa547df94ac236f5c56130cecf99c8d82b/library/core/src/ptr/mod.rs:188
#16 core::ptr::drop_in_place<[core::option::Option<leafish::world::chunk::chunk_section::ChunkSection>; 16]> () at /rustc/335ffbfa547df94ac236f5c56130cecf99c8d82b/library/core/src/ptr/mod.rs:188
#17 core::ptr::drop_in_place<leafish::world::chunk::Chunk> () at /rustc/335ffbfa547df94ac236f5c56130cecf99c8d82b/library/core/src/ptr/mod.rs:188
#18 0x0000555555728a6d in core::ptr::drop_in_place<(leafish::world::chunk::CPos, leafish::world::chunk::Chunk)> () at /rustc/335ffbfa547df94ac236f5c56130cecf99c8d82b/library/core/src/ptr/mod.rs:188
#19 leafish::world::World::unload_chunk (self=<optimized out>, x=<optimized out>, z=<optimized out>, m=0x7fffb802c508) at src/world/mod.rs:803
#20 0x000055555581c0ee in leafish::server::Server::on_chunk_unload (self=<optimized out>, chunk_unload=...) at src/server/mod.rs:2587
#21 0x0000555555762467 in leafish::server::{impl#1}::spawn_reader::{closure#0} () at src/server/mod.rs:502
#22 0x000055555575d1c7 in std::sys_common::backtrace::__rust_begin_short_backtrace<leafish::server::{impl#1}::spawn_reader::{closure_env#0}, ()> (f=...)
    at /rustc/335ffbfa547df94ac236f5c56130cecf99c8d82b/library/std/src/sys_common/backtrace.rs:122
#23 0x0000555555821a9f in std::thread::{impl#0}::spawn_unchecked_::{closure#1}::{closure#0}<leafish::server::{impl#1}::spawn_reader::{closure_env#0}, ()> ()
    at /rustc/335ffbfa547df94ac236f5c56130cecf99c8d82b/library/std/src/thread/mod.rs:498
#24 core::panic::unwind_safe::{impl#23}::call_once<(), std::thread::{impl#0}::spawn_unchecked_::{closure#1}::{closure_env#0}<leafish::server::{impl#1}::spawn_reader::{closure_env#0}, ()>> (self=..., _args=())
    at /rustc/335ffbfa547df94ac236f5c56130cecf99c8d82b/library/core/src/panic/unwind_safe.rs:271
#25 std::panicking::try::do_call<core::panic::unwind_safe::AssertUnwindSafe<std::thread::{impl#0}::spawn_unchecked_::{closure#1}::{closure_env#0}<leafish::server::{impl#1}::spawn_reader::{closure_env#0}, ()>>, ()>
    (data=<optimized out>) at /rustc/335ffbfa547df94ac236f5c56130cecf99c8d82b/library/std/src/panicking.rs:492
#26 std::panicking::try<(), core::panic::unwind_safe::AssertUnwindSafe<std::thread::{impl#0}::spawn_unchecked_::{closure#1}::{closure_env#0}<leafish::server::{impl#1}::spawn_reader::{closure_env#0}, ()>>> (f=...)
    at /rustc/335ffbfa547df94ac236f5c56130cecf99c8d82b/library/std/src/panicking.rs:456
#27 std::panic::catch_unwind<core::panic::unwind_safe::AssertUnwindSafe<std::thread::{impl#0}::spawn_unchecked_::{closure#1}::{closure_env#0}<leafish::server::{impl#1}::spawn_reader::{closure_env#0}, ()>>, ()> (f=...)
    at /rustc/335ffbfa547df94ac236f5c56130cecf99c8d82b/library/std/src/panic.rs:137
#28 std::thread::{impl#0}::spawn_unchecked_::{closure#1}<leafish::server::{impl#1}::spawn_reader::{closure_env#0}, ()> () at /rustc/335ffbfa547df94ac236f5c56130cecf99c8d82b/library/std/src/thread/mod.rs:497
#29 core::ops::function::FnOnce::call_once<std::thread::{impl#0}::spawn_unchecked_::{closure_env#1}<leafish::server::{impl#1}::spawn_reader::{closure_env#0}, ()>, ()> ()
    at /rustc/335ffbfa547df94ac236f5c56130cecf99c8d82b/library/core/src/ops/function.rs:227
#30 0x00005555560691f3 in alloc::boxed::{impl#44}::call_once<(), dyn core::ops::function::FnOnce<(), Output=()>, alloc::alloc::Global> () at /rustc/335ffbfa547df94ac236f5c56130cecf99c8d82b/library/alloc/src/boxed.rs:1853
#31 alloc::boxed::{impl#44}::call_once<(), alloc::boxed::Box<dyn core::ops::function::FnOnce<(), Output=()>, alloc::alloc::Global>, alloc::alloc::Global> ()
    at /rustc/335ffbfa547df94ac236f5c56130cecf99c8d82b/library/alloc/src/boxed.rs:1853
--Type <RET> for more, q to quit, c to continue without paging--q

This happens when a gl::VertexArray (part of leafish::render::ChunkRenderInfo) is dropped. I really don't know the codebase, so I don't even know when this is supposed to be initialized.

The client only crashes if it unloads a rendered chunk. Non-rendered chunks do not crash when the server unloads them. This happens on all the working versions of my server; including 1.8, 1.12.2, and 1.16.5.

I'm not sending anything more than just chunk packets to the client (and the world info, and a player position packet), is there something more I'm supposed to send?

@macmv macmv changed the title Segfault after moving out of the 0, 0 (spawn) chunk on custom server Segfault after unloading chunk on custom server Mar 16, 2022
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

1 participant