Messages in this thread |  | | Date | Sun, 1 Oct 2000 22:41:42 +0200 (CEST) | From | Koblinger Egmont <> | Subject | select() on a unix dgram socket is buggy in 2.2. |
| |
Hi there!
Create a Unix dgram socketpair, and send many small datagrams to it. When this number reaches `cat /proc/sys/net/unix/max_dgram_qlen` (10 by default), then a select() call incorrectly tells that the socket is writeable now, though a send() hangs.
Here's a short strace output: select(4, NULL, [3], NULL, NULL) = 1 (out [3]) send(3, "", 0, 0 and it blocks here.
The source that produced this output is included at the end of this mail.
This incorrect behaviour occurs in any recent 2.2. kernels (including 2.2.17 and 2.2.18pre14), and 2.4 kernels up to test6.
2.4.0-test7 and above are correct, however, in these kernels far more than `cat /proc/sys/net/unix/max_dgram_qlen` short datagrams can be sent to the socket. Therefore I'm not sure this sysctl is used at all. Is it?
bye Egmont Koblinger
PS. here's the C code:
#include <unistd.h> #include <stdlib.h> #include <stdio.h> #include <errno.h> #include <sys/types.h> #include <sys/socket.h>
fd_set wfds; int sockfd[2]; char bigbuf[65536];
int main (int argc, char *argv[]) { socketpair(PF_UNIX, SOCK_DGRAM, 0, sockfd); while (1) { FD_ZERO(&wfds); FD_SET(sockfd[0], &wfds); select(sockfd[0]+1, NULL, &wfds, NULL, NULL); if (FD_ISSET(sockfd[0], &wfds)) { send(sockfd[0], bigbuf, 0, 0); } } return 0; }
- 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/
|  |