From owner-freebsd-stable@FreeBSD.ORG Tue Mar 18 07:49:07 2014 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3E8ABF72 for ; Tue, 18 Mar 2014 07:49:07 +0000 (UTC) Received: from mail-vc0-x233.google.com (mail-vc0-x233.google.com [IPv6:2607:f8b0:400c:c03::233]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id F0E4B7F6 for ; Tue, 18 Mar 2014 07:49:06 +0000 (UTC) Received: by mail-vc0-f179.google.com with SMTP id ij19so6910230vcb.10 for ; Tue, 18 Mar 2014 00:49:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=OxsHQK571fVUZzFQei2PTKjoxNDnNBI0MnkUXEFfr3g=; b=ITaEczxbRIQMwP6s8aCka4cH1hg0xJMUXK+kX4+DioO3PTsnio2vZ8mOfnJP+ufakb ZQ2HKvKJP3u6AIOUrzjIHt8r3Sc1U50d3W4shvbtYW7huyZklC40nGnhnozo8VEQ10xS SBB1N73D4fZKmnfS2T+PYqlO+vCvzeCkAFptnhE+9DoBSpgJFiKAOsf72D2xJvYkYEYr 2a0NsXyEbj5+6YEaUL8ucz3qkyqUTRiSZpG30DBEVcOceWnnxdWHf/bMO2HktpR6kBFZ ghR8obYjmkJ+mQt5jNCqkXhqdOwJpPLejWgvLJ4fou2AifgVXhvMaYftZqfqvbl84qqA MVQw== MIME-Version: 1.0 X-Received: by 10.52.166.103 with SMTP id zf7mr4188035vdb.30.1395128946055; Tue, 18 Mar 2014 00:49:06 -0700 (PDT) Received: by 10.52.255.231 with HTTP; Tue, 18 Mar 2014 00:49:05 -0700 (PDT) In-Reply-To: References: Date: Tue, 18 Mar 2014 11:49:05 +0400 Message-ID: Subject: Re: net/nylon hangs in read(2) under FreeBSD10 From: Pavel Timofeev To: freebsd-stable stable Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Mar 2014 07:49:07 -0000 Turns out, it's just enough to do # telnet proxy.xxx.ru 1080 and do nothing after that for hanging nylon in read(2). Naive nylon's code? 2014-03-12 11:34 GMT+04:00 Pavel Timofeev : > Hello! > I used net/nylon (socks proxy server, born in openbsd) for some time > under FreeBSD10.0-RELEASE amd64. > I had no problems in testlab with that configuration. > But now I have problems in production with that. > Sometimes nylon starts to eat whole CPU. > > For example, I have proxy.xxx.ru (192.168.31.198) and client1.xxx.ru > (192.168.2.6). > Here is what I see every time. > Let's say that hung nylon has pid 5323 > > # truss -p 5323 > ...... > read(6,0x7fffffffdb13,1) ERR#35 'Resource > temporarily unavailable' > read(6,0x7fffffffdb13,1) ERR#35 'Resource > temporarily unavailable' > read(6,0x7fffffffdb13,1) ERR#35 'Resource > temporarily unavailable' > read(6,0x7fffffffdb13,1) ERR#35 'Resource > temporarily unavailable' > read(6,0x7fffffffdb13,1) ERR#35 'Resource > temporarily unavailable' > ^C > > Nylon tries to read from FD 6 (right?) and gets errno 35. Infinite loop. > > > # lsof -p 5323 > COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME > nylon 5323 root cwd VDIR 0,96 1024 2 / > nylon 5323 root rtd VDIR 0,96 1024 2 / > nylon 5323 root txt VREG 0,96 34840 1134069 > /usr/local/bin/nylon > nylon 5323 root txt VREG 0,96 111696 240770 > /libexec/ld-elf.so.1 > nylon 5323 root txt VREG 0,96 306532 2970271 > /usr/local/lib/event2/libevent-2.0.so.6 > nylon 5323 root txt VREG 0,96 1567216 481549 /lib/libc.so.7 > nylon 5323 root txt VREG 0,96 105104 481569 > /lib/libthr.so.3 > nylon 5323 root 0u VCHR 0,15 0t0 15 /dev/null > nylon 5323 root 1u VCHR 0,15 0t0 15 /dev/null > nylon 5323 root 2u VCHR 0,15 0t0 15 /dev/null > nylon 5323 root 4u IPv4 0xfffff800646b9c00 0t0 TCP > proxy.xxx.ru:socks (LISTEN) > nylon 5323 root 5u unix 0xfffff8006494d000 0t0 > ->0xfffff800098862b8 > nylon 5323 root 6u IPv4 0xfffff8011cd07400 0t0 TCP > proxy.xxx.ru:socks->client1.xxx.ru:45737 (ESTABLISHED) > > Looks like that FD is last line in this output. It's tcp socket (right?). > > > # sockstat | grep 5323 > root nylon 5323 4 tcp4 192.168.31.198:1080 *:* > root nylon 5323 5 dgram -> /var/run/logpriv > root nylon 5323 6 tcp4 192.168.31.198:1080 192.168.2.6:45737 > > That pid has open socket with client1.xxx.ru (192.168.2.6). > > I looked to open sockets in client1.xxx.ru and didn't find suitable. > > And I can kill that hung pid only using "kill -9". > > > It appears to be a problem here. But where? In nylon or even in FreeBSD? > I'm not UNIX OS and programming professional and I don't know wheater > OS has to return errno 35 for read of that dead(?) socket. > Do I have to provide more info? Which one? I'm looking forward! > It happens quite often now.