Skip to Content.
Sympa Menu

freetds - Re: [freetds] Connection timeout problem on HP-UX

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Predrag Parmakovic <preparmakov AT yahoo.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Connection timeout problem on HP-UX
  • Date: Wed, 11 Apr 2007 06:16:36 -0700 (PDT)

Hello,

I have solved the problem with connection timeout on HP-UX in 0.63 version of
FreeTDS driver.
I have debugged FreeTDS ODBC driver and I have detected the problem in file
login.c. The problem on HP-UX was in setting of non-blocking socket by ioctl
method. Because that the socket remained blocking and connect method waited
about 76 seconds... When I used fcntl method instead ioctl this setting
worked fine and connection timeout worked fine.

I have made the patch for file login.c with these changes (attachment).

I have observed that in 0.64 version and current FreeTDS is used ioctl method
and I think that connection timeout will not work on HP-UX nor with new
timeout logic...
I suggest that and these version of driver's should to use fcntl method for
HP-UX.

Also, I have tested freetds (0.63 and 0.64) on linux and I have concluded
that connection timeout
works fine and with ioctl method...

Regards



----- Original Message ----
From: Duncan Berriman <duncan AT dcl.co.uk>
To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
Sent: Tuesday, March 27, 2007 11:07:15 AM
Subject: Re: [freetds] Connection timeout problem on HP-UX


Hi,

I had a similar problem, seems it's a bug that has been fixed. See reply
below.

Duncan

Sorry, it's a bug. I should document it somewhere.

The good news is it's fixed as of a few months ago, so we believe. The
bad news is it's not released; you have to use a recent snapshot.

Timeout handling was quite a jumble. If you're curious, see my
announcment
https://lists.ibiblio.org/sympa/arc/freetds/2007q1/021030.html.

HTH.

--jkl


_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds



____________________________________________________________________________________
Don't get soaked. Take a quick peak at the forecast
with the Yahoo! Search weather shortcut.
http://tools.search.yahoo.com/shortcuts/#loc_weather--- login.c 2004-07-29 12:22:41.000000000 +0200
+++ loginMy.c 2007-04-03 16:21:01.000000000 +0200
@@ -89,6 +89,10 @@
#include <dmalloc.h>
#endif

+#ifdef __hpux
+#include <fcntl.h>
+#endif
+
static char software_version[] = "$Id: login.c,v 1.126 2004/07/29 10:22:41
freddy77 Exp $";
static void *no_unused_var_warn[] = { software_version, no_unused_var_warn };

@@ -306,11 +310,26 @@
/* Jeff's hack *** START OF NEW CODE *** */
if (connect_timeout) {
start = time(NULL);
+
+#ifndef __hpux
ioctl_blocking = 1; /* ~0; //TRUE; */
if (IOCTLSOCKET(tds->s, FIONBIO, &ioctl_blocking) < 0) {
tds_free_socket(tds);
return TDS_FAIL;
}
+#else
+/* setting of non-blocking socket by ioctl method doesn't work on HP-UX,
because that we use fcntl method */
+ int flags = fcntl(tds->s, F_GETFL, 0);
+ if(flags < 0){
+ tds_free_socket(tds);
+ return TDS_FAIL;
+ }
+ if( fcntl(tds->s, F_SETFL, O_NONBLOCK|flags) < 0)
+ {
+ tds_free_socket(tds);
+ return TDS_FAIL;
+ }
+#endif
retval = connect(tds->s, (struct sockaddr *) &sin,
sizeof(sin));
if (retval < 0 && sock_errno == TDSSOCK_EINPROGRESS)
retval = 0;



Archive powered by MHonArc 2.6.24.

Top of Page