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

Web socket connection is not thread safe #32

Closed
joffrey-bion opened this issue Jan 17, 2021 · 0 comments
Closed

Web socket connection is not thread safe #32

joffrey-bion opened this issue Jan 17, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@joffrey-bion
Copy link
Owner

It seems that interacting from several page sessions that were spawned by the same browser session (thus sharing the same web socket) is not thread safe.

We can run into this exception:

Send pending
java.lang.IllegalStateException: Send pending
	at java.net.http/jdk.internal.net.http.websocket.WebSocketImpl.sendText(WebSocketImpl.java:182)
	at org.hildan.krossbow.websocket.jdk.Jdk11WebSocketSession.sendText(Jdk11WebSocketClient.kt:105)
	at org.hildan.chrome.devtools.protocol.ChromeDPConnection.request(ChromeDPConnection.kt:27)
	at org.hildan.chrome.devtools.protocol.ChromeDPSession.request(ChromeDPSession.kt:39)
	at org.hildan.chrome.devtools.domains.target.TargetDomain.createBrowserContext(TargetDomain.kt:586)
	at org.hildan.chrome.devtools.targets.TargetExtensionsKt.attachToNewPage(TargetExtensions.kt:47)
	at org.hildan.chrome.devtools.targets.TargetExtensionsKt.attachToNewPage$default(TargetExtensions.kt:44)
	at IntegrationTests$test_parallelPages$1$invokeSuspend$$inlined$use$lambda$1.invokeSuspend(IntegrationTests.kt:103)

This is consistently reproduced by this test case:
https://github.com/joffrey-bion/chrome-devtools-kotlin/blob/main/src/test/kotlin/IntegrationTests.kt#L95

@joffrey-bion joffrey-bion added the bug Something isn't working label Jan 17, 2021
@joffrey-bion joffrey-bion changed the title Multiplexed page sessions are not thread safe Web socket connection is not thread safe Jan 17, 2021
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

1 participant