Skip to content

net/http: TIME_WAIT problem for web server - go.http.Server #5297

Closed
@gopherbot

Description

@gopherbot

by dragos.constantin.stoica:

Hello,

First thank you for the great work that you are doing with go. We started to use go last
year for a medium sized project. Go is used as middleware for a 3 tier application and
acts as a web server. From this point of view it does a great job. We have a load of
about 300 users per week and about 20-30 concurrent users connected on the server
anytime of day from 08:00-17:00. The application is a document management - flow
management and the documents are stored in JSON format in CouchDB.

The problem:
When the load of 30 concurrent users per day is superseded the server enters in a state
where no more connections are accepted from users and no responses are sent to already
connected users. The go program does not crash.
The issues is linked with too many connections being in TIME_WAIT state, despite the
fact that the open file limit is not even reached.
If we kill the go program and restart it the problem is solved - TIME_WAIT connections
are freed and everything goes back to normal operation.

Which operating system are you using?
Ubuntu Server 11.04 64bits

Which version are you using?  (run 'go version')
1.0.3

Please provide any additional information below.
cat /proc/sys/fs/file-max 
70000

more /etc/sysctl.conf 
#
# /etc/sysctl.conf - Configuration file for setting system variables
# See /etc/sysctl.d/ for additional system variables
# See sysctl.conf (5) for information.
#

fs.file-max = 70000
...

more /etc/security/limits.conf 
# /etc/security/limits.conf
[user_for_go_program]       soft    nofile  10000
[user_for_go_program]       hard    nofile  30000
# End of file

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