dabeaz / curio

Good Curio!
Other
4.02k stars 241 forks source link

Monitor breaks on viewing async generator frames #250

Closed Fuyukai closed 4 years ago

Fuyukai commented 6 years ago
curio > ps
Task   State        Cycles     Timeout Task                                               
------ ------------ ---------- ------- --------------------------------------------------
1      FUTURE_WAIT  1          None    Monitor.monitor_task                              
2      READ_WAIT    4          None    Kernel._run_coro.<locals>._kernel_task            
3      SEMA_ACQUIRE 38         None    Client.run_async                                  
4      TASK_JOIN    36         None    Client.handle_shard                               
75     TASK_JOIN    1          None    EventManager._safety_wrapper                      
curio > where 4
Bad command. 'async_generator_asend' object has no attribute 'gi_frame'
dabeaz commented 6 years ago

Do you have a short sample program I can look at for testing?

Fuyukai commented 6 years ago

Yes, this reproduces the bug.

import curio

async def agen():
    yield 1
    await curio.sleep(6000)
    yield 2

async def testfn():
    async for result in agen():
        pass

curio.run(testfn, with_monitor=True)

Doing where on testfn will produce the specified error.

dabeaz commented 6 years ago

Whoa. Chasing control flow through an asynchronous generator is a black hole. Not an easy fix, but I reported it as a bug/feature request to CPython. https://bugs.python.org/issue32810