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

target-cpu=native breaks client ability to connect to server inside container and remote server #41

Open
Fogapod opened this issue Jan 11, 2024 · 1 comment

Comments

@Fogapod
Copy link
Contributor

Fogapod commented Jan 11, 2024

Any network indirection (connecting to remote server or local/remote container) prevents client from spawning.

docker server command: run --name ssnt --network host --rm -e RUST_LOG=debug ssnt --public-address 127.0.0.1 (broken with both --network host and manual port)

After attempting to spawn as any role both client and server log connection once:

# client
2024-01-11T13:37:51.856986Z  INFO networking: Joining server 127.0.0.1:33998
2024-01-11T13:37:51.913513Z  INFO networking: Connected to server
2024-01-11T13:37:51.985569Z  INFO networking: Joined server tick=0.016666668

# server
024-01-11T13:37:51.937588Z  INFO networking: New client connected connection=ConnectionId(1704980271857) id="cceb82c6-047e-f4d0-cceb-82c6047ef4d0"

Next server log should be INFO ssnt::body: Created creature but it never gets there. Client is stuck in main menu. Hosting server outside container works and i cannot reproduce bug.

I tested a bunch of things so far, none of these change behaviour (local works, container doesnt):

  • hosted server --no-default-features without container
  • bumped rust to 1.75.0
  • tried release and debug modes inside and outside container
  • used apline instead of scratch as final container stage
  • hosted game locally on laptop inside same network and i cannot connect to it

I ran client in pdb and it seem to be stuck in some deadlock:

Traceback
#0  syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
#1  0x00005555595cc101 in std::sys::unix::futex::futex_wait () at library/std/src/sys/unix/futex.rs:62
#2  std::sys::unix::locks::futex_condvar::Condvar::wait_optional_timeout () at library/std/src/sys/unix/locks/futex_condvar.rs:49
#3  std::sys::unix::locks::futex_condvar::Condvar::wait () at library/std/src/sys/unix/locks/futex_condvar.rs:33
#4  0x00005555594f9530 in std::sync::condvar::Condvar::wait<()> (self=0x55555a7026e0, guard=...)
  at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/sync/condvar.rs:189
#5  parking::Inner::park (self=0x55555a7026d0, timeout=...) at src/lib.rs:358
#6  0x00005555594b369a in futures_lite::future::block_on::{closure#0}<alloc::vec::Vec<(), alloc::alloc::Global>, bevy_tasks::task_pool::{impl#2}::scope_with_executor_inner::{async_block_env#0}<bevy_ecs::schedule::executor::multi_threaded::{impl#2}::run::{closure_env#1}, ()>> (cache=...)
  at /home/eugene/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-lite-1.13.0/src/future.rs:91
#7  std::thread::local::LocalKey<core::cell::RefCell<(parking::Parker, core::task::wake::Waker)>>::try_with<core::cell::RefCell<(parking::Parker, core::task::wake::Waker)>, futures_lite::future::block_on::{closure_env#0}<alloc::vec::Vec<(), alloc::alloc::Global>, bevy_tasks::task_pool::{impl#2}::scope_with_executor_inner::{async_block_env#0}<bevy_ecs::schedule::e
xecutor::multi_threaded::{impl#2}::run::{closure_env#1}, ()>>, alloc::vec::Vec<(), alloc::alloc::Global>> (self=<optimized out>, f=...)
  at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/thread/local.rs:270
#8  std::thread::local::LocalKey<core::cell::RefCell<(parking::Parker, core::task::wake::Waker)>>::with<core::cell::RefCell<(parking::Parker, core::task::wake::Waker)>, futures_lite::future::block_on::{closure_env#0}<alloc::vec::Vec<(), alloc::alloc::Global>, bevy_tasks::task_pool::{impl#2}::scope_with_executor_inner::{async_block_env#0}<bevy_ecs::schedule::execu
tor::multi_threaded::{impl#2}::run::{closure_env#1}, ()>>, alloc::vec::Vec<(), alloc::alloc::Global>> (f=...)
  at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/thread/local.rs:246
#9  futures_lite::future::block_on<alloc::vec::Vec<(), alloc::alloc::Global>, bevy_tasks::task_pool::{impl#2}::scope_with_executor_inner::{async_block_env#0}<bevy_ecs::schedule::executor::multi_threaded::{impl#2}::run::{closure_env#1}, ()>> (future=...)
  at /home/eugene/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-lite-1.13.0/src/future.rs:79
#10 0x00005555594dc0d1 in bevy_tasks::task_pool::TaskPool::scope_with_executor_inner<bevy_ecs::schedule::executor::multi_threaded::{impl#2}::run::{closure_env#1}, ()> (
  self=0x555559907988 <bevy_tasks::usages::COMPUTE_TASK_POOL>, external_executor=<optimized out>, scope_executor=<optimized out>, tick_task_pool_executor=<optimized out>, f=...)
  at /home/eugene/.local/share/cargo/git/checkouts/bevy-18d70155abbfd7e1/d5bdf5c/crates/bevy_tasks/src/task_pool.rs:374
#11 0x00005555594dc0d1 in bevy_tasks::task_pool::{impl#2}::scope_with_executor::{closure#0}<bevy_ecs::schedule::executor::multi_threaded::{impl#2}::run::{closure_env#1}, ()> (
  scope_executor=<optimized out>)
#12 std::thread::local::LocalKey<alloc::sync::Arc<bevy_tasks::thread_executor::ThreadExecutor, alloc::alloc::Global>>::try_with<alloc::sync::Arc<bevy_tasks::thread_executor::ThreadExecutor, alloc::alloc::Global>, bevy_tasks::task_pool::{impl#2}::scope_with_executor::{closure_env#0}<bevy_ecs::schedule::executor::multi_threaded::{impl#2}::run::{closure_env#1}, ()>,
alloc::vec::Vec<(), alloc::alloc::Global>> (f=..., self=<optimized out>) at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/thread/local.rs:270
#13 std::thread::local::LocalKey<alloc::sync::Arc<bevy_tasks::thread_executor::ThreadExecutor, alloc::alloc::Global>>::with<alloc::sync::Arc<bevy_tasks::thread_executor::ThreadExecutor, alloc::alloc::Global>, bevy_tasks::task_pool::{impl#2}::scope_with_executor::{closure_env#0}<bevy_ecs::schedule::executor::multi_threaded::{impl#2}::run::{closure_env#1}, ()>, all
oc::vec::Vec<(), alloc::alloc::Global>> (f=...) at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/thread/local.rs:246
#14 bevy_tasks::task_pool::TaskPool::scope_with_executor<bevy_ecs::schedule::executor::multi_threaded::{impl#2}::run::{closure_env#1}, ()> (
  self=0x555559907988 <bevy_tasks::usages::COMPUTE_TASK_POOL>, tick_task_pool_executor=false, external_executor=..., f=...)
  at /home/eugene/.local/share/cargo/git/checkouts/bevy-18d70155abbfd7e1/d5bdf5c/crates/bevy_tasks/src/task_pool.rs:307
#15 0x00005555594cee3f in bevy_ecs::schedule::executor::multi_threaded::{impl#2}::run (self=0x555559939730, schedule=0x7fffffff9458, world=0x7fffffffbb48)
  at src/schedule/executor/multi_threaded.rs:190
#16 0x0000555559476481 in bevy_ecs::world::{impl#3}::try_run_schedule::{closure#0}<&dyn bevy_ecs::schedule::set::ScheduleLabel> (world=0x7fffffffbb48, sched=0x7fffffff9068)
  at /home/eugene/.local/share/cargo/git/checkouts/bevy-18d70155abbfd7e1/d5bdf5c/crates/bevy_ecs/src/world/mod.rs:1851
#17 bevy_ecs::world::World::try_schedule_scope<(), &dyn bevy_ecs::schedule::set::ScheduleLabel, bevy_ecs::world::{impl#3}::try_run_schedule::{closure_env#0}<&dyn bevy_ecs::schedule::set::ScheduleLabel>> (self=0x7fffffffbb48, label=..., f=...) at /home/eugene/.local/share/cargo/git/checkouts/bevy-18d70155abbfd7e1/d5bdf5c/crates/bevy_ecs/src/world/mod.rs:1782
#18 bevy_ecs::world::World::try_run_schedule<&dyn bevy_ecs::schedule::set::ScheduleLabel> (self=<optimized out>, label=...)
  at /home/eugene/.local/share/cargo/git/checkouts/bevy-18d70155abbfd7e1/d5bdf5c/crates/bevy_ecs/src/world/mod.rs:1851
#19 bevy_app::main_schedule::{impl#2}::run_main::{closure#0} (world=0x7fffffffbb48, order=...) at src/main_schedule.rs:146
#20 bevy_ecs::world::World::resource_scope<bevy_app::main_schedule::MainScheduleOrder, (), bevy_app::main_schedule::{impl#2}::run_main::{closure_env#0}> (self=0x7fffffffbb48, f=...)
  at /home/eugene/.local/share/cargo/git/checkouts/bevy-18d70155abbfd7e1/d5bdf5c/crates/bevy_ecs/src/world/mod.rs:1344
#21 0x000055555947e8c5 in core::ops::function::FnMut::call_mut<fn(&mut bevy_ecs::world::World, bevy_ecs::system::system_param::Local<bool>), (&mut bevy_ecs::world::World, bevy_ecs::system::system_param::Local<bool>)> () at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/ops/function.rs:166
#22 core::ops::function::impls::{impl#3}::call_mut<(&mut bevy_ecs::world::World, bevy_ecs::system::system_param::Local<bool>), fn(&mut bevy_ecs::world::World, bevy_ecs::system::system_param::Local<bool>)> (args=..., self=<optimized out>) at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/ops/function.rs:294
#23 bevy_ecs::system::exclusive_function_system::{impl#4}::run::call_inner<(), bevy_ecs::system::system_param::Local<bool>, &mut fn(&mut bevy_ecs::world::World, bevy_ecs::system::system_param::Local<bool>)> (f=0x555559911209, world=0x7fffffffbb48, F0=...)
  at /home/eugene/.local/share/cargo/git/checkouts/bevy-18d70155abbfd7e1/d5bdf5c/crates/bevy_ecs/src/system/exclusive_function_system.rs:203
#24 bevy_ecs::system::exclusive_function_system::{impl#4}::run<(), fn(&mut bevy_ecs::world::World, bevy_ecs::system::system_param::Local<bool>), bevy_ecs::system::system_param::Local<bool>> (self=0x555559911209, world=0x7fffffffbb48, param_value=...)
  at /home/eugene/.local/share/cargo/git/checkouts/bevy-18d70155abbfd7e1/d5bdf5c/crates/bevy_ecs/src/system/exclusive_function_system.rs:206
#25 bevy_ecs::system::exclusive_function_system::{impl#1}::run<fn(bevy_ecs::system::system_param::Local<bool>), fn(&mut bevy_ecs::world::World, bevy_ecs::system::system_param::Local<bool>)> (self=0x555559911140, input=<optimized out>, world=0x7fffffffbb48)
  at /home/eugene/.local/share/cargo/git/checkouts/bevy-18d70155abbfd7e1/d5bdf5c/crates/bevy_ecs/src/system/exclusive_function_system.rs:103
#26 0x00005555594d1bdc in bevy_ecs::schedule::executor::single_threaded::{impl#0}::run::{closure#0} () at src/schedule/executor/single_threaded.rs:98
#27 core::ops::function::FnOnce::call_once<bevy_ecs::schedule::executor::single_threaded::{impl#0}::run::{closure_env#0}, ()> ()
  at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/ops/function.rs:250
#28 core::panic::unwind_safe::{impl#23}::call_once<(), bevy_ecs::schedule::executor::single_threaded::{impl#0}::run::{closure_env#0}> (self=...)
  at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panic/unwind_safe.rs:272
#29 std::panicking::try::do_call<core::panic::unwind_safe::AssertUnwindSafe<bevy_ecs::schedule::executor::single_threaded::{impl#0}::run::{closure_env#0}>, ()> (
  data=<optimized out>) at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:552
#30 std::panicking::try<(), core::panic::unwind_safe::AssertUnwindSafe<bevy_ecs::schedule::executor::single_threaded::{impl#0}::run::{closure_env#0}>> (f=...)
  at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:516
#31 std::panic::catch_unwind<core::panic::unwind_safe::AssertUnwindSafe<bevy_ecs::schedule::executor::single_threaded::{impl#0}::run::{closure_env#0}>, ()> (f=...)
  at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panic.rs:142
#32 bevy_ecs::schedule::executor::single_threaded::{impl#0}::run (self=0x55555990d370, schedule=0x7fffffffa538, world=0x7fffffffbb48) at src/schedule/executor/single_threaded.rs:97
#33 0x0000555559476f0f in bevy_ecs::world::{impl#3}::run_schedule::{closure#0}<&dyn bevy_ecs::schedule::set::ScheduleLabel> (world=0x7fffffffbb48, sched=0x7fffffffa148)
  at /home/eugene/.local/share/cargo/git/checkouts/bevy-18d70155abbfd7e1/d5bdf5c/crates/bevy_ecs/src/world/mod.rs:1865
--Type <RET> for more, q to quit, c to continue without paging--
:ScheduleLabel>> (self=0x7fffffffbb48, label=..., f=...) at /home/eugene/.local/share/cargo/git/checkouts/bevy-18d70155abbfd7e1/d5bdf5c/crates/bevy_ecs/src/world/mod.rs:1782
#35 bevy_ecs::world::World::schedule_scope<(), &dyn bevy_ecs::schedule::set::ScheduleLabel, bevy_ecs::world::{impl#3}::run_schedule::{closure_env#0}<&dyn bevy_ecs::schedule::set::ScheduleLabel>> (self=0x7fffffffbb48, label=..., f=...) at /home/eugene/.local/share/cargo/git/checkouts/bevy-18d70155abbfd7e1/d5bdf5c/crates/bevy_ecs/src/world/mod.rs:1836
#36 0x0000555559472d44 in bevy_ecs::world::World::run_schedule<&dyn bevy_ecs::schedule::set::ScheduleLabel> (self=<optimized out>, label=...) at /home/eugene/.local/share/cargo/git/checkouts/bevy-18d70155abbfd7e1/d5bdf5c/crates/bevy_ecs/src/world/mod.rs:1865
#37 bevy_app::app::App::update (self=0x55555a7026e0) at src/app.rs:244
#38 0x0000555557f14bac in bevy_winit::winit_runner::{closure#0} (event=..., event_loop=0x555559a324c0, control_flow=<optimized out>) at src/lib.rs:699
#39 0x0000555557eda205 in winit::platform_impl::platform::sticky_exit_callback<(), bevy_winit::winit_runner::{closure_env#0}> (evt=..., target=0x1abbe, control_flow=0x7fffffffb118, callback=0x7fffffffbb48) at /home/eugene/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.28.7/src/platform_impl/linux/mod.rs:884
#40 winit::platform_impl::platform::x11::{impl#2}::run_return::single_iteration<(), bevy_winit::winit_runner::{closure_env#0}> (this=0x7fffffffb2a0, control_flow=0x7fffffffb118, cause=0x7fffffffb1a8, callback=0x7fffffffbb48) at /home/eugene/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.28.7/src/platform_impl/linux/x11/mod.rs:358
#41 0x0000555557eda80b in winit::platform_impl::platform::x11::EventLoop<()>::run_return<(), bevy_winit::winit_runner::{closure_env#0}> (self=0x7fffffffb2a0, callback=...) at /home/eugene/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.28.7/src/platform_impl/linux/x11/mod.rs:483
#42 0x0000555557edbfdd in winit::platform_impl::platform::x11::EventLoop<()>::run<(), bevy_winit::winit_runner::{closure_env#0}> (self=..., callback=<error reading variable: Cannot access memory at address 0x4b9>) at /home/eugene/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.28.7/src/platform_impl/linux/x11/mod.rs:498
#43 0x0000555557ec4810 in winit::platform_impl::platform::EventLoop<()>::run<(), bevy_winit::winit_runner::{closure_env#0}> (self=<error reading variable: Cannot access memory at address 0x0>, callback=<error reading variable: Cannot access memory at address 0x430>)
  at /home/eugene/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.28.7/src/platform_impl/linux/mod.rs:792
#44 winit::event_loop::EventLoop<()>::run<(), bevy_winit::winit_runner::{closure_env#0}> (event_handler=<error reading variable: Cannot access memory at address 0x430>) at /home/eugene/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.28.7/src/event_loop.rs:305
#45 bevy_winit::run<bevy_winit::winit_runner::{closure_env#0}> (event_handler=<error reading variable: Cannot access memory at address 0x430>) at src/lib.rs:186
#46 bevy_winit::winit_runner (app=...) at src/lib.rs:787
#47 0x0000555557eb7484 in core::ops::function::FnOnce::call_once<fn(bevy_app::app::App), (bevy_app::app::App)> () at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/ops/function.rs:250
#48 core::ops::function::FnOnce::call_once<fn(bevy_app::app::App), (bevy_app::app::App)> () at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/ops/function.rs:250
#49 0x0000555559472f5c in alloc::boxed::{impl#47}::call_once<(bevy_app::app::App), (dyn core::ops::function::FnOnce<(bevy_app::app::App), Output=()> + core::marker::Send), alloc::alloc::Global> (self=..., args=...) at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/alloc/src/boxed.rs:2015
#50 bevy_app::app::App::run (self=<optimized out>) at src/app.rs:292
#51 0x0000555556943b02 in ssnt::main () at src/main.rs:155

I eventually discovered that "-C", "target-cpu=native" rustc flag causes this to happen. I am not sure how to debug this further

@Fogapod Fogapod changed the title last commit broke server inside container client cannot not connect to container anymore Jan 11, 2024
@Fogapod Fogapod changed the title client cannot not connect to container anymore client cannot connect to container anymore Jan 11, 2024
@Fogapod

This comment was marked as outdated.

@Fogapod Fogapod closed this as completed Jan 11, 2024
@Fogapod Fogapod changed the title client cannot connect to container anymore target-cpu=native breaks client ability to connect to server inside container Jan 11, 2024
@Fogapod Fogapod reopened this Jan 11, 2024
@Fogapod Fogapod changed the title target-cpu=native breaks client ability to connect to server inside container target-cpu=native breaks client ability to connect to server inside container and remote server Jan 11, 2024
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