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

Ctrl-C while an rpc handler has not finished causes errors #15

Closed
varunchodanker opened this issue Feb 26, 2022 · 9 comments · Fixed by #13
Closed

Ctrl-C while an rpc handler has not finished causes errors #15

varunchodanker opened this issue Feb 26, 2022 · 9 comments · Fixed by #13
Assignees
Labels
bug Something isn't working

Comments

@varunchodanker
Copy link
Member

In #13.

  • Reproducible on Linux and Windows.
  • Tested by @moodyhunter and @varunchodanker.
  • In-depth knowledge of 'asyncio' and event loops will likely be necessary for a fix.

The errors produced are given by the following:

(venv) PS C:\Users\varun\OneDrive - University of Warwick\Learning\grpc-io\proactor_eventsn-context> python .\account_server.py
Account Service Server started. Listening on port: 50051                 o\proactor_events
1970-01-01 00:00:00+00:00
Account Service Server stopped.                                          o\base_events.py"
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x000001A384647E20>                                                         o\base_events.py"
Traceback (most recent call last):
  File "C:\Users\varun\AppData\Local\Programs\Python\Python310\lib\asyncio\proactor_events.py", line 116, in __del__                              n-context> 
  File "C:\Users\varun\AppData\Local\Programs\Python\Python310\lib\asyncio\proactor_events.py", line 108, in close
  File "C:\Users\varun\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 745, in call_soon
  File "C:\Users\varun\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 510, in _check_closed
RuntimeError: Event loop is closed
@varunchodanker varunchodanker added the bug Something isn't working label Feb 26, 2022
@moodyhunter moodyhunter self-assigned this Feb 26, 2022
@moodyhunter
Copy link
Contributor

probably fixed, by c3e5a84

@varunchodanker
Copy link
Member Author

Will check on Windows now. Can you confirm whether it is fixed on Linux?

@moodyhunter
Copy link
Contributor

yes on Linux,

I set up a 20-second sleep, during that time I press Ctrl+C, the code now says: "Stopping..."
After 20secs it stops properly with correct data returned back to the client.

@varunchodanker
Copy link
Member Author

Still getting the exact same error on Windows.

@moodyhunter
Copy link
Contributor

confirmed that c07d1ba fixed the problem

@moodyhunter moodyhunter linked a pull request Feb 26, 2022 that will close this issue
@varunchodanker
Copy link
Member Author

varunchodanker commented Feb 26, 2022

c07d1ba uses selector-based event loops that do not have the bug that is present in Proactor event loops. This bug is exemplified in encode/httpx#914.

@varunchodanker
Copy link
Member Author

See #20. This was reintroduced to remove a more severe bug. This issue can be mitigated by ensuring all gRPC clients have finished before stopping the server. This can be achieved by closing the Next component of the application first.

@ksanganee
Copy link
Contributor

Are we good to delete this issue and just know that we close the next client first?

@varunchodanker
Copy link
Member Author

Yes I think so.

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

Successfully merging a pull request may close this issue.

3 participants