tech-net archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: TCP connections clogging up accf_http(9) (was: ESTABLISHED sockets with no fd open?
> > Perhaps that's the listen() queue limit in the application he's using?
> No, that's 1024 in lighttpd. I'll try to find out where the 193 comes from.
It turns out the number of possible connections does somewhat depend on
the listen backlog after all. I wrote the attached program to find out
what the correlation is, the result is:
| accftest: established 2 connections before it blew up, backlog was 1
| accftest: established 4 connections before it blew up, backlog was 2
| accftest: established 5 connections before it blew up, backlog was 3
| accftest: established 7 connections before it blew up, backlog was 4
| accftest: established 8 connections before it blew up, backlog was 5
| accftest: established 10 connections before it blew up, backlog was 6
| accftest: established 11 connections before it blew up, backlog was 7
| accftest: established 13 connections before it blew up, backlog was 8
| accftest: established 14 connections before it blew up, backlog was 9
| accftest: established 16 connections before it blew up, backlog was 10
| accftest: established 17 connections before it blew up, backlog was 11
| accftest: established 19 connections before it blew up, backlog was 12
| accftest: established 20 connections before it blew up, backlog was 13
| accftest: established 22 connections before it blew up, backlog was 14
| accftest: established 23 connections before it blew up, backlog was 15
| accftest: established 25 connections before it blew up, backlog was 16
| accftest: established 26 connections before it blew up, backlog was 17
| accftest: established 28 connections before it blew up, backlog was 18
| accftest: established 29 connections before it blew up, backlog was 19
| accftest: established 31 connections before it blew up, backlog was 20
| accftest: established 32 connections before it blew up, backlog was 21
| accftest: established 34 connections before it blew up, backlog was 22
| accftest: established 35 connections before it blew up, backlog was 23
| accftest: established 37 connections before it blew up, backlog was 24
| accftest: established 38 connections before it blew up, backlog was 25
| accftest: established 40 connections before it blew up, backlog was 26
| accftest: established 41 connections before it blew up, backlog was 27
| accftest: established 43 connections before it blew up, backlog was 28
| accftest: established 44 connections before it blew up, backlog was 29
| accftest: established 46 connections before it blew up, backlog was 30
| accftest: established 47 connections before it blew up, backlog was 31
| accftest: established 49 connections before it blew up, backlog was 32
| accftest: established 50 connections before it blew up, backlog was 33
| accftest: established 52 connections before it blew up, backlog was 34
| accftest: established 53 connections before it blew up, backlog was 35
| accftest: established 55 connections before it blew up, backlog was 36
| accftest: established 56 connections before it blew up, backlog was 37
| accftest: established 58 connections before it blew up, backlog was 38
| accftest: established 59 connections before it blew up, backlog was 39
| accftest: established 61 connections before it blew up, backlog was 40
| accftest: established 62 connections before it blew up, backlog was 41
| accftest: established 64 connections before it blew up, backlog was 42
| accftest: established 65 connections before it blew up, backlog was 43
| accftest: established 67 connections before it blew up, backlog was 44
| accftest: established 68 connections before it blew up, backlog was 45
| accftest: established 70 connections before it blew up, backlog was 46
| accftest: established 71 connections before it blew up, backlog was 47
| accftest: established 73 connections before it blew up, backlog was 48
| accftest: established 74 connections before it blew up, backlog was 49
| accftest: established 76 connections before it blew up, backlog was 50
| accftest: established 77 connections before it blew up, backlog was 51
| accftest: established 79 connections before it blew up, backlog was 52
| accftest: established 80 connections before it blew up, backlog was 53
| accftest: established 82 connections before it blew up, backlog was 54
| accftest: established 83 connections before it blew up, backlog was 55
| accftest: established 85 connections before it blew up, backlog was 56
| accftest: established 86 connections before it blew up, backlog was 57
| accftest: established 88 connections before it blew up, backlog was 58
| accftest: established 89 connections before it blew up, backlog was 59
| accftest: established 91 connections before it blew up, backlog was 60
| accftest: established 92 connections before it blew up, backlog was 61
| accftest: established 94 connections before it blew up, backlog was 62
| accftest: established 95 connections before it blew up, backlog was 63
| accftest: established 97 connections before it blew up, backlog was 64
| accftest: established 98 connections before it blew up, backlog was 65
| accftest: established 100 connections before it blew up, backlog was 66
| accftest: established 101 connections before it blew up, backlog was 67
| accftest: established 103 connections before it blew up, backlog was 68
| accftest: established 104 connections before it blew up, backlog was 69
| accftest: established 106 connections before it blew up, backlog was 70
| accftest: established 107 connections before it blew up, backlog was 71
| accftest: established 109 connections before it blew up, backlog was 72
| accftest: established 110 connections before it blew up, backlog was 73
| accftest: established 112 connections before it blew up, backlog was 74
| accftest: established 113 connections before it blew up, backlog was 75
| accftest: established 115 connections before it blew up, backlog was 76
| accftest: established 116 connections before it blew up, backlog was 77
| accftest: established 118 connections before it blew up, backlog was 78
| accftest: established 119 connections before it blew up, backlog was 79
| accftest: established 121 connections before it blew up, backlog was 80
| accftest: established 122 connections before it blew up, backlog was 81
| accftest: established 124 connections before it blew up, backlog was 82
| accftest: established 125 connections before it blew up, backlog was 83
| accftest: established 127 connections before it blew up, backlog was 84
| accftest: established 128 connections before it blew up, backlog was 85
| accftest: established 130 connections before it blew up, backlog was 86
| accftest: established 131 connections before it blew up, backlog was 87
| accftest: established 133 connections before it blew up, backlog was 88
| accftest: established 134 connections before it blew up, backlog was 89
| accftest: established 136 connections before it blew up, backlog was 90
| accftest: established 137 connections before it blew up, backlog was 91
| accftest: established 139 connections before it blew up, backlog was 92
| accftest: established 140 connections before it blew up, backlog was 93
| accftest: established 142 connections before it blew up, backlog was 94
| accftest: established 143 connections before it blew up, backlog was 95
| accftest: established 145 connections before it blew up, backlog was 96
| accftest: established 146 connections before it blew up, backlog was 97
| accftest: established 148 connections before it blew up, backlog was 98
| accftest: established 149 connections before it blew up, backlog was 99
| accftest: established 151 connections before it blew up, backlog was 100
| accftest: established 152 connections before it blew up, backlog was 101
| accftest: established 154 connections before it blew up, backlog was 102
| accftest: established 155 connections before it blew up, backlog was 103
| accftest: established 157 connections before it blew up, backlog was 104
| accftest: established 158 connections before it blew up, backlog was 105
| accftest: established 160 connections before it blew up, backlog was 106
| accftest: established 161 connections before it blew up, backlog was 107
| accftest: established 163 connections before it blew up, backlog was 108
| accftest: established 164 connections before it blew up, backlog was 109
| accftest: established 166 connections before it blew up, backlog was 110
| accftest: established 167 connections before it blew up, backlog was 111
| accftest: established 169 connections before it blew up, backlog was 112
| accftest: established 170 connections before it blew up, backlog was 113
| accftest: established 172 connections before it blew up, backlog was 114
| accftest: established 173 connections before it blew up, backlog was 115
| accftest: established 175 connections before it blew up, backlog was 116
| accftest: established 176 connections before it blew up, backlog was 117
| accftest: established 178 connections before it blew up, backlog was 118
| accftest: established 179 connections before it blew up, backlog was 119
| accftest: established 181 connections before it blew up, backlog was 120
| accftest: established 182 connections before it blew up, backlog was 121
| accftest: established 184 connections before it blew up, backlog was 122
| accftest: established 185 connections before it blew up, backlog was 123
| accftest: established 187 connections before it blew up, backlog was 124
| accftest: established 188 connections before it blew up, backlog was 125
| accftest: established 190 connections before it blew up, backlog was 126
| accftest: established 191 connections before it blew up, backlog was 127
| accftest: established 193 connections before it blew up, backlog was 128
| accftest: established 193 connections before it blew up, backlog was 129
| accftest: established 193 connections before it blew up, backlog was 130
| accftest: established 193 connections before it blew up, backlog was 131
| accftest: established 193 connections before it blew up, backlog was 132
| accftest: established 193 connections before it blew up, backlog was 133
| accftest: established 193 connections before it blew up, backlog was 134
| accftest: established 193 connections before it blew up, backlog was 135
| accftest: established 193 connections before it blew up, backlog was 136
| accftest: established 193 connections before it blew up, backlog was 137
| accftest: established 193 connections before it blew up, backlog was 138
| accftest: established 193 connections before it blew up, backlog was 139
| [tops off at 193]
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <sys/socket.h>
#include <err.h>
#define LISTENADDR "192.168.1.12"
#define LISTENPORT 12345
#define BACKLOG 1
int
main(void)
{
int conns = 0;
struct sockaddr_in sa = {
.sin_len = sizeof sa,
.sin_family = AF_INET,
.sin_port = htons(LISTENPORT)
};
int r = inet_pton(AF_INET, LISTENADDR, &sa.sin_addr);
while (true) {
int sck = socket(AF_INET, SOCK_STREAM, 0);
if (sck == -1)
err(1, "socket");
if (r != 1)
errx(1, "inet_pton: %d", r);
if (connect(sck, (struct sockaddr *)&sa, sizeof sa) == -1) {
warn("connect");
break;
}
conns++;
}
warnx("established %d connections before it blew up", conns);
}
Home |
Main Index |
Thread Index |
Old Index