From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: To: 9fans@cse.psu.edu Subject: Re: [9fans] /net panic From: erik quanstrom Date: Fri, 15 Feb 2008 11:23:21 -0500 In-Reply-To: <140e7ec30802150120y1b0e4b33lf76787aaee84edd2@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="upas-uhpzcurydmhjoegeqwezcihcqm" Topicbox-Message-UUID: 550a304e-ead3-11e9-9d60-3106f5b1d025 This is a multi-part message in MIME format. --upas-uhpzcurydmhjoegeqwezcihcqm Content-Disposition: ainline Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit i'm not sure this is a perfect solution. i just don't have enough of the plan 9 ip stack loaded into cache to be sure nothing's been forgotten. but give this patch a whirl. basically, i think the problem is that inittcpctl() was stepping on timers that might have been active. these timers need to be shutdown. unfortunately, tcpclose() and localclose() are too agressive. cleanupconnection() is a chopped-down version of localclose. - erik /n/sources/plan9//sys/src/9/ip/tcp.c:782,787 - tcp.c:782,813 return mtu; } + static void + cleanupconnection(Conv *s) + { + Tcpctl *tcb; + Reseq *rp,*rp1; + Tcppriv *tpriv; + + tpriv = s->p->priv; + tcb = (Tcpctl*)s->ptcl; + + iphtrem(&tpriv->ht, s); + + tcphalt(tpriv, &tcb->timer); + tcphalt(tpriv, &tcb->rtt_timer); + tcphalt(tpriv, &tcb->acktimer); + tcphalt(tpriv, &tcb->katimer); + + /* Flush reassembly queue; nothing more can arrive */ + for(rp = tcb->reseq; rp != nil; rp = rp1) { + rp1 = rp->next; + freeblist(rp->bp); + free(rp); + } + tcb->reseq = nil; + } + void inittcpctl(Conv *s, int mode) { /n/sources/plan9//sys/src/9/ip/tcp.c:792,798 - tcp.c:818,827 tcb = (Tcpctl*)s->ptcl; - memset(tcb, 0, sizeof(Tcpctl)); + if(tcb->timer.arg) // c->state != Idle? + cleanupconnection(s); + else + memset(tcb, 0, sizeof(Tcpctl)); tcb->ssthresh = 65535; tcb->srtt = tcp_irtt<; Fri, 15 Feb 2008 04:21:01 -0500 (EST) X-Original-To: 9fans@cse.psu.edu Delivered-To: 9fans@cse.psu.edu Received: from localhost (localhost [127.0.0.1]) by mail.cse.psu.edu (CSE Mail Server) with ESMTP id A355323808 for <9fans@cse.psu.edu>; Fri, 15 Feb 2008 04:20:16 -0500 (EST) Received: from mail.cse.psu.edu ([127.0.0.1]) by localhost (psuvax1 [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 21294-01-47 for <9fans@cse.psu.edu>; Fri, 15 Feb 2008 04:20:14 -0500 (EST) Received: from wa-out-1112.google.com (wa-out-1112.google.com [209.85.146.177]) by mail.cse.psu.edu (CSE Mail Server) with ESMTP id 042C41D5EB for <9fans@cse.psu.edu>; Fri, 15 Feb 2008 04:20:13 -0500 (EST) Received: by wa-out-1112.google.com with SMTP id v33so995894wah.2 for <9fans@cse.psu.edu>; Fri, 15 Feb 2008 01:20:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; bh=ZFDYoorYg9grkSO4bx7VEveKaOeb9z9OjOI2gHWQXWY=; b=SOktMHAFEmzQEul+q7o4nPDtFqxUXE9n/vd7cW3S+02GH4kfqhNqX6zUocNNhdPYRJvFD50Ce+NHV8etKVA6mVOgPso1bXjmh7U1gs9D/zMP+zUiwReB+0VrRFa83ausw4bh83hLxwwhFNj7RH9uYjk8vufjAVT/1lZuiWp2DHA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=jnDjcHUQzEvbuCaaOZCIzmI2dvAhlKdskXXGAlriRCLyLhH/NMPXNePpIzRQ780XxrEVvyn8hq1qnT3iRuWT6A5+aMZPSD1J98ia4MJ5f0f/HpNR/fytC5s3qe6wavNqWTjqnbTFfhUCz6BIuj2eCt1svTEbu7LxGmUjs585n9M= Received: by 10.115.54.1 with SMTP id g1mr1058444wak.132.1203067213317; Fri, 15 Feb 2008 01:20:13 -0800 (PST) Received: by 10.115.49.6 with HTTP; Fri, 15 Feb 2008 01:20:13 -0800 (PST) Message-ID: <140e7ec30802150120y1b0e4b33lf76787aaee84edd2@mail.gmail.com> Date: Fri, 15 Feb 2008 18:20:13 +0900 From: sqweek To: 9fans@cse.psu.edu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: by amavisd-new at cse.psu.edu Subject: [9fans] /net panic X-BeenThere: 9fans@cse.psu.edu X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu> List-Id: Fans of the OS Plan 9 from Bell Labs <9fans.cse.psu.edu> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: 9fans-bounces+quanstro=quanstro.net@cse.psu.edu Errors-To: 9fans-bounces+quanstro=quanstro.net@cse.psu.edu muzgo (from irc) was playing around with /net in qemu and came across this gem: on drawterm: cpu% cd /net/tcp cpu% cat clone 23cpu% cd 23 cpu% echo connect 10.0.2.1!12345 >ctl cpu% cat status Finwait2 qin 0 qout 0 srtt 0 mdev 0 cwin 1461 swin 32850>>0 rwin 65535>>0 timer.start 10 timer.count 10 rerecv 0 katimer.start 200 katimer.count 159 cpu% echo connect 10.0.2.1!12345 >ctl cpu% this causes CPU server to reboot with: panic: timerstate1 panic: timerstate1 dumpstack disabled cpu0 exiting The usage of /net is invalid, but you wouldn't really expect that to reboot the machine (or maybe it's a holdover from before /dev/reboot existed? ;) ). Just tried it on my cpu server and got the same panic, so we can rule qemu out. I adjusted the ip!port to something that would accept my connection, and my status was something like Timedwait rather than Finwait2. Second time around I skipped the cat status and still hit the panic so the status read isn't affecting things (which is probably blindingly obvious to anyone familiar with the /net code, but oh well). I appear to be running a realtek 8169 nic: #l0: rtl8169: 100Mbps port 0xE400 irq 11: 000aeb2ff32c Don't know what muzgo was using in qemu, but let me know if I can provide any useful information. -sqweek --upas-uhpzcurydmhjoegeqwezcihcqm--