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

GDExtension reload spam on Windows 10 due to inconsistent last_modified_time handling #82601

Closed
kkolyan opened this issue Oct 1, 2023 · 0 comments · Fixed by #82603
Closed

Comments

@kkolyan
Copy link
Contributor

kkolyan commented Oct 1, 2023

Godot version

v4.2.dev (0ca8542)

System information

Godot v4.2.dev (0ca8542) - Windows 10.0.19042 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1660 Ti (NVIDIA; 31.0.15.3713) - Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz (12 Threads)

Issue description

Context: godot-rust/gdext hot reload support.

The root cause of the problem is last_modified_time is updated using original DLL file, but checked using DLL copy (that is really loaded).

library_path is checked:

if (FileAccess::get_modified_time(library_path) > last_modified_time) {

library_path is initialized by loaded DLL path:

Error err = OS::get_singleton()->open_dynamic_library(p_path, library, true, &library_path);

library path is updated using original DLL modification time:

FileAccess::get_modified_time(library_path),

From debug inside GDExtension::has_library_changed:

FileAccess::get_modified_time(String::utf8("res://rust/target/debug/fmandate.dll", 36)) = {unsigned long long} 1696116779
FileAccess::get_modified_time(library_path) = {unsigned long long} 									1696117721
FileAccess::get_modified_time(get_path()) = {unsigned long long} 									1696099045
last_modified_time = {unsigned long long} 														1696116779
library_path = U"C:\dev\godot\fmandate-gd\rust\target\debug\~fmandate.dll"

Steps to reproduce

  1. checkout godot master branch
  2. compile it with scons dev_build=yes debug_symbols=yes platform=windows compiledb=yes -j8
  3. get some gdextension. dodge-the-creeps example from gdext is fine, then git clone https://github.com/godot-rust/gdext.git && cd gdext/examples/dodge-the-creeps/rust
  4. compile this gdextension cargo build --package dodge-the-creeps --lib
  5. place breakpoint inside GDExtensionManager::reload_extension
  6. start editor with debugger (I used CLion) path_to_godot_working_copy\bin\godot.windows.editor.x86_64.exe --editor --path ../godot (that's path from rust dir to gdext/examples/dodge-the-creeps/godot)
  7. wait for scene loading. it should load fine.
  8. alt+tab somewhere
  9. catch breakpoint
  10. repeat 8-9 infinitely

Minimal reproduction project

N/A

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

Successfully merging a pull request may close this issue.

2 participants