dabeaz / curio

Good Curio!
Other
4.02k stars 241 forks source link

examples/fibserve.py does not close the connection. #256

Closed motoya closed 6 years ago

motoya commented 6 years ago

Hi,

I'm learning Curio. I'm stuck in a problem. It is easy to reproduce it but I cannot find the cause of it. I appreciate if you help me.

The problem: examples/fibserve.py does not close the connection. The reproduction process: 1) From another terminal, connect to the server: $ nc localhost 25000 1 1 2 1 ... 2) Terminate the connection from nc by sending EOF (Ctrl-D). 3) Nc hung. At the same time, the server seems to fall into infinite loop, exhausting CPU. Some examinations: 1) Without run_in_process, this problem does not occur. 2) From the third terminal, I can connect to the server even after the problem occurred. But the server is killed by exception when the connection is terminated by sending EOF (Ctrl-D) from this terminal. My environment: Python 3.6.5, the package of Fedora 26.

Thank you in advance.

Motoya Kurotsu

dabeaz commented 6 years ago

Interesting. This is likely being caused by the forked process responsible for running fib() holding an open file descriptor to the socket. I'm not seeing an effect of consuming 100% CPU though. I will investigate further.

motoya commented 6 years ago

Thank you. I confirmed that it works in my environment.