Skip to content

Hang in event.wait() with current master #86

@njsmith

Description

@njsmith

Hi, me again...

With curio 0.5, this code works as expected. With current master, it hangs mysteriously:

import curio

event1 = curio.Event()
event2 = curio.Event()

async def f1():
    print("f1: 1")
    await event1.set()
    print("f1: 2")
    await event2.wait()    # <--- this never returns
    print("f1: 3")

async def f2():
    print("f2: 1")
    await event1.wait()
    print("f2: 2")
    await event2.set()
    print("f2: 3")

async def main():
    print("main: 1")
    for task in [await curio.spawn(f1()), await curio.spawn(f2())]:
        print("main: 2")
        await task.join()
        print("main: 3")
    print("main: 4")

curio.run(main(), with_monitor=True)

Output with 0.5:

main: 1
f1: 1
f1: 2
f2: 1
f2: 2
main: 2
f1: 3
f2: 3
main: 3
main: 2
main: 3
main: 4

Output with 7eb64a2:

main: 1
f1: 1
f1: 2
f2: 1
f2: 2
main: 2
f2: 3
# then hangs until killed

(Encountered while writing a test for #85, which is why it doesn't have tests yet.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions