ClassDB is not fully thread safe, but is expected to be.
bugtopic:core
### Tested versions
This is another one of those crash reports that we get from telemetry.
### System information
Godot 4.6-based engine.
### Issue description
The scenario is:
- DynamicFont Import calls:
- ResourceSave which calls
- PropertyUtilis which calls:
- - ClassDB::class_get_default_property_values()
On one of the worker threads, the stack trace is:
```
0 Xogot 0x000000010607b880 <deduplicated_symbol> + 236
1 Xogot 0x000000010e491dcc ClassDB::class_get_default_property_value(StringName const&, StringName const&, bool*) + 1016 (class_db.cpp:2298)
2 Xogot 0x000000010b1d5f7c PropertyUtils::get_property_default_value(Object const*, StringName const&, bool*, Vector<SceneState::PackState> const*, bool, Node const*, bool*) + 1616 (property_utils.cpp:176)
3 Xogot 0x000000010dfaa154 ResourceFormatSaverBinaryInstance::save(String const&, Ref<Resource> const&, unsigned int) + 4196 (resource_format_binary.cpp:2289)
4 Xogot 0x000000010dfac990 ResourceFormatSaverBinary::save(Ref<Resource> const&, String const&, unsigned int) + 164 (resource_format_binary.cpp:2521)
5 Xogot 0x000000010dfee1c0 ResourceSaver::save(RequiredParam<Resource>, String const&, unsigned int) + 716 (resource_saver.cpp:128)
6 Xogot 0x00000001095faed8 ResourceImporterDynamicFont::import(long long, String const&, String const&, HashMap<StringName, Variant, HashMapHasherDefault, HashMapComparatorDefault<StringName, void>, DefaultTypedAllocator<Has... + 7080 (resource_importer_dynamic_font.cpp:279)
7 Xogot 0x0000000108fe2428 EditorFileSystem::_reimport_file(String const&, HashMap<StringName, Variant, HashMapHasherDefault, HashMapComparatorDefault<StringName, void>, DefaultTypedAllocator<HashMapElement<StringName, Varia... + 6532 (editor_file_system.cpp:3025)
8 Xogot 0x0000000108fee450 std::__1::__function::__func<EditorFileSystem::_reimport_file_with_thread_policy(EditorFileSystem::ImportFile const&)::$_0, Error ()>::operator()() + 68 (function.h:174)
9 Xogot 0x0000000108fe7048 EditorFileSystem::_run_import_with_thread_policy(bool, std::__1::function<Error ()> const&) + 236 (editor_file_system.cpp:3345)
10 Xogot 0x0000000108fe711c EditorFileSystem::_reimport_thread(unsigned int, EditorFileSystem::ImportThreadData*) + 88 (editor_file_system.cpp:3381)
11 Xogot 0x000000010e4f1760 WorkerThreadPool::_process_task(WorkerThreadPool::Task*) + 468 (worker_thread_pool.cpp:0)
12 Xogot 0x000000010e4f20b0 WorkerThreadPool::_thread_function(void*) + 408 (worker_thread_pool.cpp:236)
13 Xogot 0x0000000107cc7074 Thread::thread_callback(void*) + 148 (thread_apple.cpp:58)
14 libsystem_pthread.dylib 0x00000001e89a4438 _pthread_start + 136 (:-1)
15 libsystem_pthread.dylib 0x00000001e89a08cc thread_start + 8
```
The ResourceImporterDynamicFont retries true from "can_import_threaded", which makes me think this is not just a mistake on the font code. And the crash is in ClassDB nonetheless in a codepath that looks unprotected, so I do not think this is the real problem.
### Steps to reproduce
No steps, this is a telemetry crash report
### Minimal reproduction project (MRP)
No repro.
1 条评论