-
Notifications
You must be signed in to change notification settings - Fork 13
playwright-java is not thread-safe - wrap? #5
Copy link
Copy link
Open
Description
Playwright is not thread safe, i.e. all its methods as well as methods on all objects created by it (such as BrowserContext, Browser, Page etc.) are expected to be called on the same thread where Playwright object was created or proper synchronization should be implemented to ensure only one thread calls Playwright methods at any given time.
By coincidence, I encountered that issue before reading that passage: if I tried to spawn multiple browsers in a pmap, it would fail opaquely.
Therefore it seems a good idea for Wally's API to prevent unsafe usage.
One possible approach would be to use ThreadLocals. And another, to use clojure.core/locking.
I might be able to offer a POC PR with a possible API if you'd appreciate that.
Cheers - V
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels