strange problem with squid on 2.1.?

Marc Lehmann (mlehmann@hildesheim.sgh-net.de)
Mon, 2 Dec 1996 16:10:37 +0100 (MET)


Hi.. I just got squid-1.1.beta23, and it does not work
under 2.1.13 and 2.1.14 (possibly earlier ones, too, but
I haven't checked).

Basically, squid spawns a subprocess and writes to its
stdin a "$hello", and waits for an "$alive" message..

That works fine under 2.0.27, but not on 2.1.14. Obviously
on 2.1.13/14 the write to the socket opened by
the parent process gets an "EIO" (whoaw)
and the data never gets to the parent..

Here's an strace of whats happening on 2.0.27
(many lines omitted)

socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 4
bind(4, {sin_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("127.0.0.1")}, 16) = 0
setsockopt(4, IPPROTO_TCP1, [1], 4) = 0
setsockopt(4, SOL_SOCKET, SO_RCVBUF, [8], 4) = 0
getsockname(4, {sin_family=AF_INET, sin_port=htons(1028), sin_addr=inet_addr("127.0.0.1")}, [16]) = 0
listen(4, 1) = 0
fork() = 153
[pid 152] close(4) = 0
[pid 152] socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 4
[pid 152] fcntl(4, F_GETFL) = 0x2 (flags O_RDWR)
[pid 152] fcntl(4, F_SETFD, FD_CLOEXEC|0x2) = 0
[pid 152] bind(4, {sin_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("127.0.0.1")}, 16) = 0
[pid 152] setsockopt(4, IPPROTO_TCP1, [1], 4) = 0
[pid 152] setsockopt(4, SOL_SOCKET, SO_RCVBUF, [8], 4) = 0
[pid 152] connect(4, {sin_family=AF_INET, sin_port=htons(1028), sin_addr=inet_addr("127.0.0.1")}, 16) = 0
[pid 152] write(4, "$hello\n", 7) = 7
[pid 152] read(4, <unfinished ...>
[pid 153] accept(4, 0, NULL) = 5
[pid 153] dup2(5, 0) = 0
[pid 153] dup2(5, 1) = 1
[pid 153] dup2(3, 2) = 2
[pid 153] close(3) = 0
[pid 153] munmap(0x400eb000, 4096) = 0
[pid 153] close(5) = 0
[pid 153] close(4) = 0
[pid 153] execve("/usr/app/bin/dnsserver", ["(dnsserver)"], [/* 29 vars */]) = 0
[pid 153] fstat(0, {st_mode=S_IFSOCK, st_size=0, ...}) = 0
[pid 153] mmap(0, 1024, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x400c5000
[pid 153] read(0, "$hello\n", 1024) = 7
[pid 153] fstat(1, {st_mode=S_IFSOCK, st_size=0, ...}) = 0
[pid 153] mmap(0, 1024, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x400c6000
[pid 153] write(1, "$alive\n$end\n", 12) = 12
[pid 152] <... read resumed> "$alive\n$end\n", 128) = 12
[pid 153] read(0, <unfinished ...>
[pid 152] fcntl(4, F_GETFL) = 0x2 (flags O_RDWR)

And squid is going on..

But on 2.1.13

socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 4
bind(4, {sin_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("127.0.0.1")}, 16) = 0
setsockopt(4, IPPROTO_TCP1, [1], 4) = 0
setsockopt(4, SOL_SOCKET, SO_RCVBUF, [8], 4) = 0
getsockname(4, {sin_family=AF_INET, sin_port=htons(1028), sin_addr=inet_addr("127.0.0.1")}, [16]) = 0
listen(4, 1) = 0
fork() = 155
[pid 154] close(4) = 0
[pid 154] socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 4
[pid 154] fcntl(4, F_GETFL) = 0x2 (flags O_RDWR)
[pid 154] fcntl(4, F_SETFD, FD_CLOEXEC|0x2) = 0
[pid 154] bind(4, {sin_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("127.0.0.1")}, 16) = 0
[pid 154] setsockopt(4, IPPROTO_TCP1, [1], 4) = 0
[pid 154] setsockopt(4, SOL_SOCKET, SO_RCVBUF, [8], 4) = 0
[pid 154] connect(4, {sin_family=AF_INET, sin_port=htons(1028), sin_addr=inet_addr("127.0.0.1")}, 16) = 0
[pid 154] write(4, "$hello\n", 7) = 7
[pid 154] read(4, <unfinished ...>
[pid 155] accept(4, 0, NULL) = 5
[pid 155] dup2(5, 0) = 0
[pid 155] dup2(5, 1) = 1
[pid 155] dup2(3, 2) = 2
[pid 155] close(3) = 0
[pid 155] munmap(0x400eb000, 4096) = 0
[pid 155] close(5) = 0
[pid 155] close(4) = 0
[pid 155] execve("/usr/app/bin/dnsserver", ["(dnsserver)"], [/* 29 vars */]) = 0
[pid 155] fstat(0, {st_mode=S_IFSOCK, st_size=0, ...}) = 0
[pid 155] mmap(0, 1024, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x400c5000
[pid 155] read(0, "$hello\n", 1024) = 7
[pid 155] fstat(1, {st_mode=S_IFSOCK, st_size=0, ...}) = 0
[pid 155] mmap(0, 1024, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x400c6000
[pid 155] write(1, "$alive\n$end\n", 12) = -1 EIO (I/O error)
[pid 155] read(0, <unfinished ...>

And both processes stop..

I didn't check any further, is it an application error or a
bug in linux?

bye,
Marc

-----==-
----==-- _
---==---(_)__ __ ____ __ Marc Lehmann
--==---/ / _ \/ // /\ \/ / mlehmann@hildesheim.sgh-net.de
-=====/_/_//_/\_,_/ /_/\_\ pcg@goof.com
The choice of a GNU generation