From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 123723 invoked by alias); 11 May 2015 16:39:31 -0000 Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Received: (qmail 123714 invoked by uid 89); 11 May 2015 16:39:30 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.3 required=5.0 tests=AWL,BAYES_50,KAM_LAZY_DOMAIN_SECURITY,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: dytn-smtp2.trimble.com Received: from dytn-smtp2.trimble.com (HELO dytn-smtp2.trimble.com) (155.63.8.242) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 11 May 2015 16:39:28 +0000 Received: (qmail 26728 invoked by uid 502); 11 May 2015 12:39:26 -0400 X-Qmail-Scanner-Diagnostics: from 10.1.75.24 by dytn-smtp2.trimble.com (envelope-from , uid 488) with qmail-scanner-2.11 (clamdscan: 0.98.7/20444. avast: v3.2.1/150510-1. sophie: 3.06/3.60.0/5.14. spamassassin: 3.4.0. Clear:RC:1(10.1.75.24):. Processed in 0.034371 secs); 11 May 2015 16:39:26 -0000 Received: from unknown (HELO usd-cas-01.trimblecorp.net) (10.1.75.24) by dytn-smtp2.trimble.com with (AES128-SHA encrypted) SMTP; 11 May 2015 12:39:25 -0400 Received: from USD-MBX-01.trimblecorp.net ([fe80::59c3:60a9:bdbe:d34f]) by usd-cas-01.trimblecorp.net ([fe80::40f3:18d7:49f1:cc16%17]) with mapi id 14.03.0235.001; Mon, 11 May 2015 12:39:25 -0400 From: Weili Yao To: "ecos-discuss@ecos.sourceware.org" CC: "john.m.mills@alum.mit.edu" , "gary@mlbassoc.com" , "andrew@lunn.ch" Date: Mon, 11 May 2015 16:39:00 -0000 Message-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-IsSubscribed: yes Subject: [ECOS] Re: Network TCP Handler: stale socket disposal X-SW-Source: 2015-05/txt/msg00001.txt.bz2 Hello John, Gary, and Andrew: It seemed that John's patch proposal in the following post=20 https://www.sourceware.org/ml/ecos-patches/2007-08/msg00059.html=20 was not adopted by ECOS, but the patch indeed works for us. I put two de= vices using ECOS and put in our cooperation LAN side by side, one device wi= th the patch and the other device without the patch. The device without the= patch lost socketIDs, and the device with the patch has been running great= . The backtrace shows as follows. I am not sure how to reproduce the proble= m, but when the devices are put in a big network, the patch code will be tr= iggered and helped the free of socketIDs. Without the patch, the system slo= wly runs out of sockets and caused the system unaccessable.=20=20 My question is when the patch will be officially adopted by ECOS? Thank you a lot! Weili =20=20=20=20 (ECONNRESET is the so->error value) when reaching the patch code below: (gdb) list *0x0010C8F0 0x10c8f0 is in debug_socket_patch (ecos/web/web_netinfo.c:501). 496 #include 497 void debug_socket_patch(struct socket *so) 498 { 499 static int count =3D 0; 500 count++; 501 app_warning_error(fe_expro(), (count << 16) + so->so_error); 502 } 503 504 // end of the file 505 (gdb) list *0x003141D4 0x3141d4 is in cyg_sofree (/ecos_build/ecos_sources/packages/net/bsd_tcpip/= current/src/sys/kern/uipc_socket.c:260). 255 head->so_incqlen--; 256 } else if (so->so_state & SS_COMP) { 257 258 if((so->so_error =3D=3D ECONNRESET) || 259 (so->so_error =3D=3D ECONNREFUSED)){ // forced drop = if flagged 260 debug_socket_patch(so); 261 TAILQ_REMOVE(&head->so_comp, so, so_list); 262 head->so_qlen--; 263 } 264 else (gdb) list *0x003048F8 0x3048f8 is in cyg_in_pcbdetach (/ecos_build/ecos_sources/packages/net/bsd_= tcpip/current/src/sys/netinet/in_pcb.c:528). 523 ipsec4_delete_pcbpolicy(inp); 524 #endif /*IPSEC*/ 525 inp->inp_gencnt =3D ++ipi->ipi_gencnt; 526 in_pcbremlists(inp); 527 so->so_pcb =3D 0; 528 sofree(so); 529 if (inp->inp_options) 530 (void)m_free(inp->inp_options); 531 if (rt) { 532 /* (gdb) list *0x00310FDC 0x310fdc is in cyg_tcp_close (/ecos_build/ecos_sources/packages/net/bsd_tcp= ip/current/src/sys/netinet/tcp_subr.c:748). 743 #ifdef INET6 744 if (INP_CHECK_SOCKAF(so, AF_INET6)) 745 in6_pcbdetach(inp); 746 else 747 #endif /* INET6 */ 748 in_pcbdetach(inp); 749 tcpstat.tcps_closed++; 750 return ((struct tcpcb *)0); 751 } 752 (gdb) list *0x0030DB58 0x30db58 is in cyg_tcp_input (/ecos_build/ecos_sources/packages/net/bsd_tcp= ip/current/src/sys/netinet/tcp_input.c:2074). 2069 * If our FIN is now acknowledged, delete the TCB, 2070 * enter the closed state and return. 2071 */ 2072 case TCPS_LAST_ACK: 2073 if (ourfinisacked) { 2074 tp =3D tcp_close(tp); 2075 goto drop; 2076 } 2077 break; 2078 (gdb) list *0x00308700 0x308700 is in cyg_ip_input (/ecos_build/ecos_sources/packages/net/bsd_tcpi= p/current/src/sys/netinet/ip_input.c:951). 946 ip->ip_len -=3D hlen; // subtract the hlen 947 } 948 949 upper_layer: 950 951 (*inetsw[ip_protox[ip->ip_p]].pr_input)(m, off); 952 #ifdef IPFIREWALL_FORWARD 953 ip_fw_fwd_addr =3D NULL; /* tcp needed it */ 954 #endif 955 return; (gdb) list *0x003087A8 0x3087a8 is in ipintr (/ecos_build/ecos_sources/packages/net/bsd_tcpip/curr= ent/src/sys/netinet/ip_input.c:979). 974 s =3D splimp(); 975 IF_DEQUEUE(&ipintrq, m); 976 splx(s); 977 if (m =3D=3D 0) 978 return; 979 ip_input(m); 980 } 981 } 982 983 /* (gdb) list *0x002F987C 0x2f987c is in cyg_netint (/ecos_build/ecos_sources/packages/net/bsd_tcpip/= current/src/ecos/support.c:757). 752 CYG_FLAG_WAITMODE_OR|CYG_FLAG_WAITMO= DE_CLR); 753 spl =3D splsoftnet(); // Prevent any overlapping "stack" pr= ocessing 754 for (lvl =3D NETISR_MIN; lvl <=3D NETISR_MAX; lvl++) { 755 if (curisr & (1<entry_point(thread->entry_data); 95 thread->exit(); 96 } 97 } 98 (gdb) list *0x002D147C 0x2d147c is in Cyg_Thread::exit() (/ecos_build/ecos_sources/packages/kernel= /current/src/common/thread.cxx:781). 776 777 Cyg_Scheduler::scheduler.rem_thread(self); 778 } 779 780 Cyg_Scheduler::reschedule(); 781 } 782 783 // ----------------------------------------------------------------= --------- 784 // Kill thread. Force the thread into EXITED state externally, or 785 // make it wake up and call exit(). (gdb) -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss