Issue Details (XML | Word | Printable)

Key: DNET-945
Type: Bug Bug
Status: In Progress In Progress
Priority: Blocker Blocker
Assignee: Jiri Cincura
Reporter: Jan Pross
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
.NET Data provider

Inserting data after update results in "Column unknown" or "Must declare the variable '@px' errors

Created: 04/Aug/20 12:49 PM   Updated: Tuesday 10:45 AM
Component/s: Entity Framework Core
Affects Version/s: 7.1.1.0
Fix Version/s: None

File Attachments: 1. Zip Archive FbNetProviderIssue.zip (7 kB)

Environment: Windows 10, 16 GB RAM, i7-8850H CPU, Entity Framework Core 2.2.4, Firebird driver 7.1.1, Asp.Net Web Application with target framework 4.7.2, .Net Standard library 2.0


 Description  « Hide
Error is basically the same as in issue described here https://stackoverflow.com/questions/56357771/how-to-fix-must-declare-the-variable-with-firebirdsql-entityframeworkcore-fire

I've created simple web application where you can reproduce the issue https://filebin.net/cpfsuoh16xdl28xi
Steps to reproduce:
1. Build and run the web app
2. Repeat the same request e.g. 50 times by using some tool (if the requests are generated by refreshing the browser, the issue will not occur)
2. a. Capture the request e.g. with fiddler
2. b. Repeat the request from fiddler 50 times
3. An error occurs:
3. a.

Dynamic SQL Error
SQL error code = -206
Column unknown
P0
At line 2, column 9

at FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteReader(CommandBehavior behavior)
   at System.Data.Common.DbCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.<ExecuteAsync>d__17.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.<ExecuteAsync>d__32.MoveNext()

OR

3. b.

Must declare the variable '@p1'

at FirebirdSql.Data.FirebirdClient.FbCommand.UpdateParameterValues()
   at FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteCommand(CommandBehavior behavior, Boolean returnsSet)
   at FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteReader(CommandBehavior behavior)
   at System.Data.Common.DbCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.<ExecuteAsync>d__17.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.<ExecuteAsync>d__32.MoveNext()


Names of the columns and parameters can be different each time. Some requests will pass successfully some will result in beforehand mentioned errors. When an error occurs any other following request will result in an error unless the whole server is restarted.

We encountered this issue after switching some other parts of our solution to firebird. We are using 7.1.1 driver and we can not update to 7.5.0 for now (as it depends on EF core >= 3.0).


 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Jiri Cincura added a comment - 04/Aug/20 12:59 PM - edited
Given the 2.2 is already EOL (and my limited resources), I'll investigate only if you'll replicate this on 3.1 (and I think I fixed issue around this). Thanks for understanding.

Jan Pross added a comment - 04/Aug/20 03:07 PM
We will be able to upgrade to ef core >= 3.1 in the end I suppose, so I modified the test project by upgrading the ef core dependency to 3.1.1 and firebird to 7.5.0. I run the test case (50 requests) and it passed without any problem. I tried it again (clean test, delete database file etc.) and I hit the same error.

Dynamic SQL Error
SQL error code = -206
Column unknown
P0

I forgot to mention, that we are using Firebird-3.0.5.33220_0_x64

Modified web app: https://filebin.net/u8xdiohf9kkerpwr

Mattias Wijkström added a comment - 11/Sep/20 09:24 AM
We have seen the exact same issue with our .NET Framework 4.8 desktop application using Firebird .NET Provider 7.5.0 and Entity Framework Core 3.1.3. We run Firebird 3.0.5 in Super server mode.

We have observed the errors with the following stacktraces:

Dynamic SQL Error
SQL error code = -206
Column unknown
P0
At line 2, column 9

FirebirdSql.Data.Client.Native.FesDatabase.ProcessStatusVector
FirebirdSql.Data.Client.Native.FesStatement.Prepare
FirebirdSql.Data.FirebirdClient.FbCommand.Prepare
FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteCommand
FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteReader
Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReader
Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.Execute
Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.Execute
Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges
Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges
Microsoft.EntityFrameworkCore.DbContext.SaveChanges

-and-

Must declare the variable '@p3'

FirebirdSql.Data.FirebirdClient.FbCommand.UpdateParameterValues
FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteCommand
FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteReader
System.Data.Common.DbCommand.ExecuteDbDataReaderAsync
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification
Microsoft.EntityFrameworkCore.Storage.RelationalCommand+<ExecuteReaderAsync>d__17.MoveNext
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw
Microsoft.EntityFrameworkCore.Storage.RelationalCommand+<ExecuteReaderAsync>d__17.MoveNext
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw
Microsoft.EntityFrameworkCore.Storage.RelationalCommand+<ExecuteReaderAsync>d__17.MoveNext
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification
Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch+<ExecuteAsync>d__29.MoveNext
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw
Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor+<ExecuteAsync>d__8.MoveNext
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw
Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor+<ExecuteAsync>d__8.MoveNext
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification
Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager+<SaveChangesAsync>d__97.MoveNext
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification
Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager+<SaveChangesAsync>d__101.MoveNext
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification
Microsoft.EntityFrameworkCore.DbContext+<SaveChangesAsync>d__54.MoveNext

Jiri Cincura added a comment - 11/Sep/20 06:42 PM
The https://filebin.net/u8xdiohf9kkerpwr does not give me anything. Please upload the file(s) directly here.

Mattias Wijkström added a comment - 14/Sep/20 07:50 PM
Attaching a console app that produces the errors above.

Mattias Wijkström added a comment - 15/Sep/20 10:45 AM
Reproducable with Firebird .NET provider 6.6.0 and Entity Framework Core 2.2.4.