Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB SQL » View Thread |
Messages 11 to 20 of 20 total |
ElevateDB Error #506 Cannot lock the session manager (ID: 1) - Again |
Fri, Aug 5 2011 7:42 PM | Permanent Link |
Terry Swiers | Dale,
Could you forward the tips to me by email. I have a customer who is seeing 506 errors in the server log on a regular basis in a production environment. Anything that I can do to help locate the cause of this would be beneficial to everyone. Terry Swiers Millennium Software, Inc. millennium@1000years.com |
Tue, Aug 9 2011 4:48 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Mike,
<< Is this 506 issue supposedly resolved or did I miss a later post on another thread acknowledging that it still appears? I get this using D6 all the time with the latest build (2.05 B10) when I am in the IDE , so I know firsthand that it was not resolved, at least as far as D6 is concerned. >> A "session locked" error can happen in these cases: 1) A remote session has been disconnected while running a long process, and the remote session tries to reconnect to the same session on the server while the server session is still busy with the long process. Retrying the operation will resolve the problem as soon as the server session completes what it is doing. 2) A remote session tries to query any of the ServerSession* system information tables, and one of the sessions present on the server is in the middle of a long process, preventing the query from completing because the server cannot retrieve the session information. Just retrying the query will resolve the problem as soon as the server session completes what it is doing. 3) A remote session (or any other session) tries to disconnect or remove a different server session while that session is in the middle of a long process. Same remedy as above - retry the operation. -- Tim Young Elevate Software www.elevatesoft.com |
Wed, Aug 10 2011 3:17 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | I talked with Dale on the phone today, and there was one case that I was
missing in my description, and it is what is occurring with Dale's application: It is possible to get a #506 error solely on the client side with a remote session if you try to do something with a session while it's in the middle of waiting on a response from the EDB Server. In Dale's case it was a timer event getting fired due to the message loop being processed, and an attempt to request something from the server using the same remote session in the timer event. Improper client-side multi-threading could also cause this. -- Tim Young Elevate Software www.elevatesoft.com |
Thu, Aug 11 2011 3:52 PM | Permanent Link |
Dale Derix | If anyone is interested, the code below will allow you to see if the session is locked before you decide to do something with it. This is from Tim by the way.
First, you use the .TryLock method to see if you are able to lock the session. If successfull (Result = True), then you know that the session was not already locked. However, you have now just locked it by using .TryLock. So, before using the session, be sure to use the .Unlock method to unlock it. if TEDBEngineSessionManager(EDBSession1.Handle).TryLock(1, 0) then begin TEDBEngineSessionManager(EDBSession.Handle).Unlock; {Session is not locked and is safe for you to use} end else begin {Session is currently locked, better wait a bit and try again.} end; Many thanks to Tim and his great support for helping me resolve this one. Dale |
Wed, Oct 10 2012 2:16 AM | Permanent Link |
IQA | On 12/08/2011 5:52 AM, Dale Derix wrote:
> If anyone is interested, the code below will allow you to see if the session is locked before you decide to do something with it. This is from Tim by the way. > > First, you use the .TryLock method to see if you are able to lock the session. If successfull (Result = True), then you know that the session was not already locked. However, you have now just locked it by using .TryLock. So, before using the session, be sure to use the .Unlock method to unlock it. > > if TEDBEngineSessionManager(EDBSession1.Handle).TryLock(1, 0) then begin > TEDBEngineSessionManager(EDBSession.Handle).Unlock; > {Session is not locked and is safe for you to use} > end else begin > {Session is currently locked, better wait a bit and try again.} > end; > > Many thanks to Tim and his great support for helping me resolve this one. > > Dale > Hi All, Is the above code still the way to handle this error? I have some a CallRemoteProcedure running in a TTimer and am occassionally seeing this #506 error. Should I be placing that code in that code in the timer event? Also I'm having trouble converting it to C++ as it's an abstract class. Any ideas anyone? Cheers, Phil. |
Wed, Oct 10 2012 2:24 AM | Permanent Link |
IQA | On 10/10/2012 5:16 PM, Phil wrote:
> On 12/08/2011 5:52 AM, Dale Derix wrote: >> If anyone is interested, the code below will allow you to see if the >> session is locked before you decide to do something with it. This is >> from Tim by the way. >> >> First, you use the .TryLock method to see if you are able to lock the >> session. If successfull (Result = True), then you know that the >> session was not already locked. However, you have now just locked it >> by using .TryLock. So, before using the session, be sure to use the >> .Unlock method to unlock it. >> >> if TEDBEngineSessionManager(EDBSession1.Handle).TryLock(1, 0) then >> begin >> TEDBEngineSessionManager(EDBSession.Handle).Unlock; >> {Session is not locked and is safe for you to use} >> end else begin >> {Session is currently locked, better wait a bit and try again.} >> end; >> >> Many thanks to Tim and his great support for helping me resolve this one. >> >> Dale >> > > Hi All, > > Is the above code still the way to handle this error? > > I have some a CallRemoteProcedure running in a TTimer and am > occassionally seeing this #506 error. > > Should I be placing that code in that code in the timer event? > > Also I'm having trouble converting it to C++ as it's an abstract class. > > Any ideas anyone? > > Cheers, > > Phil. Do you think this is the way to go??? void __fastcall TMain::Timer1Timer(TObject *Sender) { if (CDSSession->Handle->TryLock(1, 0)) { CDSSession->Handle->Unlock(); DO SOMETHING HERE } } |
Mon, Nov 5 2012 4:50 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Phil,
<< Is the above code still the way to handle this error? >> Yes, if you want to not seeing a "session is locked" error. You can also just try your timer operation in a loop and trap such errors using a try..catch block, retrying until it works. That might be the easiest way to handle this, especially if you're only running into this in a few places. << Also I'm having trouble converting it to C++ as it's an abstract class. >> You'll probably need a dynamic cast in there to reference the instance as the proper TEDBEngineSessionManager class. Tim Young Elevate Software www.elevatesoft.com |
Sat, Nov 30 2013 2:08 PM | Permanent Link |
Barry | >>
if TEDBEngineSessionManager(EDBSession1.Handle).TryLock(1, 0) then begin TEDBEngineSessionManager(EDBSession.Handle).Unlock; {Session is not locked and is safe for you to use} end else begin {Session is currently locked, better wait a bit and try again.} end; << Does this code still work with EDB 2.13 B2? If so, can someone tell me what unit is TEDBEngineSessionManager located in? TIA Barry |
Mon, Dec 2 2013 2:14 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Barry,
<< Does this code still work with EDB 2.13 B2? If so, can someone tell me what unit is TEDBEngineSessionManager located in? >> Yes, and edbenginemgr.pas is the unit that you want. Tim Young Elevate Software www.elevatesoft.com |
Thu, Jun 16 2022 6:32 PM | Permanent Link |
Ian Branch | Hi Team,
I am trying to implement this that originated from Tim.. {code} // if TEDBEngineSessionManager(dmC.DBS1.Handle).TryLock(1) then begin TEDBEngineSessionManager(dmC.DBS1.Handle).Unlock; {Session is not locked and is safe for you to use} end else begin {Session is currently locked, better wait a bit and try again.} end; // {code} dmC.DBS1 is the TEDBSession in use. I have Users that get intermittently a 506 error when trying.. {code} ... try // with dmC.ttDBiSessions do begin Open; nSessionCount := FieldByName('SessionCount').AsInteger; Close; end; // ... {code} The 'instructions suggest I do something like this.. {code} // if TEDBEngineSessionManager(dmC.DBS1.Handle).TryLock(1) then begin TEDBEngineSessionManager(dmC.DBS1.Handle).Unlock; {Session is not locked and is safe for you to use} ... // with dmC.ttDBiSessions do begin Open; nSessionCount := FieldByName('SessionCount').AsInteger; Close; end; // .... end else begin {Session is currently locked, better wait a bit and try again.} end; // {code} Have I interpreted it correctly?? Regards & TIA, Ian |
« Previous Page | Page 2 of 2 | |
Jump to Page: 1 2 |
This web page was last updated on Tuesday, April 30, 2024 at 03:55 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |