WSL: APR_TCP_DEFER_ACCEPT error when starting Apache2

Logging this issue here as information for others. Issue is benign and can be ignored.

  • Your Windows build number: (Type ver at a Windows Command Prompt) 15063

  • What you’re doing and what’s happening: (Copy&paste specific commands and their output, or include screen shots) Starting Apache2 with:

$ sudo service apache2 restart
  • What’s wrong / what should be happening instead: Following error message is displayed:
* Restarting Apache httpd web server apache2
[Tue Apr 18 18:50:52.618691 2017] [core:warn] [pid 546:tid 140453865195392] (92)Protocol not available: 
AH00076: Failed to enable APR_TCP_DEFER_ACCEPT

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Reactions: 30
  • Comments: 28 (3 by maintainers)

Most upvoted comments

Add the following line to the end of the /etc/apache2/apache2.conf file:

AcceptFilter http none

The TCP_DEFER_ACCEPT socket option is not natively supported by Windows.

WSL team are working with Windows networking team on this issue, but fix likely won’t make it in RS3.

Doesn’t block Apache2 from starting, just a warning. Pile-on below if otherwise.

I have added both http and https

AcceptFilter https none AcceptFilter http none

If you have this warning after enabling SSL (https), just add the following line to the end of the file :

/etc/apache2/apache2.conf

AcceptFilter https none

Keep in mind that this would just hide errors.

This is one of the main issues tracking this problem, so please subscribe to this issue if you’re interested in future progress. @tara-raj will triage with the team and get back to you.

~Still have it on WSL 2.~ Scratch that. I hadn’t converted the distro.

For those as dumb as I am:

wsl --set-version Ubuntu 2

Just updated to WSL2 and no more error.

AcceptFilter https none AcceptFilter http none

instead of every dependent project having to do so

Since these seem to be de rigueur this week

/*  sockopt-stub.c

    sudo apt-install build-essential
    cd ~ && mkdir -p ~/build && cd build
    gcc -fPIC -c -o sockopt-stub.o sockopt-stub.c
    gcc -shared -o sockopt-stub.so sockopt-stub.o -ldl
    export LD_PRELOAD="$PWD/sockopt-stub.so"
    # ... run stuff    
 */
#define _GNU_SOURCE
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <dlfcn.h>

typedef int (*setsockopt_)(int sockfd, int level, int optname,
                      const void *optval, socklen_t optlen);
int setsockopt(int sockfd, int level, int optname,
                      const void *optval, socklen_t optlen)
{
    static setsockopt_ fn = (setsockopt_)(dlsym(RTLD_NEXT, "setsockopt"));
    if (level == IPPROTO_TCP && optname == TCP_DEFER_ACCEPT) {
        return 0;
    }
    return fn(sockfd, level, optname, optval, optlen);
}

Totally untested; I haven’t run it even once. But that should get you there without having to recompile.

set-version

unknown command : --set-version

Yeah, make as @BenMorel said, if you have Windows 10 Build 18917 or higher. Other requirements. Otherwise you have an option to ignore warning.