File tree 1 file changed +14
-0
lines changed 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -222,6 +222,14 @@ def runforever(self):
222
222
raise
223
223
except :
224
224
combined_map [fd ].handle_error ()
225
+ else :
226
+ # if the fd is not in combined_map, we should unregister it. otherwise,
227
+ # it will be polled every time, which may cause 100% cpu usage
228
+ self .options .logger .warn ('unexpected read event from fd %r' % fd )
229
+ try :
230
+ self .options .poller .unregister_readable (fd )
231
+ except :
232
+ pass
225
233
226
234
for fd in w :
227
235
if fd in combined_map :
@@ -237,6 +245,12 @@ def runforever(self):
237
245
raise
238
246
except :
239
247
combined_map [fd ].handle_error ()
248
+ else :
249
+ self .options .logger .warn ('unexpected write event from fd %r' % fd )
250
+ try :
251
+ self .options .poller .unregister_writable (fd )
252
+ except :
253
+ pass
240
254
241
255
for group in pgroups :
242
256
group .transition ()
You can’t perform that action at this time.
0 commit comments