eliot icon indicating copy to clipboard operation
eliot copied to clipboard

"Exception ignored "

Open meejah opened this issue 2 years ago • 6 comments

I'm seeing this traceback in an @eliot.twisted.inline_callbacks-decorated method .. I'm not sure exactly what is happening yet and some initial attempts to re-create the error with a smaller test-case hasn't exhibited the problem.

Exception ignored in: <generator object RemoteScannerService._poll_collective at 0x7f0f7cb277b0>        
Traceback (most recent call last):                                                                        
  File "/home/meejah/work/leastauthority/src/magic-folder/venv3/lib/python3.9/site-packages/eliot/_genera$ors.py", line 111, in wrapper                                                                             
    value_out = context.run(go)                                                                           
  File "/home/meejah/work/leastauthority/src/magic-folder/venv3/lib/python3.9/site-packages/eliot/_genera$ors.py", line 99, in go                                                                                   
    value_out = gen.throw(*value_in)                                                                      
  File "/home/meejah/work/leastauthority/src/magic-folder/src/magic_folder/downloader.py", line 518, in _$oll_collective                                                                                            
    yield gatherResults([                                                                              
  File "/home/meejah/work/leastauthority/src/magic-folder/venv3/lib/python3.9/site-packages/eliot/_action$py", line 434, in __exit__                                                                                
    self.finish(exception)                                                     
  File "/home/meejah/work/leastauthority/src/magic-folder/venv3/lib/python3.9/site-packages/eliot/_action$py", line 356, in finish                                                                                  
    self._logger.write(fields, serializer)                                                               
  File "/home/meejah/work/leastauthority/src/magic-folder/venv3/lib/python3.9/site-packages/eliot/_output$py", line 236, in exclusively_f                                                                           
    with self._lock:   

Perhaps this particular test triggers an error, causing some other logging to happen? (The behavior I see is that we're "hung" here, and a ctrl-C gives the above stack .. so could be a deadlock?).

If I remove the two start_action calls from that method, the test passes.

meejah avatar Jan 08 '22 06:01 meejah

I can get rid of the first traceback (and see the second more-reliably -- but still not "always") if I decorate the method with just @inlineCallbacks instead of @inline_callbacks..

meejah avatar Jan 10 '22 18:01 meejah

I am not sure how much more effort I'm going to put in to @inline_callbacks given the ability to switch to async functions, FWIW, where Eliot contexts should (in theory) just work. Going to test that theory shortly.

itamarst avatar Apr 29 '22 14:04 itamarst

After further investigation:

  1. You likely don't need @inline_callbacks, Twisted's version should work. It turns out Twisted does contextvars for @inlineCallbacks now...
  2. ... except that there's a bug, fixed by https://github.com/twisted/twisted/pull/1690

itamarst avatar May 04 '22 14:05 itamarst

Twisted 22.8 is now out and includes the fix for twisted/twisted#10301

exarkun avatar Sep 14 '22 02:09 exarkun

@meejah if you could retry with latest Twisted and normal inlineCallbacks? If that works I will likely just update docs to tell users to use Twisted directly.

itamarst avatar Sep 14 '22 11:09 itamarst

I tried to "retry", but didn't apparently leave enough hints for future-me to determine how exactly to do that.

I used some code from around the same time (and the line-numbers in the trace at least match up) but I couldn't get the exception to happen again.

meejah avatar Sep 27 '22 03:09 meejah