Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 7 of 7 total
Thread Help, cant seem to get OnReconnect to fire
Sat, Jun 22 2019 5:14 PMPermanent Link

David

I am having an issue with the latest build of the database on 10.3 Rio  and the OnReconnect event.  I have setup a very very basic app that simply has a session, and a database that are all connected. I have ping setup for 60 seconds and set to true.  I then deliberately go to DB Admin and either stop the active session or stop the server.  I am then expecting after a little delay for the On Reconnect event to fire, but it doesn't.

I am seeing the exception raised in the debugger as a first chance exception, but it never fires the event handler.

This is my first time using 10.3 Rio so a virgin install with just DBISam installed and no other config other than out of the box.  I have done most of my work using dbisam 4.25 on Delphi 2007 and this works fine on that system.  I am not sure what it is I am doing wrong.

Does anyone have any idea why this might be?

Thanks
David.
Sun, Jun 23 2019 10:51 AMPermanent Link

David

I have done some more digging and I think, although I am not certain,  this might be a bug in releases > 4.25.  I know that this works on that release as I am actively using it with D2007 but I am intending to move to the latest release and 10.3 Rio.  It might be I have to do something else to get this event to fire in later releases that I never had to do before though.

What I have done is I loaded the most recent version of dbisam into D2007 and ran my existing code and I end up with the same result, the onreconnect not firing.  If I put 4.25 back it starts working again.

Can anyone confirm this is the case and not just me being stupid, which is entirely likely Smile

The only reason I noticed this was because I was testing my existing app compiled on Windows 7 to see how it runs on Windows 10.  I haven't came across any issues with one exception.  If I am running the executable on a network drive and I turn off the host server, the app keeps on running on Windows 10, but on Windows 7 it would fire the reconnect event and bring up a dialog to say the network was disconnected.  
I dont think this is a DBISam issue more Windows 10 and pageing.  If I was to keep the host computer up and turn off the dbisam server, the event fires fine, indicating there must be some differences from Windows 7 pageing and Windows 10 as the executble can't be accessed.   I even tried to use the PE flag to force app to run from the swap if run from network, no issues with Windows 7, but on Windows 10 the app just terminates.

The only reason I have to use this event is due to some laptop users not disconnecting the database but unplugging their laptops for a few hours then plugging back in, by this time their session has expired.  I like the option of bringing up a warning and allow them to try and reconnect or abort.

Thinking it might be due to me being somewhat out of date with Delphi and indeed DBISam I decided to try the latest release of both and see how it works lead my to notice this issue.

Any help appreciated.

Regards
David.
Mon, Jun 24 2019 12:00 PMPermanent Link

Raul

Team Elevate Team Elevate

On 6/23/2019 10:51 AM, David wrote:
> I have done some more digging and I think, although I am not certain,  this might be a bug in releases > 4.25.  I know that this works on that release as I am actively using it with D2007 but I am intending to move to the latest release and 10.3 Rio.  It might be I have to do something else to get this event to fire in later releases that I never had to do before though.
>
> What I have done is I loaded the most recent version of dbisam into D2007 and ran my existing code and I end up with the same result, the onreconnect not firing.  If I put 4.25 back it starts working again.
>
> Can anyone confirm this is the case and not just me being stupid, which is entirely likely Smile
>

Definitely looks like a behavioral change- i'm seeing it here also with
4.48 B3.

Looking at the release notes and docs i don't see this having changed
though so looks like something with newer builds.

I'm seeing few different behaviors - using remote session with
remoteping enabled and onremotereconnect (Continue:=true) and
onremotetimeout (StayConnected:=true) event handlers but otherwise idle
(running outside IDE to avoid seeing exceptions and just relying on
events) :

A. Manually disconnect session using dbsrvr

1. it will auto-reconnect by itself and does not trigger "OnRemoteReconnect"

2. Attempting operation using a bound component (like table.refresh)
when session disconnected will trigger "OnRemoteReconnect" and it
reconnects ok

B. If i manually remove the session using dbsrvr

3. Does not trigger anything at all - nothing seems to fire at all

4. Attempting operation using a bound component will trigger reconnect
but session is gone at this point of course

I think something we need Tim to take a look

Raul
Mon, Jun 24 2019 1:34 PMPermanent Link

David

Thanks for confirming I am not going mad Raul.  I concur, if you attach a table and try and get some data it does indeed fire that onreconnect, but not on the result of a ping as it used to do in 4.25.

I have tried many different options, most of which I forget but I am sure I have also tried 4.40 as well and it was doing the same thing on that release, maybe even before.  Perhaps Tim can say how long its been like this.

Regards
David.

Raul wrote:


I think something we need Tim to take a look

Raul
Mon, Jun 24 2019 5:36 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

David,

<< I am having an issue with the latest build of the database on 10.3 Rio  and the OnReconnect event.  I have setup a very very basic app that simply has a session, and a database that are all connected. I have ping setup for 60 seconds and set to true.  I then deliberately go to DB Admin and either stop the active session or stop the server.  I am then expecting after a little delay for the On Reconnect event to fire, but it doesn't. >>

It may be just down to the fact that the pinging thread is the one performing the reconnection, in which case you won't see the OnRemoteReconnect event fire.  This is due to the fact that the ping is occurring in a thread, and so DBISAM doesn't even attempt to mediate this via a UI-handled event handler.

In general, the pinging and OnRemoteReconnect event handler aren't designed to be used in conjunction, primarily because the pinging is supposed to alleviate the need for the OnRemoteReconnect event.

Tim Young
Elevate Software
www.elevatesoft.com
Tue, Jun 25 2019 1:10 PMPermanent Link

David

Hi Tim.

Ok I take your point and I can live with that, it was more that this behaviour has changed since 4.25 where the ping will invoke the OnReconnect event and I have been using this to alert the user that the server has disconnected which is great for when the app is sitting idle or they have unplugged a laptop.  The other way requires the user to request data from the server before it is noticed, where by using ping it was automatic every 60 seconds.

Is there a better way to do this?  I had thought partly that was what this event did.

Regards
David.

Tim Young [Elevate Software] wrote:

David,

It may be just down to the fact that the pinging thread is the one performing the reconnection, in which case you won't see the OnRemoteReconnect event fire.  This is due to the fact that the ping is occurring in a thread, and so DBISAM doesn't even attempt to mediate this via a UI-handled event handler.

In general, the pinging and OnRemoteReconnect event handler aren't designed to be used in conjunction, primarily because the pinging is supposed to alleviate the need for the OnRemoteReconnect event.

Tim Young
Elevate Software
www.elevatesoft.com
Sat, Dec 12 2020 7:46 PMPermanent Link

Shedden

Hi All,

I would also be interested in the best way to detect pinging a dead session from the client side. I had also hooked the OnRemoteReconnect event in the client. We have users that don't close the application, so it's pinging. If the server is rebooted for maintenance the server log gets filled with 'session not found' errors on restart. I would like to handle it. The user only sees the error once the application is interacted with, but that could be days in some cases and it's a waste of resources. Regardless of training, some will not hang up the phone when done. The application loads in a reasonable time so there is nothing to be saved by leaving it connected all of the time. I think people just forget what's going on under their screen saver before they leave.

It would be nice to detect a reasonable number of failures and react. I hope I didn't miss the end of this thread somehow. That last question as to how to best do it seemed right on target to help me as well.

Regards,
Jim

David wrote:

Hi Tim.

Ok I take your point and I can live with that, it was more that this behaviour has changed since 4.25 where the ping will invoke the OnReconnect event and I have been using this to alert the user that the server has disconnected which is great for when the app is sitting idle or they have unplugged a laptop.  The other way requires the user to request data from the server before it is noticed, where by using ping it was automatic every 60 seconds.

Is there a better way to do this?  I had thought partly that was what this event did.

Regards
David.

Tim Young [Elevate Software] wrote:

David,

It may be just down to the fact that the pinging thread is the one performing the reconnection, in which case you won't see the OnRemoteReconnect event fire.  This is due to the fact that the ping is occurring in a thread, and so DBISAM doesn't even attempt to mediate this via a UI-handled event handler.

In general, the pinging and OnRemoteReconnect event handler aren't designed to be used in conjunction, primarily because the pinging is supposed to alleviate the need for the OnRemoteReconnect event.

Tim Young
Elevate Software
www.elevatesoft.com
Image