FreeTDS / freetds

Official FreeTDS repository
http://www.freetds.org/
GNU General Public License v2.0
460 stars 157 forks source link

FreeTDS issue : net.c:526:tds_open_socket() failed #607

Closed DanielVelezV closed 1 week ago

DanielVelezV commented 4 weeks ago

Hi. I've using pymssql to connect to a SQLServer database. everything was working fine but from one moment to another it just broke. Everything works fine when i try to run my program locally, but, the moment i deploy it to Google Cloud Run it starts failing. It was working pretty well on Google, but, as stated above, it just broke from one moment to another.

Logs from TDS on Google:

config.c:733:tds_config_login: database_name is {dbNameHere}.
config.c:833:Setting 'dump_file' to 'stdout' from $TDSDUMP.
dblib.c:1268:tdsdbopen: Calling tds_connect_and_login(0x564218e3a60, 0x564218d8a3d00)
iconv.c:367:tds_iconv_open(0x564218dacdf8, UTF-8)
iconv.c:389:setting up conversions for client charset "UTF-8"
iconv.c:391:preparing iconv for "UTF-8" <-> "UCS-2LE" conversion
iconv.c:430:tds_iconv_open: done
net.c:391:Connecting with protocol version 7.3
net.c:318:Connecting to {dbIpHere} port 1433
net.c:348:tds_setup_socket: connect(2) returned "Operation now in progress"
net.c:526:tds_open_socket() failed
util.c:333:tdserror(0x564217a95f40, 0x564218da6740, 20009, 110)
dblib.c:4180:dbperror: Calling db-lib error handler with msgno = 20009; msg->msgtext = "Unable to connect: Adaptive Server is unavailable or does not exist {dbIpHere}"
dblib.c:8208:dbperror: dblib_err_handler for msgno = 20009; msg->msgtext = "Unable to connect: Adaptive Server is unavailable or does not exist{dbIpHere}" -- returns 2 (INT_CANCEL)
util.c:363:tdserror: client library returned TDS_INT_CANCEL(2)
util.c:376:tdserror: returning TDS_INT_CANCEL(2)

Logs from local machine:

config.c:733:tds_config_login: database_name is {dbNameHere}.
2024-08-18 07:21:03 config.c:833:Setting 'dump_file' to 'stdout' from $TDSDUMP.
2024-08-18 07:21:03 dblib.c:1268:tdsdbopen: Calling tds_connect_and_login(0x560a91ae80b0, 0x560a91b1b100)
2024-08-18 07:21:03 iconv.c:367:tds_iconv_open(0x560a91ad6b40, UTF-8)
2024-08-18 07:21:03 iconv.c:198:local name for ISO-8859-1 is ISO-8859-1
2024-08-18 07:21:03 iconv.c:198:local name for UTF-8 is UTF-8
2024-08-18 07:21:03 iconv.c:198:local name for UCS-2LE is UCS-2LE
2024-08-18 07:21:03 iconv.c:198:local name for UCS-2BE is UCS-2BE
2024-08-18 07:21:03 iconv.c:389:setting up conversions for client charset "UTF-8"
2024-08-18 07:21:03 iconv.c:391:preparing iconv for "UTF-8" <-> "UCS-2LE" conversion
2024-08-18 07:21:03 iconv.c:430:tds_iconv_open: done
2024-08-18 07:21:03 net.c:391:Connecting with protocol version 7.3
2024-08-18 07:21:03 net.c:318:Connecting to {dbIpHere} port 1433
2024-08-18 07:21:03 net.c:340:tds_setup_socket: connect(2) returned "Operation now in progress"
2024-08-18 07:21:04 net.c:528:tds_open_socket() succeeded
2024-08-18 07:21:04 packet.c:852:Sending packet

Am i missing something here?

Would love some help.

freddy77 commented 4 weeks ago

The log is telling you that the code cannot open a TCP connection to {dbIpHere} port 1433. I would check it IP is correct, if there is some firewall rule that prevent the connection and if server is online.

freddy77 commented 1 week ago

Closing, as said probably network issue