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

[Bug] Race Condition in V8Guard #389

Closed
caoccao opened this issue Sep 6, 2024 · 0 comments · Fixed by #390
Closed

[Bug] Race Condition in V8Guard #389

caoccao opened this issue Sep 6, 2024 · 0 comments · Fixed by #390
Assignees
Labels
bug Something isn't working

Comments

@caoccao
Copy link
Owner

caoccao commented Sep 6, 2024

Problem

There is a global thread-safe priority queue for V8Guard instances. There are flaws in the current implementation.

  1. There is no synchronization between take() and add() in the daemon thread.
  2. The daemon thread doesn't check whether a V8Guard instance is closed or not.

That creates a slight chance of adding a closed V8Guard in the daemon thread when there is constant heavy load. That results in executions terminated early.

Impact Versions

v3.1.3-v3.1.6

Solution

  • Add synchronized check against V8Guard.isClosed().
@caoccao caoccao self-assigned this Sep 6, 2024
@caoccao caoccao added the bug Something isn't working label Sep 6, 2024
caoccao added a commit that referenced this issue Sep 6, 2024
@caoccao caoccao linked a pull request Sep 8, 2024 that will close this issue
@caoccao caoccao closed this as completed Sep 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant