public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Kegel <dank@alumni.caltech.edu>
To: linux-kernel@vger.kernel.org, zwwe@opti.cgi.net
Subject: Re: Out of socket memory? (2.4.0-test11)
Date: Thu, 07 Dec 2000 09:46:39 -0800	[thread overview]
Message-ID: <3A2FCCFF.6D1F0BC7@alumni.caltech.edu> (raw)
In-Reply-To: <3A2F4D48.41FE8BC8@alumni.caltech.edu>

Dan Kegel wrote:
> Daniel Walton (zwwe@opti.cgi.net) wrote:
> > I've been having a problem with a high volume Linux web server. This 
> > particular web server used to be a FreeBSD machine and I've been trying to 
> > successfully make the switch for some time now. I've been trying the 2.4 
> > development kernels as they come out and I've been tweaking the /proc 
> > filesystem variables but so far nothing seems to have fixed the 
> > problem. The problem is that I get "Out of socket memory" errors and the 
> > networking locks up...
>
> FWIW, the code that prints this is in ipv4/tcp_timer.c
> and it looks like it's a DoS attack countermeasure.
>
> /* Do not allow orphaned sockets to eat all our resources.
>  * This is direct violation of TCP specs, but it is required
>  * to prevent DoS attacks. It is called when a retransmission timeout
>  * or zero probe timeout occurs on orphaned socket.
> ...
>     if (orphans >= sysctl_tcp_max_orphans ||
>         (sk->wmem_queued > SOCK_MIN_SNDBUF &&
>          atomic_read(&tcp_memory_allocated) > sysctl_tcp_mem[2])) {
>         if (net_ratelimit())
>             printk(KERN_INFO "Out of socket memory\n");

See Documentation/networking/ip-sysctl.txt for more info and tuning
suggestions, esp. tcp_orphan_retries and tcp_max_orphans.
An orphaned socket is one that has at least partially
opened, but has not been fully accepted.  You might try reducing
tcp_orphan_retries.

It looks like you can view the current number of orphans at
/proc/net/sockstat or something like that.
 
/*
 *  Report socket allocation statistics [mea@utu.fi]
 */
int afinet_get_info(char *buffer, char **start, off_t offset, int length)
{
    /* From  net/socket.c  */
    extern int socket_get_info(char *, char **, off_t, int);
 
    int len  = socket_get_info(buffer,start,offset,length);
 
    len += sprintf(buffer+len,"TCP: inuse %d orphan %d tw %d alloc %d mem %d\n",
               fold_prot_inuse(&tcp_prot),
               atomic_read(&tcp_orphan_count), tcp_tw_count,
               atomic_read(&tcp_sockets_allocated),
               atomic_read(&tcp_memory_allocated));     

- Dan
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

  reply	other threads:[~2000-12-07 19:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-12-07  8:41 Out of socket memory? (2.4.0-test11) Dan Kegel
2000-12-07 17:46 ` Dan Kegel [this message]
     [not found] <Pine.LNX.4.10.10012070029250.3437-100000@coffee.psychology .mcmaster.ca>
2000-12-07  4:56 ` Daniel Walton
2000-12-07  6:13   ` Daniel Walton
2000-12-07 14:06   ` Andi Kleen
2000-12-07 18:12   ` kuznet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3A2FCCFF.6D1F0BC7@alumni.caltech.edu \
    --to=dank@alumni.caltech.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zwwe@opti.cgi.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox