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

Sobek runtime shouldn't be accessed while parsing options in async APIs #1162

Closed
14 tasks done
Tracked by #1138
ankur22 opened this issue Jan 18, 2024 · 2 comments
Closed
14 tasks done
Tracked by #1138
Assignees
Labels
bug Something isn't working

Comments

@ankur22
Copy link
Collaborator

ankur22 commented Jan 18, 2024

What

We must not work with the goja runtime when the browser module is running a promisified API call off the event loop i.e. on a new goroutine. All promisified APIs in the browser run in a new goroutine. A concrete example of such a case is with page.goto where it is parsing the goja values in the new goroutine, which should be moved to the mapping layer.

This issue only deals with the refactoring of the option and argument parsing, #1182 deals with the inner goja usage.

Why

The goja runtime is not thread safe and should only be accessed when running on the event loop. If this is not adhered to, it can cause panics during runtime.

How

The following is the list of all async/promisified APIs, check each one and ensure that the goja runtime is only accessed in the event loop thread and not in the new go routine.

Note

@ankur22 ankur22 added the bug Something isn't working label Jan 18, 2024
@inancgumus
Copy link
Member

Nice initiative! Thanks. Related: #1064.

@ankur22 ankur22 self-assigned this Jan 19, 2024
@inancgumus inancgumus self-assigned this Jan 22, 2024
@ankur22 ankur22 changed the title Goja runtime shouldn't be accessed inside of promise goroutine Goja runtime shouldn't be accessed while parsing options in async APIs Jan 24, 2024
@inancgumus
Copy link
Member

Should we close this one? @ankur22

@ankur22 ankur22 closed this as completed Feb 9, 2024
@inancgumus inancgumus changed the title Goja runtime shouldn't be accessed while parsing options in async APIs Sobek runtime shouldn't be accessed while parsing options in async APIs Jun 21, 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

No branches or pull requests

2 participants