Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upIgnoring KeyboardInterrupt #295
Closed
Labels
Comments
|
Alright, I think I know what causes the bug. Will need to refactor our signals setup/processing code a bit to untangle it. I'll release RC2 tomorrow or the day after with the fix. |
1st1
added a commit
that referenced
this issue
Oct 28, 2019
When uvloop is run in the main thread we *always* want to set up a self-pipe and a signal wakeup FD. That's the only way how libuv can be notified that a ^C happened and break away from selecting on sockets. asyncio does not need to do that, as the 'selectors' module it uses is already aware of the way Python implements ^C handling. This translates to a slightly different behavior between asyncio & uvloop: 1. uvloop needs to always call signal.set_wakeup_fd() when run in the main thread; 2. asyncio only needs to call signal.set_wakeup_fd() when a user registers a signal handler. (2) means that if the user had not set up any signals, the signal wakeup FD stays the same between different asyncio runs. This commit fixes uvloop signal implementation to make sure that uvloop behaves the same way as asyncio in regards to signal wakeup FD between the loop runs. It also ensures that uvloop always have a proper self-pipe set up so that ^C is always supported when it is run in the main thread. Issue #295.
1st1
added a commit
that referenced
this issue
Oct 28, 2019
When uvloop is run in the main thread we *always* want to set up a self-pipe and a signal wakeup FD. That's the only way how libuv can be notified that a ^C happened and break away from selecting on sockets. asyncio does not need to do that, as the 'selectors' module it uses is already aware of the way Python implements ^C handling. This translates to a slightly different behavior between asyncio & uvloop: 1. uvloop needs to always call signal.set_wakeup_fd() when run in the main thread; 2. asyncio only needs to call signal.set_wakeup_fd() when a user registers a signal handler. (2) means that if the user had not set up any signals, the signal wakeup FD stays the same between different asyncio runs. This commit fixes uvloop signal implementation to make sure that uvloop behaves the same way as asyncio in regards to signal wakeup FD between the loop runs. It also ensures that uvloop always have a proper self-pipe set up so that ^C is always supported when it is run in the main thread. Issue #295.
1st1
added a commit
that referenced
this issue
Oct 28, 2019
When uvloop is run in the main thread we *always* want to set up a self-pipe and a signal wakeup FD. That's the only way how libuv can be notified that a ^C happened and break away from selecting on sockets. asyncio does not need to do that, as the 'selectors' module it uses is already aware of the way Python implements ^C handling. This translates to a slightly different behavior between asyncio & uvloop: 1. uvloop needs to always call signal.set_wakeup_fd() when run in the main thread; 2. asyncio only needs to call signal.set_wakeup_fd() when a user registers a signal handler. (2) means that if the user had not set up any signals, the signal wakeup FD stays the same between different asyncio runs. This commit fixes uvloop signal implementation to make sure that uvloop behaves the same way as asyncio in regards to signal wakeup FD between the loop runs. It also ensures that uvloop always have a proper self-pipe set up so that ^C is always supported when it is run in the main thread. Issue #295.
1st1
added a commit
that referenced
this issue
Oct 29, 2019
When uvloop is run in the main thread we *always* want to set up a self-pipe and a signal wakeup FD. That's the only way how libuv can be notified that a ^C happened and break away from selecting on sockets. asyncio does not need to do that, as the 'selectors' module it uses is already aware of the way Python implements ^C handling. This translates to a slightly different behavior between asyncio & uvloop: 1. uvloop needs to always call signal.set_wakeup_fd() when run in the main thread; 2. asyncio only needs to call signal.set_wakeup_fd() when a user registers a signal handler. (2) means that if the user had not set up any signals, the signal wakeup FD stays the same between different asyncio runs. This commit fixes uvloop signal implementation to make sure that uvloop behaves the same way as asyncio in regards to signal wakeup FD between the loop runs. It also ensures that uvloop always have a proper self-pipe set up so that ^C is always supported when it is run in the main thread. Issue #295.
1st1
added a commit
that referenced
this issue
Oct 29, 2019
When uvloop is run in the main thread we *always* want to set up a self-pipe and a signal wakeup FD. That's the only way how libuv can be notified that a ^C happened and break away from selecting on sockets. asyncio does not need to do that, as the 'selectors' module it uses is already aware of the way Python implements ^C handling. This translates to a slightly different behavior between asyncio & uvloop: 1. uvloop needs to always call signal.set_wakeup_fd() when run in the main thread; 2. asyncio only needs to call signal.set_wakeup_fd() when a user registers a signal handler. (2) means that if the user had not set up any signals, the signal wakeup FD stays the same between different asyncio runs. This commit fixes uvloop signal implementation to make sure that uvloop behaves the same way as asyncio in regards to signal wakeup FD between the loop runs. It also ensures that uvloop always have a proper self-pipe set up so that ^C is always supported when it is run in the main thread. Issue #295.
1st1
added a commit
that referenced
this issue
Oct 29, 2019
When uvloop is run in the main thread we *always* want to set up a self-pipe and a signal wakeup FD. That's the only way how libuv can be notified that a ^C happened and break away from selecting on sockets. asyncio does not need to do that, as the 'selectors' module it uses is already aware of the way Python implements ^C handling. This translates to a slightly different behavior between asyncio & uvloop: 1. uvloop needs to always call signal.set_wakeup_fd() when run in the main thread; 2. asyncio only needs to call signal.set_wakeup_fd() when a user registers a signal handler. (2) means that if the user had not set up any signals, the signal wakeup FD stays the same between different asyncio runs. This commit fixes uvloop signal implementation to make sure that uvloop behaves the same way as asyncio in regards to signal wakeup FD between the loop runs. It also ensures that uvloop always have a proper self-pipe set up so that ^C is always supported when it is run in the main thread. Issue #295.
|
Fixed in uvloop 0.14.0rc2. Thank you! |
|
@1st1 I appreciate the quick turnaround. Keep up the great work. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
PYTHONASYNCIODEBUGin env?: YesHere is a code snippet:
Execute the file:
python issue.pyHit
Ctrl+C.The keyboard interrupt will be ignored. If you comment out line 28
uvloop.install()the interrupt is respected. This used to work fine, only noticed that it stopped working today.