Long running WPF program crashes on query after long time of beeing unused

40 views
Skip to first unread message

baur...@gmail.com

unread,
Nov 25, 2023, 10:54:48 AM11/25/23
to firebird-net-provider
Hello,

I have a programm that might run for days on the PC of the customer. When he opens it from the taskbar some queries are executed. I am currently on .net provider 8.5.4

This generates following error:

FirebirdSql.Data.FirebirdClient.FbException (0x80004005): invalid transaction handle (expecting explicit transaction start) ---> RestoreGroupBy
   bei FirebirdSql.Data.Client.Managed.GdsConnection.HandleResponseException(IResponse response)
   bei FirebirdSql.Data.Client.Managed.Version10.GdsDatabase.ReadResponse()

1. What needs to be done to allow the program to open a new connection and execute a query after about 24h?
2. Is there a way to reproduze such a situation with waiting 24h?

I also looked into the .net provider releases from 8.5.4.0 till 10.0.0.0 but was not able to identify a fix that might be related to this problem.

Thanks

Nikio

Jiří Činčura

unread,
Nov 25, 2023, 11:31:09 AM11/25/23
to 'Mr. John' via firebird-net-provider
Hi, before we spend some time on it, try latest version of provider.

--
Mgr. Jiří Činčura
https://www.tabsoverspaces.com/
> --
> You received this message because you are subscribed to the Google
> Groups "firebird-net-provider" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to firebird-net-pro...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/firebird-net-provider/27ea1f48-1599-4aba-bc2b-588e2a347d7en%40googlegroups.com
> <https://groups.google.com/d/msgid/firebird-net-provider/27ea1f48-1599-4aba-bc2b-588e2a347d7en%40googlegroups.com?utm_medium=email&utm_source=footer>.

baur...@gmail.com

unread,
Nov 25, 2023, 11:48:01 AM11/25/23
to firebird-net-provider
Hello Jiri,

I have planned that and will do it.

Do know a way to simulate the behaviour of the connection (and the connectionpool) for x hours of inactivity? I would like to reproduce the problem on the development machine.

Niko

Steve Naidamast

unread,
Nov 25, 2023, 1:19:16 PM11/25/23
to firebird-n...@googlegroups.com
Hello Niko...

From the little I could garner from your notes, it sounds like you require some type of management program to manage the program that you want to execute with Firebird database access.

In any case, it would appear that you require some form of timing mechanism that can either restart your program or one that is internal to your existing program that will be able to clear out (close) the current connections and start afresh with a new one.

Steve Naidamast
  Sr. Software Engineer
 

From: firebird-n...@googlegroups.com <firebird-n...@googlegroups.com> on behalf of baur...@gmail.com <baur...@gmail.com>
Sent: Saturday, November 25, 2023 11:48 AM
To: firebird-net-provider <firebird-n...@googlegroups.com>
Subject: Re: [firebird-net-provider] Long running WPF program crashes on query after long time of beeing unused
 

baur...@gmail.com

unread,
Nov 26, 2023, 8:01:13 AM11/26/23
to firebird-net-provider
Hello Steve,

considering that a new connection is created I was expecting that it would work independent if the last inaction was 1 minute or 1 day ago. This is the code piece where the error is thrown.

In order to reproduce the problem I can start the program and wait 24h before I execute the same steps as the customer. Or there is a different way (but it looks like that there is not).

Restarting the program could be done by the task scheduler, but its more a workaround than a solution...

Niko

using (var fbCon = DatabaseHelper.CreateOpenFbConnection())
{
ressourcen = fbCon.Query<dtoRessource>(sb.ToString(), new { startdatum = this.StartDatum, stopdatum = this.StopDatum }).ToList();
}

public static FbConnection CreateOpenFbConnection()
{
var result = new FbConnection(AppGlobals.fbConnectionString);
result.Open();
return result;
}

Mark Rotteveel

unread,
Nov 26, 2023, 12:40:05 PM11/26/23
to firebird-n...@googlegroups.com
On 26-11-2023 14:01, baur...@gmail.com wrote:
> considering that a new connection is created I was expecting that it
> would work independent if the last inaction was 1 minute or 1 day ago.
> This is the code piece where the error is thrown.

You're not (necessarily) creating a new connection. The Firebird .net
provider has a built-in connection pool.

Mark
--
Mark Rotteveel

baur...@gmail.com

unread,
Nov 26, 2023, 1:16:44 PM11/26/23
to firebird-net-provider
Hello Mark,

I am using the connection pool of the .net provider and would like to understand if there are parameters or settings that can cause or prevent such an error.

Niko

Steve Naidamast

unread,
Nov 26, 2023, 2:27:17 PM11/26/23
to firebird-n...@googlegroups.com
Hello Niko...

As far as I know, the only ADO.NET command that will close an opened connection for you is the DataReader.  However, I have had some issues attempting to use this default behavior, so I always close and dispose of my connections no matter what.  This way I can keep the connection-pool clean.

I notice in your code below that you do not do this, or at least not in the code you have provided.

You may want to try adding the closure code at the end of your task and see if that helps in any way.

Also, have you received any connection timeout notices?  If so, this may be the basis of your issue.

Steve Naidamast
  Sr. Software Engineer
 


Sent: Sunday, November 26, 2023 8:01 AM
Reply all
Reply to author
Forward
0 new messages