You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using AsyncSurreal with web socket (ws:// url), any attempt to have concurrent async requests fails with "cannot call recv while another coroutine is already running recv or recv_streaming".
This does not happen with the http client in v1.0.3.
Probably related to #101 and maybe #160 (async issues)
What is the status of this ? Should we use the http connection for async or is it a bug ? I remember the http connection having restrictions, and ws being the recommended way to use SurrealDB, so it seems strange to me.
#101 is closed with a message saying that concurrency issues are solved #101 (comment) but how can we "get 100% control over the async coroutine" ?
I really want to use SurrealDB, but for this async support in python should be rock solid.
Steps to reproduce
Here is a demo program (adapt for your auth, namespace and database)
Change the connection method (http to ws in AsyncSurreal("http://localhost:8000/rpc")) to go from working to failure.
importasynciofromsurrealdbimportAsyncSurrealasyncdefmain(n):
asyncwithAsyncSurreal("http://localhost:8000/rpc") asdb:
awaitdb.signin({"username": 'root', "password": 'root'})
awaitdb.use("test", "test")
asyncwithasyncio.TaskGroup() astg:
tasks= [tg.create_task(db.query("select $p**2 as ret from {}", dict(p=num))) fornuminrange(n)]
return [t.result()[0]["ret"] fortintasks]
if__name__=="__main__":
print(asyncio.run(main(5)))
Expected behaviour
Working : (with http:) [0, 1, 4, 9, 16]
Not Working : (with ws:) websockets.exceptions.ConcurrencyError: cannot call recv while another coroutine is already running recv or recv_streaming
SurrealDB version
surreal version 2.2.1 for macos on aarch64
surrealdb.py version
surrealdb.py 1.0.3 for macOS on aarch64 using python 3.13.1
Contact Details
No response
Is there an existing issue for this?
I have searched the existing issues
Code of Conduct
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
@Anton-2 thanks for the bug report, I'll run through this code example in a debugger to see what's going on. Currently working on a serialization of None error, then a RecordId check error but then after those this will be next.
Describe the bug
When using AsyncSurreal with web socket (ws:// url), any attempt to have concurrent async requests fails with "cannot call recv while another coroutine is already running recv or recv_streaming".
This does not happen with the http client in v1.0.3.
Probably related to #101 and maybe #160 (async issues)
What is the status of this ? Should we use the http connection for async or is it a bug ? I remember the http connection having restrictions, and ws being the recommended way to use SurrealDB, so it seems strange to me.
#101 is closed with a message saying that concurrency issues are solved #101 (comment) but how can we "get 100% control over the async coroutine" ?
I really want to use SurrealDB, but for this async support in python should be rock solid.
Steps to reproduce
Here is a demo program (adapt for your auth, namespace and database)
Change the connection method (http to ws in
AsyncSurreal("http://localhost:8000/rpc")
) to go from working to failure.Expected behaviour
Working : (with http:)
[0, 1, 4, 9, 16]
Not Working : (with ws:)
websockets.exceptions.ConcurrencyError: cannot call recv while another coroutine is already running recv or recv_streaming
SurrealDB version
surreal version 2.2.1 for macos on aarch64
surrealdb.py version
surrealdb.py 1.0.3 for macOS on aarch64 using python 3.13.1
Contact Details
No response
Is there an existing issue for this?
Code of Conduct
The text was updated successfully, but these errors were encountered: