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

http.ListenAndServe denial of service #1891

Closed
gopherbot opened this issue May 27, 2011 · 2 comments
Closed

http.ListenAndServe denial of service #1891

gopherbot opened this issue May 27, 2011 · 2 comments

Comments

@gopherbot
Copy link

by binary@fiane.dyndns.org:

What steps will reproduce the problem?

http.ListenAndServer seems to be quite easy to DOS.

The following example:

package main

import (
    "http"
    "log"
    "runtime"
)

func main() {

    http.Handle("/", http.FileServer(".",""))
    err := http.ListenAndServe(":12345", nil)
    if err != nil {
        log.Fatalln("ListenAndServe: ", err.String())
    }
}

will eventually bail out and exit the http server with:

2011/05/27 00:29:51 ListenAndServe:  accept tcp [::]:12345: too many open files 

Can be produced by running this bash piece

   for i in {0...20000} ; do nc localhost 12345 & done


http.Serve() likely needs to be more lenient on what errors it considers fatal on
accept(). (Note that on linux, fast detected client errors can also be returned from
accept() , such as ENETDOWN, EPROTO, ENOPROTOOPT, EHOSTDOWN, ENONET, EHOSTUNREACH,
EOPNOTSUPP, and ENETUNREACH)

Which compiler are you using (5g, 6g, 8g, gccgo)?
8g

Which operating system are you using?
Linux(Fedora 14)

Which revision are you using?  (hg identify)
f1519be2d0e9 tip
@rsc
Copy link
Contributor

rsc commented May 27, 2011

Comment 1:

There's already a net.Error sub-interface for this.

Owner changed to @bradfitz.

Status changed to LongTerm.

@bradfitz
Copy link
Contributor

bradfitz commented Jun 3, 2011

Comment 2:

This issue was closed by revision 2655757.

Status changed to Fixed.

@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants