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

Mp3 import sometimes crashes the editor #60908

Closed
Tracked by #76797
EspeuteClement opened this issue May 9, 2022 · 4 comments
Closed
Tracked by #76797

Mp3 import sometimes crashes the editor #60908

EspeuteClement opened this issue May 9, 2022 · 4 comments

Comments

@EspeuteClement
Copy link
Contributor

Godot version

4.0.dev (168edcd) (debug)

System information

Windows 10

Issue description

Sometimes, when importing mp3 files in the editor, the editor crashes with this callstack. The bug is not related to the file itself, as I managed to import a file that crashed the editor previously successfully in other tries.

 	godot.windows.tools.64.exe!hdr_valid(const unsigned char * h) Line 266	C++
 	godot.windows.tools.64.exe!mp3d_find_frame(const unsigned char * mp3, int mp3_bytes, int * free_format_bytes, int * ptr_frame_bytes) Line 1676	C++
 	godot.windows.tools.64.exe!mp3dec_decode_frame(mp3dec_t * dec, const unsigned char * mp3, int mp3_bytes, float * pcm, mp3dec_frame_info_t * info) Line 1731	C++
>	godot.windows.tools.64.exe!mp3dec_ex_read_frame(mp3dec_ex_t * dec, float * * buf, mp3dec_frame_info_t * frame_info, unsigned __int64 max_samples) Line 904	C++
 	godot.windows.tools.64.exe!AudioStreamPlaybackMP3::_mix_internal(AudioFrame * p_buffer, int p_frames) Line 51	C++
 	godot.windows.tools.64.exe!AudioStreamPlaybackResampled::begin_resample() Line 105	C++
 	godot.windows.tools.64.exe!AudioStreamPlaybackMP3::start(float p_from_pos) Line 87	C++
 	godot.windows.tools.64.exe!EditorAudioStreamPreviewPlugin::generate(const Ref<Resource> & p_from, const Vector2 & p_size) Line 638	C++
 	godot.windows.tools.64.exe!EditorResourcePreviewGenerator::generate_from_path(const String & p_path, const Vector2 & p_size) Line 69	C++
 	godot.windows.tools.64.exe!EditorResourcePreview::_generate_preview(Ref<ImageTexture> & r_texture, Ref<ImageTexture> & r_small_texture, const EditorResourcePreview::QueueItem & p_item, const String & cache_base) Line 166	C++
 	godot.windows.tools.64.exe!EditorResourcePreview::_iterate() Line 256	C++
 	godot.windows.tools.64.exe!EditorResourcePreview::_thread() Line 334	C++
 	godot.windows.tools.64.exe!EditorResourcePreview::_thread_func(void * ud) Line 106	C++
 	godot.windows.tools.64.exe!Thread::callback(Thread * p_self, const Thread::Settings & p_settings, void(*)(void *) p_callback, void * p_userdata) Line 76	C++

It looks like the mp3d in the AudioStreamPlaybackMP3 was not properly initialised as it points to garbage data. This might be caused by a race condition due to the multithreaded nature of the preview generation, which would explain why the bug is not 100% reproducible.

Steps to reproduce

  1. Import mp3s in an empty project until the editor crashes. The bug might be easier to reproduce on a full debug build of the editor (where I first encountered it)

Minimal reproduction project

No response

@akien-mga
Copy link
Member

Is this still reproducible in 4.0 RC 3 or later?

@akien-mga akien-mga modified the milestones: 4.0, 4.x Feb 22, 2023
@MJacred
Copy link
Contributor

MJacred commented May 10, 2023

Related to / Same error as #71281

@Calinou
Copy link
Member

Calinou commented Jan 9, 2024

@EspeuteClement Can you (or anyone else) still reproduce this bug in Godot 4.2.1 or any later release?

If yes, please ensure that an up-to-date Minimal Reproduction Project (MRP) is included in this report (a MRP is a zipped Godot project with the minimal elements necessary to reliably trigger the bug). You can upload ZIP files in an issue comment with a drag and drop.

@AThousandShips
Copy link
Member

Closing due to lack of response, if you provide the requested information this can be reopened

@AThousandShips AThousandShips closed this as not planned Won't fix, can't repro, duplicate, stale Feb 10, 2024
@AThousandShips AThousandShips removed this from the 4.x milestone Feb 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants