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: Parameter Max Size in Websocket does not work #111

Open
2 tasks done
Dash83UPV opened this issue Sep 26, 2024 · 1 comment
Open
2 tasks done

Bug: Parameter Max Size in Websocket does not work #111

Dash83UPV opened this issue Sep 26, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@Dash83UPV
Copy link

Describe the bug

Although we can set the max_size value when we create the Surreal() WebSocket connection, this is not propagated to the actual websocket connection. Therefore, when we request data bigger than 1MByte the WS crashes.

Steps to reproduce

ISSUE

Create the table my_table with more than 1MByte of data.
Try to get all the records.

DB = Surreal("ws://192.168.0.1:8000/rpc", max_size=2**30)


async def main2():
    await DB.connect()
    await DB.signin({"user": "root", "pass": "root"})
    await DB.use(database="test", namespace="test")

    try:
        data = await DB.select("my_table")
        print(len(data))
    except Exception as e:
        data = str(e)
        print(data)

It will crush due to error sent 1009 (message too big); no close frame received
Payload to Big XXX > 1MByte

SOLUTION

Possible solution, but perhaps there is more work to do.

In file ws.py change the line

self.ws = await websockets.connect(self.url)  # type: ignore

to

self.ws = await websockets.connect(self.url, max_size=self.max_size)  # type: ignore

Expected behaviour

The expected behavior is for the WS client connection to be opened using the max_size parameter that was given during the Surreal object construction.

SurrealDB version

surreal 1.4.0 for debian on aarch64

surrealdb.py version

surrealdb.py 0.3.2 for windows on aarch64 using Python 3.9.1

Contact Details

[email protected]

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
@Dash83UPV Dash83UPV added the bug Something isn't working label Sep 26, 2024
@4F2E4A2E
Copy link

I am experiencing the same issue. We have a few components in python which must talk to the db. Python SDK is crucial for us to continue with surrealdb.

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