java.net.SocketException: Connection reset while streaming data from MS SQL server using Alpakka Slick connector

Hi

I am getting the following error when reading data from MS SQL server using Alpakka slick connector using Akka Streams:
java.net.SocketException: Connection reset

It processes few records and then suddenly came up the error. Can anyone please help me with this that what can be the reason for the connection reset issue?

Code:

val db = slick.jdbc.JdbcBackend.Database.forURL(connectionString)
val fetchSize = 50000
val profile = profileName match {
  case MSSQLServer => slick.jdbc.SQLServerProfile
  case Postgres => slick.jdbc.PostgresProfile
}
implicit val session: SlickSession = SlickSession.forDbAndProfile(db, profile)
import session.profile.api._
Slick.source(sql"#$queryString".as[T](resultantType).withStatementParameters(
  fetchSize = fetchSize
))