Skip to content

[dylink] Fix missing unlock in emscripten_dlopen()#26935

Merged
kleisauke merged 1 commit into
emscripten-core:mainfrom
kleisauke:fix-missing-unlock
May 14, 2026
Merged

[dylink] Fix missing unlock in emscripten_dlopen()#26935
kleisauke merged 1 commit into
emscripten-core:mainfrom
kleisauke:fix-missing-unlock

Conversation

@kleisauke
Copy link
Copy Markdown
Collaborator

The global write lock was acquired but never released if the
requested library was already loaded.

Noticed while investigating #26913.

The global write lock was acquired but never released if the
requested library was already loaded.

Noticed while investigating emscripten-core#26913.
Copy link
Copy Markdown
Collaborator

@sbc100 sbc100 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this doesn't actually fix #26913?

@kleisauke
Copy link
Copy Markdown
Collaborator Author

So this doesn't actually fix #26913?

Sadly not. emscripten_dlopen() is a separate API, whereas #26913 relates to dlopen().

// Asynchronous version of dlopen. Since WebAssembly module loading in general
// is asynchronous the normal dlopen function can't be used in all situations.
typedef void (*em_dlopen_callback)(void* user_data, void* handle);
void emscripten_dlopen(const char *filename, int flags, void* user_data, em_dlopen_callback onsuccess, em_arg_callback_func onerror);

(For full transparency, #26913 was originally identified in wasm-vips after the Emscripten 5.0.7 update.)

@kleisauke
Copy link
Copy Markdown
Collaborator Author

Having said that, I think #26913 also affects emscripten_dlopen(), since it also calls load_library_done() and subsequently _emscripten_dlsync_threads(), where this issue occurs.

@kleisauke kleisauke merged commit fdda71c into emscripten-core:main May 14, 2026
30 checks passed
@kleisauke kleisauke deleted the fix-missing-unlock branch May 14, 2026 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants