Icon View Thread

The following is the text of the current message along with any replies. You may reply to this message or any of the other messages by clicking on the reply option next to the message that you wish to reply to.
Messages 1 to 5 of 5 total
Thread Access Violation - DisconnectServerSession in DBISAM Server
Wed, Apr 15 2009 10:04 AMPermanent Link Log in to reply

Ries van der Velden
Hello,

We are having problems with the DBISAM Server when removing dead or disconnected sessions. The server sometimes stops or hangs when
removing sessions. Only a restart of the Server will solve the problem. I will try to explain the situation as detailed as possible.

The questions:
- How can we prevent the Databseservice from hanging?
- Is having a lot [10-15] disconnected sessions during the day responsible for more 'OnPostError: Record has been changed..' messages?

We are using version V4.27 build 4 at the moment. But we where having the same problem with earlier versions.

We built a service with the DBISAM Server, in which we only have events for deleting sessions and lockfiles [So the system backup won't skip the
databasefiles at night because they are in use].  These events where added after the first problems with removing the dead sessions occurred.

First we used the build-in function of the server to remove dead sessions. The clients pinged every 60 secs, and the dead session timeout was set
to 90 secs. But sometimes the service just stopped when deleting a dead session. At that point we've searched the newsgroups and found a few
posts about this subject, but not any kind of solution.

So, to trying to avoid this problem we built an event which executed every 10 minutes, deleting al disconnected sessions at that moment. But still
the service just stopped during that event about once a week

Because we don't want 40-50 angry users every week, we decided to execute the event only once a day, at 22:00. In this event we use
GetServerSessionCount and loop through all the sessions, first disconnecting it and then removing it [See code snippet below]. Doing so, the
database service doesn't stop during the day, but still does sometimes at 22:00. We are not getting any errors nor is the except-clause fired. So
that makes it a bit harder to find out what is going wrong..

What I've noticed during the last service-stop, is that there is an AV in the server prior to the stop on the same day. See the logfile below. [I have
translated the logmessages to English]

And since this last change, we are getting more 'OnPostError: Record has been changed..' messages. I don't know if this has anything to do with
having some disconnected sessions around during the day?

-- CODE --

vCount := ServerEngine.GetServerSessionCount;

for vItemCount := 1 to vCount do
begin
 ServerEngine.GetServerSessionInfo(vItemCount, vSessionID  , vLoginDateTime, vLastConnected,
                                       vUserName , vUserAddress, vEncrypted    , vLastUserAddress);

   case ServerEngine.DisconnectServerSession(vSessionID) of
     True : pkoDebugMessage(cLeeg + 'Session: ' + vString + ' Disconnected'    );
     False: pkoDebugMessage(cLeeg + 'Session: ' + vString + ' NOT Disconnected');
   end;
 except
   on E:Exception do pkoDebugMessage(cLeeg + 'Error on Disconnecting Session: ' + vString + ' ' + E.Message);
 end;

 try
   case ServerEngine.RemoveServerSession(vSessionID) of
     True : pkoDebugMessage(cLeeg + 'Session: ' + vString + ' Deleted'    );
     False: pkoDebugMessage(cLeeg + 'Session: ' + vString + ' NOT Deleted');
   end;
 except
   on E:Exception do pkoDebugMessage(cLeeg + 'Error on Deleting Session: ' + vString + ' ' + E.Message);
 end;
end;

-- LOGFILE -

At 15:30 there is an unknown AV in the DB server, and during the delete event we are getting some Internal Errors [??] and at some point after
the disconnect of a session the service is stopped. The last line in the log below is actually the last line in the logfile for that day.

14-04-2009 15:30:13:200 : Error  - Type: Unknown        IP Client = 192.168.41.50     (Engine error [Access violation at address 004E1ADC in
module 'pkoDatabaseServices.exe'. Write of address 00000235])
14-04-2009 21:53:00:277 : Information - Type: Scheduled event  IP Client =                   (Scheduled event pkoClearSession started)
14-04-2009 21:53:00:277 : Number of sessions to delete: 16
14-04-2009 21:53:00:277 : Session: 192.168.41.85 LoginDateTime: 14-4-2009 5:57:37 Last active: 14-4-2009 18:08:46 Disconnected
14-04-2009 21:53:00:277 : Session: 192.168.41.85 LoginDateTime: 14-4-2009 5:57:37 Last active: 14-4-2009 18:08:46 Deleted
14-04-2009 21:53:00:277 : Session: 192.168.41.50 LoginDateTime: 14-4-2009 6:04:58 Last active: 14-4-2009 15:32:13 Disconnected
14-04-2009 21:53:00:293 : Error  - Type: Disconnect       IP Client = 192.168.41.50     (Internal error removing session [Privileged instruction])
14-04-2009 21:53:00:293 : Session: 192.168.41.50 LoginDateTime: 14-4-2009 6:04:58 Last active: 14-4-2009 15:32:13 Deleted
14-04-2009 21:53:00:293 : Session: 192.168.41.44 LoginDateTime: 14-4-2009 6:12:34 Last active: 14-4-2009 13:45:24 Disconnected
14-04-2009 21:53:00:309 : Error  - Type: Disconnect       IP Client = 192.168.41.44     (Internal error removing session [Access violation at
address 58146BF7. Write of address B790DD25])
14-04-2009 21:53:00:309 : Session: 192.168.41.44 LoginDateTime: 14-4-2009 6:12:34 Last active: 14-4-2009 13:45:24 Deleted
14-04-2009 21:53:00:309 : Session: 192.168.41.70 LoginDateTime: 14-4-2009 6:23:40 Last active: 14-4-2009 10:44:07 Disconnected
14-04-2009 21:53:00:324 : Error  - Type: Disconnect       IP Client = 192.168.41.70     (Internal error removing session [Access violation at
address 0000EBC3. Read of address 0000EBC3])
14-04-2009 21:53:00:324 : Session: 192.168.41.70 LoginDateTime: 14-4-2009 6:23:40 Last active: 14-4-2009 10:44:07 Deleted
14-04-2009 21:53:00:324 : Session: 192.168.41.89 LoginDateTime: 14-4-2009 6:46:47 Last active: 14-4-2009 11:36:47 Disconnected
14-04-2009 21:53:00:340 : Session: 192.168.41.89 LoginDateTime: 14-4-2009 6:46:47 Last active: 14-4-2009 11:36:47 Deleted
14-04-2009 21:53:00:340 : Session: 192.168.41.67 LoginDateTime: 14-4-2009 7:01:56 Last active: 14-4-2009 8:52:56 Disconnected
Fri, Apr 17 2009 10:21 PMPermanent Link Log in to reply

"Raul"

While i have not used the DisconnectServerSession and RemoveServerSession
functions i do have a question about the for loop - since you are removing
the sessions wouldn't the GetServerSessionInfo hit non-existing session
numbers (as it uses a logical number from 1..GetServerSessionCount ?: I
assumed after RemoveServerSession the GetServerSessionCount would be down by
1 each time.

Have you tried something like

while ServerEngine.GetServerSessionCount > 0 do
begin
   GetServerSessionInfo(1,...) //always remove 1st session in remaining
lisrt
.....

end


Raul



"Ries van der Velden" <ries@pk-options.nl> wrote in message
news:56E88C99-46B3-4DC8-B6CA-59AE58C1D64B@news.elevatesoft.com...
> Hello,
>
> We are having problems with the DBISAM Server when removing dead or
> disconnected sessions. The server sometimes stops or hangs when
> removing sessions. Only a restart of the Server will solve the problem. I
> will try to explain the situation as detailed as possible.
>
> The questions:
> - How can we prevent the Databseservice from hanging?
> - Is having a lot [10-15] disconnected sessions during the day responsible
> for more 'OnPostError: Record has been changed..' messages?
>
> We are using version V4.27 build 4 at the moment. But we where having the
> same problem with earlier versions.
>
> We built a service with the DBISAM Server, in which we only have events
> for deleting sessions and lockfiles [So the system backup won't skip the
> databasefiles at night because they are in use].  These events where added
> after the first problems with removing the dead sessions occurred.
>
> First we used the build-in function of the server to remove dead sessions.
> The clients pinged every 60 secs, and the dead session timeout was set
> to 90 secs. But sometimes the service just stopped when deleting a dead
> session. At that point we've searched the newsgroups and found a few
> posts about this subject, but not any kind of solution.
>
> So, to trying to avoid this problem we built an event which executed every
> 10 minutes, deleting al disconnected sessions at that moment. But still
> the service just stopped during that event about once a week
>
> Because we don't want 40-50 angry users every week, we decided to execute
> the event only once a day, at 22:00. In this event we use
> GetServerSessionCount and loop through all the sessions, first
> disconnecting it and then removing it [See code snippet below]. Doing so,
> the
> database service doesn't stop during the day, but still does sometimes at
> 22:00. We are not getting any errors nor is the except-clause fired. So
> that makes it a bit harder to find out what is going wrong..
>
> What I've noticed during the last service-stop, is that there is an AV in
> the server prior to the stop on the same day. See the logfile below. [I
> have
> translated the logmessages to English]
>
> And since this last change, we are getting more 'OnPostError: Record has
> been changed..' messages. I don't know if this has anything to do with
> having some disconnected sessions around during the day?
>
> -- CODE --
>
> vCount := ServerEngine.GetServerSessionCount;
>
> for vItemCount := 1 to vCount do
> begin
>  ServerEngine.GetServerSessionInfo(vItemCount, vSessionID  ,
> vLoginDateTime, vLastConnected,
>                                        vUserName , vUserAddress,
> vEncrypted    , vLastUserAddress);
>
>    case ServerEngine.DisconnectServerSession(vSessionID) of
>      True : pkoDebugMessage(cLeeg + 'Session: ' + vString + '
> Disconnected'    );
>      False: pkoDebugMessage(cLeeg + 'Session: ' + vString + ' NOT
> Disconnected');
>    end;
>  except
>    on E:Exception do pkoDebugMessage(cLeeg + 'Error on Disconnecting
> Session: ' + vString + ' ' + E.Message);
>  end;
>
>  try
>    case ServerEngine.RemoveServerSession(vSessionID) of
>      True : pkoDebugMessage(cLeeg + 'Session: ' + vString + '
> eted'    );
>      False: pkoDebugMessage(cLeeg + 'Session: ' + vString + ' NOT
> Deleted');
>    end;
>  except
>    on E:Exception do pkoDebugMessage(cLeeg + 'Error on Deleting Session: '
> + vString + ' ' + E.Message);
>  end;
> end;
>
> -- LOGFILE --
>
> At 15:30 there is an unknown AV in the DB server, and during the delete
> event we are getting some Internal Errors [??] and at some point after
> the disconnect of a session the service is stopped. The last line in the
> log below is actually the last line in the logfile for that day.
>
> 14-04-2009 15:30:13:200 : Error  - Type: Unknown        IP Client =
> 192.168.41.50     (Engine error [Access violation at address 004E1ADC in
> module 'pkoDatabaseServices.exe'. Write of address 00000235])
> 14-04-2009 21:53:00:277 : Information - Type: Scheduled event  IP Client =
> (Scheduled event pkoClearSession started)
> 14-04-2009 21:53:00:277 : Number of sessions to delete: 16
> 14-04-2009 21:53:00:277 : Session: 192.168.41.85 LoginDateTime: 14-4-2009
> 5:57:37 Last active: 14-4-2009 18:08:46 Disconnected
> 14-04-2009 21:53:00:277 : Session: 192.168.41.85 LoginDateTime: 14-4-2009
> 5:57:37 Last active: 14-4-2009 18:08:46 Deleted
> 14-04-2009 21:53:00:277 : Session: 192.168.41.50 LoginDateTime: 14-4-2009
> 6:04:58 Last active: 14-4-2009 15:32:13 Disconnected
> 14-04-2009 21:53:00:293 : Error  - Type: Disconnect       IP Client =
> 192.168.41.50     (Internal error removing session [Privileged
> instruction])
> 14-04-2009 21:53:00:293 : Session: 192.168.41.50 LoginDateTime: 14-4-2009
> 6:04:58 Last active: 14-4-2009 15:32:13 Deleted
> 14-04-2009 21:53:00:293 : Session: 192.168.41.44 LoginDateTime: 14-4-2009
> 6:12:34 Last active: 14-4-2009 13:45:24 Disconnected
> 14-04-2009 21:53:00:309 : Error  - Type: Disconnect       IP Client =
> 192.168.41.44     (Internal error removing session [Access violation at
> address 58146BF7. Write of address B790DD25])
> 14-04-2009 21:53:00:309 : Session: 192.168.41.44 LoginDateTime: 14-4-2009
> 6:12:34 Last active: 14-4-2009 13:45:24 Deleted
> 14-04-2009 21:53:00:309 : Session: 192.168.41.70 LoginDateTime: 14-4-2009
> 6:23:40 Last active: 14-4-2009 10:44:07 Disconnected
> 14-04-2009 21:53:00:324 : Error  - Type: Disconnect       IP Client =
> 192.168.41.70     (Internal error removing session [Access violation at
> address 0000EBC3. Read of address 0000EBC3])
> 14-04-2009 21:53:00:324 : Session: 192.168.41.70 LoginDateTime: 14-4-2009
> 6:23:40 Last active: 14-4-2009 10:44:07 Deleted
> 14-04-2009 21:53:00:324 : Session: 192.168.41.89 LoginDateTime: 14-4-2009
> 6:46:47 Last active: 14-4-2009 11:36:47 Disconnected
> 14-04-2009 21:53:00:340 : Session: 192.168.41.89 LoginDateTime: 14-4-2009
> 6:46:47 Last active: 14-4-2009 11:36:47 Deleted
> 14-04-2009 21:53:00:340 : Session: 192.168.41.67 LoginDateTime: 14-4-2009
> 7:01:56 Last active: 14-4-2009 8:52:56 Disconnected
>

Tue, Apr 21 2009 10:59 AMPermanent Link Log in to reply

Ries van der Velden
"Raul" wrote:


While i have not used the DisconnectServerSession and RemoveServerSession
functions i do have a question about the for loop - since you are removing
the sessions wouldn't the GetServerSessionInfo hit non-existing session
numbers (as it uses a logical number from 1..GetServerSessionCount ?: I
assumed after RemoveServerSession the GetServerSessionCount would be down by
1 each time.

Have you tried something like

while ServerEngine.GetServerSessionCount > 0 do
begin
   GetServerSessionInfo(1,...) //always remove 1st session in remaining
lisrt
.....

end


Raul

Hello Raul,

Thanks for the reply.

The code snippet was a bit simplyfied, but a good idea anyway.

Another question: Is it necessary to first disconnect a session before deleting it? Even if the session is still connected?

Regards, Ries
Tue, Apr 21 2009 1:22 PMPermanent Link Log in to reply

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Ries,

<< We are having problems with the DBISAM Server when removing dead or
disconnected sessions. The server sometimes stops or hangs when removing
sessions. Only a restart of the Server will solve the problem. I will try to
explain the situation as detailed as possible. >>

Send me an email (timyoung@elevatesoft.com) and I will send you a copy of
the dbsrvr.exe with extra error logging in it.  Once the error happens
again, I'll need you to send me the dbsrvr.log file and then I can see where
the issue might be.  This type of issue is almost always caused by a prior
issue with the session that corrupted its internal state.  When the server
tries to remove such a session, the result is sometimes not pretty due to
the state corruption.  The key is figuring out the cause of the original
problem.

--
Tim Young
Elevate Software
www.elevatesoft.com


Tue, Apr 21 2009 1:23 PMPermanent Link Log in to reply

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Ries,

<< Another question: Is it necessary to first disconnect a session before
deleting it? Even if the session is still connected? >>

No, you can remove a session that is still connected.  The removal process
will disconnect the session automatically.

--
Tim Young
Elevate Software
www.elevatesoft.com

Image