Skip to content

UNIX socket is automatically unlinked #28

Closed

Description

@AndreLouisCaron

When using the built-in event loop, you need to do something like this:

server = await asyncio.start_unix_server(client_connected, path=path)
try:
    # ...
finally:
    server.close()
    await server.wait_closed()
    os.unlink(path)

However, when I use uvloop, the os.unlink() call raises a FileNotFoundError exception.

I was wondering if you already know about this and if it is intentional?

I don't mind adding a try/except clause to silence the exception, but if you're aiming for this event loop to be a drop-in replacement for the built-in event loop, I guess you're going to want to change this?

Activity

  1. 1st1 commented on May 20, 2016

    @1st1
    Member

    Hm, libuv unlinks the path unconditionally, I can't do anything about it.

    @saghul, sorry for bothering you, do you think it's possible to add a flag in libuv to tell it not to unlink the path in uv__pipe_close?

  2. changed the title [-]UNIX socket is automatically unliked[/-] [+]UNIX socket is automatically unlinked[/+] on May 20, 2016
  3. 1st1 commented on May 20, 2016

    @1st1
    Member

    Alternatively we can re-create the path once the unix socket is closed, but it feels too hacky to me.

  4. saghul commented on May 20, 2016

    @saghul

    No worries Yuri. I don't think we'd do that. See the comment before the unlink, it prevents a race.

    Alternatively, you can create a UNIX socket with the Python socket module and use uv_pipe_open, that way the path won't be unlinked because libuv doesn't store it.

  5. 1st1 commented on May 20, 2016

    @1st1
    Member

    @saghul Good idea, I followed your advice :)

    @AndreLouisCaron Thanks for reporting this! Should be fixed in the master branch; I'll also issue a new uvloop release shortly.

  6. AndreLouisCaron commented on May 21, 2016

    @AndreLouisCaron
    Author

    Thanks!

  7. 1st1 commented on May 21, 2016

    @1st1
    Member

    I've just released uvloop v0.4.26. Please check it out.

  8. AndreLouisCaron commented on May 22, 2016

    @AndreLouisCaron
    Author

    Just tried 0.4.26 and it now works as expected! Thanks!

  9. 1st1 commented on May 22, 2016

    @1st1
    Member

    Thanks! Closing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions