You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Database: Microsoft SQL Server 2019 (RTM-CU15) (KB5008996) - 15.0.4198.2 (X64)
Java: temurin-11.0.15
Kotlin: 1.6.21
Spring Boot: 2.6.7
OS: Linux 5.17.5-arch1-1
Current Behavior
While collecting from the following flow, it randomly closes connection and cancels the flow. It happens when i try fetch too many rows. In my case that is 34k rows. Also, rarely it collects all rows without error.
interfaceLegacyCustomerRepository : CoroutineCrudRepository<LegacyCustomer, Long> {
funfindAllByIdBetween(fromId:Long, toId:Long): Flow<LegacyCustomer>
}
@Service
classLegacyCustomerService(privatevallegacyCustomerRepository:LegacyCustomerRepository){
suspendfuncreateCustomerMigration(customerMigrationRequest:CustomerMigrationRequest) {
with(customerMigrationRequest) {
logger.info("Legacy customer migration started from id: $startFromId to id: $endToId.")
legacyCustomerRepository.findAllByIdBetween(startFromId, endToId)
.onCompletion {
if (it ==null) logger.info("Legacy customer migration finished. from id: $startFromId to id: $endToId.", it)
}
.catch {
logger.error("Legacy customer migration finished with error. from id: $startFromId to id: $endToId.", it)
}
.onEach {
try {
logger.info("Migrating customer with id: ${it.id}")
// ... another suspend method call
} catch (exception:Throwable) {
logger.error("Migrating failed for customer with id: ${it.id}", exception)
}
}.launchIn(CoroutineScope(Dispatchers.IO))
}
}
}
Expected behavior/code
Flow should be collected without errors as that is while using Reactor Flux. I do not face with the error if i use Flux and subscribe it:
funfindAllByIdBetween(fromId:Long, toId:Long): Flow<LegacyCustomer>
legacyCustomerRepo.findAllByIdBetween(startFromId, endToId)
.doAfterTerminate {
logger.info("Legacy customer migration finished. from id: $startFromId to id: $endToId.")
}
.doOnError {
logger.error("Legacy customer migration finished with error. from id: $startFromId to id: $endToId.", it)
}
.subscribe {
try {
logger.info("Migrating customer with id: ${it.id}")
runBlocking {
// ... another suspend method call
}
} catch (exception:Throwable) {
logger.error("Migrating failed for customer with id: ${it.id}", exception)
}
}
Possible Solution
When i used cursored exchange with fetch size as 128 instead of direct exchange, it worked as expected. But had faced with following prepared statement cache error when i called second time: Could not find prepared statement with handle 1073741825
Additional context
The text was updated successfully, but these errors were encountered:
This looks like a protocol offset error. There are a lot of moving parts involved. Can you provide a minimal reproducer using R2DBC MSSQL code only (without the use of Spring)? Otherwise, it will be next to impossible to diagnose the issue.
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.
Hi @mp911de, this error (Could not find prepared statement with handle 1073741825) now pops up again in version 1.0.1 when using prepared statements (bind method). First sql after startup runs fine, but subsequent sqls fail.
The error is not present in version 1.0.0, and the only code change I can see which has anything to do with prepared statements seems to be the removal of the no-param constructor in ConnectionOptions which was part of the commit which resolved issue 267.
We use bind a lot, so if it is possible to resolve this in the 1.x branch it would be much appreciated as we need to use Spring Boot 3 which is wired to the 1.x branch.
Bug Report
Versions
Current Behavior
While collecting from the following flow, it randomly closes connection and cancels the flow. It happens when i try fetch too many rows. In my case that is 34k rows. Also, rarely it collects all rows without error.
Stack trace
Table schema
Input Code
Steps to reproduce
Input Code
Expected behavior/code
Flow should be collected without errors as that is while using Reactor Flux. I do not face with the error if i use Flux and subscribe it:
Possible Solution
When i used cursored exchange with fetch size as 128 instead of direct exchange, it worked as expected. But had faced with following prepared statement cache error when i called second time:
Could not find prepared statement with handle 1073741825
Additional context
The text was updated successfully, but these errors were encountered: