Skip to content

Unix sockets are not implemented #134

Closed

Description

socket() works, but bind() doesn't create the actual socket file.
This kills things like wine and ssh-agent.

Activity

  1. SvenGroot commented on Apr 11, 2016

    @SvenGroot
    Member

    Unix sockets are partially implemented, and they do work. The socket files just don't show up in the file system. However, it's still possible to connect to them if you know the path of the socket file. Of course, this does break applications that attempt to "stat" a socket file or do anything else that depends on the file being present.

    We're working to address this issue.

  2. sunilmut commented on Apr 11, 2016

    @sunilmut
    Member

    As Sven Groot (@SvenGroot) mentions, file system integration of UNIX sockets is not complete yet. We will be tracking\prioritizing which features to light up next by looking at the feedback provided at the wpdev portal. We appreciate your feedback and please make sure to provide it through the wpdev portal as well.

  3. MadcowD commented on May 1, 2016

    @MadcowD

    Sven Groot (@SvenGroot) Sunil Muthuswamy (@sunilmut) Just an update I can reproduce the issue referenced with #1331. Jupyter notebook is using sockets and getting Invalid argument (src/tcp_address.cpp:186). Further investigation led me to find that
    libzmq is not currently working with BashOnWindows.

    I built libzmq and got the following log from the test suite. All of the errors point to the same line of code.
    test-suite.txt
    In particular, this is the code which is causing an invalid argument error. See getifaddrs.

    #elif ((defined ZMQ_HAVE_LINUX || defined ZMQ_HAVE_FREEBSD ||\
        defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_OPENBSD ||\
        defined ZMQ_HAVE_QNXNTO || defined ZMQ_HAVE_NETBSD ||\
        defined ZMQ_HAVE_DRAGONFLY || defined ZMQ_HAVE_GNU)\
        && defined ZMQ_HAVE_IFADDRS)
    
    #include <ifaddrs.h>
    
    //  On these platforms, network interface name can be queried
    //  using getifaddrs function.
    int zmq::tcp_address_t::resolve_nic_name (const char *nic_, bool ipv6_, bool is_src_)
    {
        //  Get the addresses.
        ifaddrs *ifa = NULL;
        const int rc = getifaddrs (&ifa);
        errno_assert (rc == 0);
        zmq_assert (ifa != NULL);
    
        //  Find the corresponding network interface.
        bool found = false;
        for (ifaddrs *ifp = ifa; ifp != NULL; ifp = ifp->ifa_next) {
            if (ifp->ifa_addr == NULL)
                continue;
    
            const int family = ifp->ifa_addr->sa_family;
            if ((family == AF_INET || (ipv6_ && family == AF_INET6))
            && !strcmp (nic_, ifp->ifa_name)) {
                if (is_src_)
                    memcpy (&source_address, ifp->ifa_addr,
                            (family == AF_INET) ? sizeof (struct sockaddr_in)
                                                : sizeof (struct sockaddr_in6));
                else
                    memcpy (&address, ifp->ifa_addr,
                            (family == AF_INET) ? sizeof (struct sockaddr_in)
                                                : sizeof (struct sockaddr_in6));
                found = true;
                break;
            }
        }
    
        //  Clean-up;
        freeifaddrs (ifa);
    
        if (!found) {
            errno = ENODEV;
            return -1;
        }
        return 0;
    }
    

    Related #69

  4. benhillis commented on Jun 1, 2016

    @benhillis
    Member

    Adding link to source code exhibiting an issue: #207

  5. lypanov commented on Nov 10, 2016

    @lypanov

    This AFAICT also breaks Rails 5 out of the box without the hack of disabling of spring (it's simply too slow at times without Spring so this is really painful). Any news on this?

  6. mindplay-dk commented on Apr 10, 2017

    @mindplay-dk

    This may be what's breaking the default socket-based configuration with NGINX and PHP-FPM? I was able to get it to run reliably only after configuring it to use TCP instead of sockets, and also failed to use sockets with PHP, is this all related to this issue?

    Is there a fix on the way, or is this very far off? I really want to use UOW for development on my Windows system, mainly because there are features (such as sockets, threads and readline support) that are unavailable in Windows-builds of PHP.

  7. aseering commented on Apr 10, 2017

    @aseering
    Contributor

    Could someone on the WSL team perhaps summarize what they believe to be the status of this issue?

    I have personally used UNIX Sockets without any issue. But I haven't done anything fancy with them. I realize it's more complicated than a simple "works" vs "not works" -- there are lots of flags and options and whatnot that you can set on a socket that affect its behavior; my understanding is that some work and some do not.

  8. sunilmut commented on Apr 10, 2017

    @sunilmut
    Member

    Adam Seering (@aseering) - We are not aware of any open issues with the WSL AF_UNIX socket implementation. But, I know it's not fully compatible yet because for example the dbus test does not give the same results as that of native Ubuntu. We haven't dug into all the failures yet. We are trying to prioritize issues reported here as they come.

    Rasmus Schultz (@mindplay-dk) - Thanks for your post. We will have to take one issue at a time, so that we can root cause and fix it. Can you please post repro steps, build number and strace, if possible? You can see the template here. To gather strace, use strace -o <trace_file> -ff <cmd>

  9. aseering commented on Apr 10, 2017

    @aseering
    Contributor

    Regarding capturing an strace, the challenge here will presumably be identifying what command to run. (The "command" in this case is two separate backgrounded system services, nginx and php-fpm; both would need to be run directly and in the foreground.) Rasmus Schultz (@mindplay-dk) -- I think you indicated on #1851 that you weren't sure how to accomplish that level of Linux magic? I can try to take a look, but I may not get to it for a while. If anyone else is following this thread and would be willing to give it a shot, please do.

  10. aseering commented on Apr 10, 2017

    @aseering
    Contributor

    Sunil Muthuswamy (@sunilmut) -- thanks! The title of this ticket implies that UNIX sockets don't work at all. And the ticket is still open. Up to you, but I wonder if some ticket-wrangling might be in order? :-)

  11. sunilmut commented on Apr 10, 2017

    @sunilmut
    Member

    Adam Seering (@aseering) - Makes sense. I will close this issue out, it's too broad and not actionable. Rasmus Schultz (@mindplay-dk) - We will continue to work with you on the other issue.

    As for the strace, we would have to then rely on the repro.

  12. mindplay-dk commented on Apr 11, 2017

    @mindplay-dk

    Sunil Muthuswamy (@sunilmut) I know you closed this issue, but not sure where else to answer the questions you asked. (?)

    To help you repeat the php-pm issue, here's the sandbox project for testing:

    https://bitbucket.org/mindplaydk/http-bench

    This project has a bunch of different scripts that all do the same thing - return a JPEG image - in different ways, because I'm using it to benchmark and evaluate the performance of various means of sending an image.

    Clone the project locally.

    Run composer install and you should be all set.

    Run vendor/bin/ppm from the project root folder to launch.

    The relevant changes for the php-pm setup happened in this commit and the only thing I wrote really was this simple front controller which does nothing except return the image, it doesn't even care what the Request looks like at all. Quick and dirty.

    I posted steps to recreate my environment here.

    I'm on Windows 10 Pro version 1703 build 15063.13

    I tried to run that "strace" you asked for, so, this:

    strace -o ./strace -ff vendor/bin/ppm start
    

    It produced these files.

    I think that's everything you asked for - let me know if there's anything else I can do?

  13. mindplay-dk commented on Apr 11, 2017

    @mindplay-dk

    (oh, and I guess composer install worked on my system because it's in the path on my Windows system already and the phar file works with the Linux installation of PHP as well. If you don't have Composer installed, you may need to do that first.)

  14. 0x4248 commented on Jan 25, 2021

    @0x4248

    im getting a Socket type not supported when i use tcpdump anyone help

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