Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use of pydantic and click in sub-actor causes SIGINT ignoring, hangs... #302

Open
goodboy opened this issue Feb 16, 2022 · 0 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@goodboy
Copy link
Owner

goodboy commented Feb 16, 2022

Ugh, i don't even know what to say about this - lost a day writing a (should take 20m) container supervisor-actor and got lost in figuring out somehow (at least on 3.10) we've got some kinda super weird SIGINT ignoring issue when combining these things.

Example code the replicates this:

import click
import pydantic
import trio
import tractor


@tractor.context
async def just_sleep(

    ctx: tractor.Context,
    **kwargs,

) -> None:
    await ctx.started()
    await trio.sleep_forever()


async def main() -> None:
    # proc = await trio.open_process(
    #     ('python',
    #      '-c',
    #      'import trio; trio.run(trio.sleep_forever)',
    #     )
    # )
    # breakpoint()
    # # import pdb
    # # pdb.set_trace()
    # await trio.sleep_forever()

    async with tractor.open_nursery(
        loglevel='runtime',
    ) as n:

        portal = await n.start_actor(
            'rpc_server',
            enable_modules=[__name__],
        )

        # XXX: syntax requires py3.9
        async with portal.open_context(
            just_sleep,  # taken from pytest parameterization
        ) as (ctx, sent):
            await trio.sleep_forever()



if __name__ == '__main__':
    # run with `sudo python -m <path.to.this>`
    trio.run(main)

I'll push up a test for this eventually as well..

@goodboy goodboy added bug Something isn't working debugging labels Feb 16, 2022
@goodboy goodboy mentioned this issue Feb 16, 2022
6 tasks
@goodboy goodboy changed the title Use of sudo and click in sub-actor causes SIGINT ignoring, hangs... Use of pydantic and click in sub-actor causes SIGINT ignoring, hangs... Feb 16, 2022
@goodboy goodboy self-assigned this Feb 16, 2022
goodboy added a commit that referenced this issue Feb 17, 2022
goodboy added a commit that referenced this issue Mar 14, 2022
goodboy added a commit that referenced this issue Apr 11, 2022
goodboy added a commit that referenced this issue Apr 17, 2022
goodboy added a commit that referenced this issue Jul 12, 2022
goodboy added a commit that referenced this issue Jul 14, 2022
goodboy added a commit that referenced this issue Jul 15, 2022
goodboy added a commit that referenced this issue Jul 27, 2022
goodboy added a commit that referenced this issue Jul 27, 2022
@goodboy goodboy removed the debugging label Aug 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant