Open
Description
Describe the bug
In arm v7 (arm32), calling the ping() function will cause blocking.Through log tracing, it is found that blocking occurs in Ping()->ExecContext()->s.exec(ctx, list)->s.processExec(ctx)->reader.iterateResponse()->t.nextToken()
Exception message:
Stack trace:
To Reproduce
func main() {
var sqlDB *sql.DB
dsn := fmt.Sprintf("sqlserver://%s:%s@%s:%d?database=%s&encrypt=disable", "sa", "xxxx", "192.168.100.245", 1433, "test")
db, err := gorm.Open(sqlserver.Open(dsn), &gorm.Config{})
if err != nil {
fmt.Println(err)
} else {
sqlDB, _ = db.DB()
// SetMaxIdleConns sets the maximum number of connections in the idle connection pool.
sqlDB.SetMaxIdleConns(10)
// SetMaxOpenConns sets the maximum number of open connections to the database.
sqlDB.SetMaxOpenConns(20)
}
for {
err = sqlDB.Ping()
fmt.Println("ping status ===== ", err)
if err != nil {
sqlDB.Close()
fmt.Println(err)
return
}
time.Sleep(time.Second * 2)
}
}
Expected behavior
The database will be shut down normally without blocking. Appears only when the network cable between client and server is unplugged.
Further technical details
SQL Server version: SQL Server 2008
Operating system: arm v7
go version go1.18.2 windows/amd64
build command: GOOS=linux GOARCH=arm go build