r2dbc / r2dbc-mssql

R2DBC Driver for Microsoft SQL Server using TDS (Tabular Data Stream) Protocol
Apache License 2.0
178 stars 32 forks source link

Could not find prepared statement with handle #289

Open sebastian-alfers opened 6 months ago

sebastian-alfers commented 6 months ago

I am inserting a few rows concurrently (using scala future, 100 queries) and I am getting the following ErrorToken:

[2024-01-16 10:40:58,815] [DEBUG] [io.r2dbc.mssql.client.ReactorNettyClient] [] [] [reactor-tcp-nio-6] - [cid: 0x11] Response: ErrorToken [number=8179, state=4, infoClass=16, message='Could not find prepared statement with handle 2.", serverName='ad4bc1cf0cd2", procName='", lineNumber=16777216]

I am using 1.0.2-RELEASE and preferCursoredExecution=false.

sebastian-alfers commented 6 months ago

This is how to reproduce it:

git clone git@github.com:sebastian-alfers/akka-persistence-r2dbc.git
cd akka-persistence-r2dbc
git checkout mssql-support-2nd
docker compose -f docker/docker-compose-sqlserver.yml up -d
sbt -Dconfig.resource=application-sqlserver.conf test

It uses sbt and scala.

Changing the dependency can be done here and settings here.

sebastian-alfers commented 6 months ago

It seems to make a difference when the root log level and / or the io.r2dbc.mssql.QUERY to INFO (where it works) or DEBUG (where it fails).

Change can be done here to trigger the error.