Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid TDS Stream Connection Reset By Peer #800

Open
mathiasyeremiaaryadi opened this issue May 20, 2024 · 0 comments
Open

Invalid TDS Stream Connection Reset By Peer #800

mathiasyeremiaaryadi opened this issue May 20, 2024 · 0 comments

Comments

@mathiasyeremiaaryadi
Copy link

mathiasyeremiaaryadi commented May 20, 2024

Issue

I have 4 golang backend services that hit the same database but different table. However, some of them are succeed and some of them failed. The golang services only perform a simple SELECT statement. There are 4 tables and have 1-3mil rows average 12-80 columns.

Code

Here is the golang service code below:

sql := fmt.Sprintf(`SELECT * FROM [%s].[dbo].[%s] WITH (NOLOCK)`, viper.GetString("SQL_SERVER_DBNAME"), viper.GetString("SQL_SERVER_TABLE"))
repository.logger.Infof(sql)

rows, err := repository.sqlServerConnection.Query(sql)
if err != nil {
	return nil, err
}
defer rows.Close()

var dataList []Order
for rows.Next() {
	var data Order
	err := rows.Scan(....)
	if err != nil {
		return nil, err
	}

	dataList= append(dataList, data )
}

if rows.Err() != nil {
	return nil, rows.Err()
}

return dataList, nil

Error Log

This is the error log I got:

{
 "errorCode": "050",
 "responseCode": "05",
 "responseMessage": "Database Error",
 "errorMessage": [
  "Invalid TDS stream: read tcp xxx.xxx.xxx.xx:xxxxxx-\u003exxx.xx.xx.xx:1433: read: connection reset by peer"
 ],
 "error": {
  "InnerError": {
   "Op": "read",
   "Net": "tcp",
   "Source": {
    "IP": "xxx.xxx.xxx.xx",
    "Port": xxxxx,
    "Zone": ""
   },
   "Addr": {
    "IP": "xxx.xxx.xx.x",
    "Port": 1433,
    "Zone": ""
   },
   "Err": {
    "Syscall": "read",
    "Err": 104
   }
  }
 },
 "data": null
}

I need some insight about what causing the issue above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant