[freetds] FreeTDS under cygwin - connections 'hang'?

Justin Schoeman justin at expertron.co.za
Fri Sep 3 09:48:22 EDT 2004


OK - I found the bug... It is in freetds, but _very_ obscure... Calls to 
connect() to the same destination port cannot occur simultaneously. 
This means that connect() may return EADDRINUSE if two threads try to 
connect to the same destination address at the same time.  To rectify 
this problem, simply trap EADDRINUSE error codes (will have to use the 
SO_ERROR getsockopt() in the timeout code path), reinitialise the 
address parameter, and re-issue the connect. Or, as I did in the end, 
simply serialise connect()s.

Thanks,
-justin

Justin Schoeman wrote:
> Hi all, I don't know if this is a FreeTDS, or Cygwin problem, but I 
> thought I would try here first (well, the problem does manifest itself 
> in the FreeTDS library ;-) ).
> 
> When my application is running, it makes multiple connections to the SQL 
> server, one after the other.  If the connections occur at a relatively 
> low rate, then everything works fine, however, if the connection request 
> occur very fast, then the program hangs in dbopen.  No network 
> connection request is issued.
> 
> Does anybody have any idea what is going on, or where I should start 
> looking for problems?
> 
> The same program works perfectly under Linux.
> 
> TIA,
> -justin
> _______________________________________________
> FreeTDS mailing list
> FreeTDS at lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds



More information about the FreeTDS mailing list