Skip to content

Race Condition in acode.waitForPlugin #2936

Description

@blanhhy

Check for existing issues

  • Completed

Describe the bug / provide steps to reproduce it

acode.waitForPlugin uses a single watcher to mark the same wait target, but plugins are loaded in parallel. If one plugin is waiting and another plugin happens to call it to wait for the same plugin, the former’s watcher identity will be overwritten, resulting in the return value being silently lost.

Acode/src/lib/acode.js

Lines 718 to 729 in b7dbe3d

waitForPlugin(pluginId) {
return new Promise((resolve, reject) => {
if (LOADED_PLUGINS.has(pluginId)) {
return resolve(true);
}
this.#pluginWatchers[pluginId] = {
resolve,
reject,
};
});
}


Reproduction:

Occasional; difficult to reproduce under normal circumstances.

Prerequisites: Two or more plugins are waiting for the same plugin.

The more plugins waiting simultaneously, the larger the plugins are, and the busier the device is, the more likely this issue is to occur.

Environment

Device Information:
WebView Info:
Package Name: com.google.android.webview
Version: 155.0.8059.4

App Info:
Name: Acode
Package Name: com.foxdebug.acode
Version: 1.13.5
Version Code: 1011

Device Info:
Android Version: 16
Manufacturer: OPPO
Model: PJW110
Platform: Android
Cordova Version: 15.1.0

Screen Info:
Width: 360
Height: 804
Color Depth: 24

Additional Info:
Language: zh-TW
User Agent: Mozilla/5.0 (Linux; Android 16; PJW110 Build/BP2A.250605.015; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/155.0.8059.4 Mobile Safari/537.36

If applicable, add mockups / screenshots regarding your vision

No response

If applicable, attach your Acode.log file to this issue.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions