python / asyncio

asyncio historical repository
https://docs.python.org/3/library/asyncio.html
1.04k stars 177 forks source link

StreamReader read with an exception '..incoming data' #475

Closed dpineiden closed 7 years ago

dpineiden commented 7 years ago

Hello I'm implementing a server with in/out data and using the start_unix_server coroutine. It's give correctly the reader and writer. I'm using the reader with await reader.read(n=bs) In a method who read a data stream. In general the system works fine, but raise this exception:

"RuntimeError: read() called while another coroutine is already waiting for incoming data"

my project is: https://gitlab.com/pineiden/gus/blob/master/gnc_socket.py

On documentation, there are no advise about how to use read() correctly, so i used like a normal coroutine.

So, the question is about how to use that Streamreader and why it raise the exception.

Thanks!

PD: To test, run test2_server.py, and test_client.py

Martiusweb commented 7 years ago

Hi,

The link you provided points to a 404.

This is likely a bug in your code: the error you receive means that you're trying to read twice on the same StreamReader concurrently, which is forbidden for consistency.

Good luck!

Martiusweb commented 7 years ago

I think that this issue can be closed.