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

Running the Server in debug crashes with stack overflow #214

Open
MindSwipe opened this issue Apr 21, 2023 · 1 comment
Open

Running the Server in debug crashes with stack overflow #214

MindSwipe opened this issue Apr 21, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@MindSwipe
Copy link

Describe the bug

Running make in the server directory doesn't work on Windows, so I copy and pasted the command that make would run into the terminal and ran that, so:

cargo run -- --debug-core debug --max-bots 0 --database-read-only --http-port

8081

This spits out a bunch of info logs, and one error log

[ERROR game_server::entry_point] could not set open file limit: unsupported OS

alongside the referrer snippet for cohort none, and then just

thread 'main' has overflowed its stack
error: process didn't exit successfully: `target\debug\server.exe --max-bots 0 --database-read-only --http-port 8081` (exit code: 0xc00000fd, STATUS_STACK_OVERFLOW)

Expected behavior

I expect the server to start and run.

Additional context (optional)

Running the server in release mode

cargo run --release -- --debug-core debug --max-bots 0 --database-read-only --http-port  8081

Works

@MindSwipe MindSwipe added the bug Something isn't working label Apr 21, 2023
@finnbear
Copy link
Member

Thanks for the issue! You can safely ignore the open file warning, unless you plan to host a web-facing server on Windows. The stack overflow is probably because Rust compiles relatively inefficient code in debug mode and the default stack size in windows is smaller. In the next update, I can introduce some code to request a larger stack for the main thread when running in debug mode.

fn expand_stack(
	fut: impl Future<Output = Result<(), Error>> + Send + 'static,
) -> Result<(), Error> {
	#[allow(unused_mut)]
	let mut builder = Builder::new();

	#[cfg(debug_assertions)]
	{
		builder = builder.stack_size(12_000_000);
	}

	builder
		.spawn(|| {
			let runtime = tokio::runtime::Builder::new_current_thread().build().unwrap();
			runtime.block_on(fut)
		})
		.unwrap()
		.join()
		.unwrap()
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants