Skip to content

fix: avoid potentially infinite hangs on async messages#669

Merged
ACTCD merged 1 commit into
mainfrom
fix/api-infinite-hang
Jul 12, 2024
Merged

fix: avoid potentially infinite hangs on async messages#669
ACTCD merged 1 commit into
mainfrom
fix/api-infinite-hang

Conversation

@ACTCD

@ACTCD ACTCD commented Jul 9, 2024

Copy link
Copy Markdown
Collaborator

When using GM APIs, if the background script returns an undefined value, the reply may never be delivered, and awaiting the promise will cause the script to hang indefinitely.

The issue existed in the latest release version, but since undefined values were not returned in most cases, it was unlikely that the error would be encountered except in some edge cases.

However, with the revise of GM APIs in #570 (currently still in beta versions), which brought in more possibilities of returning undefined values, the issue was finally exposed.

Fix this by avoiding returning any undefined values, use predefined structured message objects.

@ACTCD ACTCD requested a review from quoid July 9, 2024 06:21

@quoid quoid left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Code changes make sense to me 👍.

ACTCD added a commit that referenced this pull request Jul 11, 2024
@ACTCD ACTCD mentioned this pull request Jul 11, 2024
Base automatically changed from fastlane to main July 12, 2024 07:10
@ACTCD ACTCD merged commit a88d4b6 into main Jul 12, 2024
@ACTCD ACTCD deleted the fix/api-infinite-hang branch July 12, 2024 07:10
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