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

Issues with sys.stdout.write() in async function #1404

Open
1 of 2 tasks
kumeagidi opened this issue Nov 25, 2023 · 0 comments
Open
1 of 2 tasks

Issues with sys.stdout.write() in async function #1404

kumeagidi opened this issue Nov 25, 2023 · 0 comments

Comments

@kumeagidi
Copy link
Contributor

kumeagidi commented Nov 25, 2023

Search before asking

  • I have searched the EvaDB issues and found no similar bug report.

Bug

When attempting to print the server's response to the console in interpreter.py in the read_from_client_and_send_to_server() function, it is possible to get a BlockingIOError: [Errno 35] write could not complete without blocking.

This only occurs when the server's response is large (containing a lot of text). This is an issue because the result of a query can vary in size.

The exact error:
Task exception was never retrieved
future: <Task finished name='Task-2' coro=<read_from_client_and_send_to_server() done, defined at /Users/kumeagidi/Documents/School/Fall 2023.nosync/CS 6422/Project2/evadb/evadb/server/interpreter.py:55> exception=BlockingIOError(35, 'write could not complete without blocking', 0)>
Traceback (most recent call last):
File "/Users/kumeagidi/Documents/School/Fall 2023.nosync/CS 6422/Project2/evadb/evadb/server/interpreter.py", line 85, in read_from_client_and_send_to_server
sys.stdout.write(str(response) + "\n")
BlockingIOError: [Errno 35] write could not complete without blocking

To replicate this, run:
python3 evadb_server.py --host="0.0.0.0" --port=8803 to start the server and
python3 evadb_cmd_client.py --host="0.0.0.0" --port=8803 to start the client.

Then once you are able to type in the client, run SHOW FUNCTIONS;. SHOW FUNCTIONS is a query that produces a large number of results. Thus it replicates this issue.

The result should be a BlockingIOError.

I investigated methods to fix this issue and I came across an asynchronous library that uses asynchronous prints called aioconsole, though I am unsure if this would resolve this issue. The relevant method in this package would be aprint().

Environment

No response

Are you willing to submit a PR?

  • Yes I'd like to help by submitting a PR!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant