Skip to content

http server hangs after ~16,400 connections #66

Closed
@gopherbot

Description

@gopherbot

by andy.gayton:

What steps will reproduce the problem?

1. Start the example hello world web server:

package main

import (
    "http";
    "io";
)

// hello world, the web server
func HelloServer(c *http.Conn, req *http.Request) {
    io.WriteString(c, "hello, world!\n");
}

func main() {
    http.Handle("/hello", http.HandlerFunc(HelloServer));
    err := http.ListenAndServe(":12345", nil);
    if err != nil {
        panic("ListenAndServe: ", err.String())
    }
}

2. Run apache bench against the server:

ab -n 100000 -c 1 http://localhost:12345/hello

What is the expected output? What do you see instead?

On my laptop, the server hangs around 16400 requests:

andy@romana:~$ ab -n 100000 -c 1 http://localhost:12345/hello
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)
Completed 10000 requests
apr_poll: The timeout specified has expired (70007)
Total of 16387 requests completed

The server doesn't need to be restarted, to repeat another attempt, which
will also hang around 16400 requests.

What is your $GOOS?  $GOARCH?

andy@romana:~$ echo $GOOS $GOARCH
darwin 386

Which revision are you sync'ed to?  (hg log -l 1)

andy@romana:~/go$ hg log -l 1
changeset:   3952:64e703cb307d
tag:         tip
user:        Russ Cox <rsc@golang.org>
date:        Tue Nov 10 14:09:01 2009 -0800
summary:     update video links

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