ports/136698: [patch] fix ENOTCONN handling in gwenhywfar (socket stalls)

James E. Flemer jflemer at alum.rpi.edu
Sun Jul 12 17:50:02 UTC 2009


>Number:         136698
>Category:       ports
>Synopsis:       [patch] fix ENOTCONN handling in gwenhywfar (socket stalls)
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jul 12 17:50:01 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     James E. Flemer
>Release:        FreeBSD 7.1-STABLE
>Organization:
>Environment:
FreeBSD cage.local 7.1-STABLE FreeBSD 7.1-STABLE #1: Thu Jan  8 20:10:28 PST 2009     root at cage.local:/usr/src/sys/CAGE7-SMP  i386
>Description:
Gwenhywfar often (always) stalls in TCP connect for me when used in Aqbanking/Gnucash.  The attached patches add checks for ENOTCONN conditions in the socket layer, which resolves the stalls.
>How-To-Repeat:
Install gwenhywfar-3.9.0 and aqbanking-4.1.0 with OFX support.  Run the aqbanking setup wizard (qt3-wizard), configure a user for a site that uses https.  Click on "Download Accounts".  The GUI will hang for a while, and tcpdump will show the socket connection stalls after the 3-way TCP handshake.  No data sent on the socket, and eventually something times out and the connection drops.
>Fix:
With the attached patches, the same test as above works fine.  The socket is established, data is sent and received as expected, account list is downloaded.

Patch attached with submission follows:

Index: Makefile
===================================================================
RCS file: /home/ncvs/ports/devel/gwenhywfar/Makefile,v
retrieving revision 1.14
diff -u -r1.14 Makefile
--- Makefile	22 Jun 2009 20:19:05 -0000	1.14
+++ Makefile	12 Jul 2009 17:44:06 -0000
@@ -7,6 +7,7 @@
 
 PORTNAME=	gwenhywfar
 PORTVERSION=	3.9.0
+PORTREVISION=	1
 CATEGORIES=	devel net security
 MASTER_SITES=	http://www2.aquamaniac.de/sites/download/
 DISTFILES=	download.php\?package=01\&release=25\&file=01\&dummy=gwenhywfar-${PORTVERSION}.tar.gz
--- /dev/null	2009-07-12 10:44:00.000000000 -0700
+++ files/patch-src::iolayer::io_tls.c	2009-07-12 09:59:44.000000000 -0700
@@ -0,0 +1,20 @@
+# $FreeBSD$
+--- src/iolayer/io_tls.c.orig	2009-06-18 13:56:27.000000000 -0700
++++ src/iolayer/io_tls.c	2009-07-12 09:56:45.000000000 -0700
+@@ -310,6 +310,7 @@
+   if (lflags & GWEN_IO_LAYER_TLS_FLAGS_FORCE_SSL_V3) {
+     const int proto_prio[2] = { GNUTLS_SSL3, 0 };
+ 
++    DBG_INFO(GWEN_LOGDOMAIN, "Forcing SSL v3");
+     rv=gnutls_protocol_set_priority(xio->session, proto_prio);
+     if (rv) {
+       DBG_ERROR(GWEN_LOGDOMAIN, "gnutls_protocol_set_priority: %d (%s)", rv, gnutls_strerror(rv));
+@@ -840,7 +841,7 @@
+ 
+   rv=GWEN_Io_LayerCodec_CheckWriteOut(io);
+   if (rv) {
+-    if (rv==GWEN_ERROR_TRY_AGAIN) {
++    if (rv==GWEN_ERROR_TRY_AGAIN || rv==GWEN_ERROR_IN_PROGRESS) {
+       DBG_INFO(GWEN_LOGDOMAIN, "here (%d)", rv);
+ #ifdef HAVE_GNUTLS_TRANSPORT_SET_ERRNO
+       gnutls_transport_set_errno(xio->session, EAGAIN);
--- /dev/null	2009-07-12 10:44:00.000000000 -0700
+++ files/patch-src::os::posix::inetsocket.c	2009-07-12 09:59:44.000000000 -0700
@@ -0,0 +1,56 @@
+# $FreeBSD$
+--- src/os/posix/inetsocket.c.orig	2008-07-31 10:56:06.000000000 -0700
++++ src/os/posix/inetsocket.c	2009-07-12 09:59:23.000000000 -0700
+@@ -74,6 +74,7 @@
+ int GWEN_Socket_NetError2GwenError(int rv) {
+   switch(rv) {
+   case EINTR:        return GWEN_ERROR_INTERRUPTED;
++  case ENOTCONN:
+   case EWOULDBLOCK:  return GWEN_ERROR_TIMEOUT;
+   case EACCES:
+   case EPERM:        return GWEN_ERROR_PERMISSIONS;
+@@ -348,7 +349,7 @@
+   if (localSocket->socket==-1) {
+     GWEN_InetAddr_free(localAddr);
+     GWEN_Socket_free(localSocket);
+-    if (errno==EAGAIN)
++    if (errno==EAGAIN || errno==ENOTCONN)
+       return GWEN_ERROR_TIMEOUT;
+     else {
+       DBG_INFO(GWEN_LOGDOMAIN, "accept(): %s", strerror(errno));
+@@ -498,7 +499,7 @@
+   assert(bsize);
+   i=recv(sp->socket,buffer, *bsize,0);
+   if (i<0) {
+-    if (errno==EAGAIN)
++    if (errno==EAGAIN || errno==ENOTCONN)
+       return GWEN_ERROR_TIMEOUT;
+     else if (errno==EINTR)
+       return GWEN_ERROR_INTERRUPTED;
+@@ -542,7 +543,7 @@
+ 	);
+ 
+   if (i<0) {
+-    if (errno==EAGAIN)
++    if (errno==EAGAIN || errno==ENOTCONN)
+       return GWEN_ERROR_TIMEOUT;
+     else if (errno==EINTR)
+       return GWEN_ERROR_INTERRUPTED;
+@@ -594,7 +595,7 @@
+              &addrlen);
+   if (i<0) {
+     GWEN_InetAddr_free(localAddr);
+-    if (errno==EAGAIN)
++    if (errno==EAGAIN || errno==ENOTCONN)
+       return GWEN_ERROR_TIMEOUT;
+     else if (errno==EINTR)
+       return GWEN_ERROR_INTERRUPTED;
+@@ -632,7 +633,7 @@
+            addr->address,
+            addr->size);
+   if (i<0) {
+-    if (errno==EAGAIN)
++    if (errno==EAGAIN || errno==ENOTCONN)
+       return GWEN_ERROR_TIMEOUT;
+     else if (errno==EINTR)
+       return GWEN_ERROR_INTERRUPTED;


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list