freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: "James K. Lowden" <jklowden AT freetds.org>
- To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
- Subject: Re: [freetds] Getting it to all work on HPUX
- Date: Tue, 3 Feb 2009 21:06:49 -0500
Michael Warchut wrote:
> net.c:210:Connecting to 172.16.20.32 port 1433 (TDS version 8.0)
>
> net.c:264:tds_open_socket: connect(2) returned "Operation now in
> progress"
>
> net.c:295:getsockopt(2) failed: Invalid argument
>
> util.c:334:tdserror(6000000000010550, 6000000000038a40, 20009, 22)
>
> odbc.c:2032:msgno 20009 20003
What's really, really peculiar is this:
net.c:295:getsockopt(2) failed: Invalid argument
Of course, it's possible to pass an invalid argument, but how to explain
that that message appears *only* for the ODBC call? The call to
getsockopt(2) isn't on a branch. For some reason, it worked one time and
failed another. The code:
/* check socket error */
optlen = sizeof(len);
len = 0;
if (getsockopt(tds->s, SOL_SOCKET, SO_ERROR, (char *) &len, &optlen)
!=
0) {
tds->oserr = sock_errno;
tdsdump_log(TDS_DBG_ERROR, "getsockopt(2) failed: %s\n",
strerror(sock_errno));
goto not_available;
}
if (len != 0) {
tds->oserr = sock_errno;
tdsdump_log(TDS_DBG_ERROR, "getsockopt(2) reported: %s\n",
strerror(len));
goto not_available;
}
tdsdump_log(TDS_DBG_ERROR, "tds_open_socket() succeeded\n");
return TDSEOK;
At this level, the two APIs are identical. That one connection request
came through ODBC and the other tsql is totally meaningless.
We need the call to getsockopt. That's how one discovers if a nonblocking
socket connects.
According to your getsockopt(2) manual page, is it valid to pass SO_ERROR
to a socket, or not?
My guess? My guess is that it's race: if getsockopt is called too soon
after connect(2), it fails.
You might try inserting a sleep(3) in there, just to see. You could also
comment out the calls to getsockopt and always return TDSEOK. That won't
help you when there's a failure, but it will make a big difference when
there's a successful connection!
HTH. Let us know how it goes.
--jkl
-
[freetds] Getting it to all work on HPUX,
Michael Warchut, 02/03/2009
-
Re: [freetds] Getting it to all work on HPUX,
James K. Lowden, 02/03/2009
-
Re: [freetds] Getting it to all work on HPUX,
Michael Warchut, 02/03/2009
-
Re: [freetds] Getting it to all work on HPUX,
Frediano Ziglio, 02/06/2009
-
Re: [freetds] Getting it to all work on HPUX,
Christos Zoulas, 02/06/2009
-
Re: [freetds] Getting it to all work on HPUX,
Frediano Ziglio, 02/06/2009
-
Re: [freetds] Getting it to all work on HPUX,
James K. Lowden, 02/06/2009
- Re: [freetds] Getting it to all work on HPUX, Christos Zoulas, 02/06/2009
- Re: [freetds] Getting it to all work on HPUX, Frediano Ziglio, 02/09/2009
- Re: [freetds] Getting it to all work on HPUX, Christos Zoulas, 02/09/2009
- Re: [freetds] Getting it to all work on HPUX, Frediano Ziglio, 02/09/2009
- Re: [freetds] Getting it to all work on HPUX, Christos Zoulas, 02/09/2009
-
Re: [freetds] Getting it to all work on HPUX,
James K. Lowden, 02/06/2009
-
Re: [freetds] Getting it to all work on HPUX,
Frediano Ziglio, 02/06/2009
-
Re: [freetds] Getting it to all work on HPUX,
Christos Zoulas, 02/06/2009
-
Re: [freetds] Getting it to all work on HPUX,
Frediano Ziglio, 02/06/2009
-
Re: [freetds] Getting it to all work on HPUX,
Michael Warchut, 02/03/2009
-
Re: [freetds] Getting it to all work on HPUX,
James K. Lowden, 02/03/2009
Archive powered by MHonArc 2.6.24.