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

Crash on startup with gdnavigation module disabled #36091

Closed
Tracked by #39196
Xrayez opened this issue Feb 10, 2020 · 8 comments · Fixed by #73031 · May be fixed by #69881
Closed
Tracked by #39196

Crash on startup with gdnavigation module disabled #36091

Xrayez opened this issue Feb 10, 2020 · 8 comments · Fixed by #73031 · May be fixed by #69881

Comments

@Xrayez
Copy link
Contributor

Xrayez commented Feb 10, 2020

Godot version:
v4.0.dev.custom_build 78074fe
Related to #34776.

OS/device including version:
Windows 10

Issue description:
Starting the editor without gdnavigation module compiled leads to a crash:

Godot Engine v4.0.dev.custom_build.78074fed8 - https://godotengine.org
OpenGL ES 3.0 Renderer: GeForce GTX 750 Ti/PCIe/SSE2

ERROR: Condition "create_callback == 0" is true. returned: 0
   at: NavigationServerManager::new_default_server (servers\navigation_server.cpp:101)
CrashHandlerException: Program crashed
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[0] Main::iteration (main\main.cpp:2032)
[1] Main::iteration (main\main.cpp:2032)
[2] OS_Windows::run (platform\windows\os_windows.cpp:3152)
[3] widechar_main (platform\windows\godot_windows.cpp:162)
[4] _main (platform\windows\godot_windows.cpp:184)
[5] main (platform\windows\godot_windows.cpp:196)
[6] __scrt_common_main_seh (f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:288)
[7] BaseThreadInitThunk
-- END OF BACKTRACE --

Steps to reproduce:

  1. Compile with:
scons platform=windows tools=yes target=release_debug bits=64 module_gdnavigation_enabled=no`

or similar configuration.

  1. Start project manager or any other project.
@KoBeWi
Copy link
Member

KoBeWi commented Dec 22, 2020

Seems fixed in 30d469a

@aaronfranke
Copy link
Member

aaronfranke commented Nov 24, 2021

I get this output when trying to run Godot compiled with module_navigation_enabled=no

ERROR: Condition "create_callback == nullptr" is true. Returning: nullptr
   at: new_default_server (servers/navigation_server_3d.cpp:111)
ERROR: The Navigation3D singleton should be initialized before the 2D one.
   at: NavigationServer2D (servers/navigation_server_2d.cpp:206)

================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.0.dev.custom_build (28896c4209bb535f7de5c2e4e9ca4359cc4488fb)
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[1] 1   libsystem_platform.dylib            0x00000001992e84e4 _sigtramp + 56
[2] NavigationServer2D::map_create() const (in godot.osx.opt.tools.arm64) (navigation_server_2d.cpp:214)
[3] World2D::World2D() (in godot.osx.opt.tools.arm64) (world_2d.cpp:84)
[4] Viewport::Viewport() (in godot.osx.opt.tools.arm64) (viewport.cpp:3740)
[5] Window::Window() (in godot.osx.opt.tools.arm64) (window.cpp:1591)
[6] SceneTree::SceneTree() (in godot.osx.opt.tools.arm64) (scene_tree.cpp:1328)
[7] Object* ClassDB::creator<SceneTree>() (in godot.osx.opt.tools.arm64) (class_db.h:129)
[8] Main::start() (in godot.osx.opt.tools.arm64) (main.cpp:0)
[9] main (in godot.osx.opt.tools.arm64) (godot_main_osx.mm:78)
[10] 10  dyld                                0x0000000108c710f4 start + 520
-- END OF BACKTRACE --
================================================================
zsh: abort      bin/godot.osx.opt.tools.arm64

@aaronfranke
Copy link
Member

Some code snippets:

void initialize_navigation_server() {
	ERR_FAIL_COND(navigation_server != nullptr);

	navigation_server = NavigationServer3DManager::new_default_server();
	navigation_2d_server = memnew(NavigationServer2D);
}
NavigationServer3DCallback NavigationServer3DManager::create_callback = nullptr;

NavigationServer3D *NavigationServer3DManager::new_default_server() {
	ERR_FAIL_COND_V(create_callback == nullptr, nullptr);
	return create_callback();
}

The ERR_FAIL_COND_V(create_callback == nullptr, nullptr); line is getting triggered, which returns nullptr, which causes the NavigationServer3D singleton to be null, which causes NavigationServer2D to fail, which crashes the engine.

@Duroxxigar
Copy link
Contributor

Duroxxigar commented Nov 24, 2021

I went through and put some nullptr checks when the NavServer's singleton was being accessed (in 3.x, but I'm sure it'll work for master as well), it was stopping crashes, but not sure if that's the preferred approach for the codebase, or to use preprocessor commands. The server is accessed in the main iteration of the engine as well.

@smix8
Copy link
Contributor

smix8 commented Jun 14, 2022

What is the flag for disabled / enabled navigation in c++ source code e.g. similar to #ifndef _3D_DISABLED?

The crashes are because there are a few regular nodes that try to query navigation related stuff or create navigation related RIDs. In this examples it is crashing cause the world resources want to create the default navigation map and fails. In other examples it crashes because GridMap or TileMap want to create navigation regions ... and so on.

@akien-mga
Copy link
Member

#include "modules/modules_enabled.gen.h"
...

#ifndef MODULE_NAVIGATION_ENABLED
...
#endif

@smix8
Copy link
Contributor

smix8 commented Jun 15, 2022

Since navigation by now is spread over half the engine what is expected from this flag?

Disable the entire navigation related code including navigation nodes, servers, resources, debug and editor plugins?
... or
Disable only the navigationserver and the new nodes?

@aaronfranke
Copy link
Member

@smix8 I'd lean towards disabling more things, up to a point where maintainability becomes difficult.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment