Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Session locked
#1
I have an IW app the is running on a server and several terminal picking machines are accessing this app.
My client employees are frequently getting without network access and for some reason the IW app on the server (running as a service) is crashing.
For them to be able to work again, I have to Stop/Start the service.
From the log file I get this:
------------------------------------------------------------------------------------------------------------------------
Exception message  : Session is already locked.
Session ID is invalid.
Exception class    : ESessionAlreadyLocked
Session ID        : U5frjA36njGH2PHcMhFc7-zKZWS
Exception details  : UrlPath=/$/callback; CallbackName=CODIGOARTIGO.DoOnAsyncEnter
Exception address  : 00797B25
Exception Time    : 2023-03-22 15:40:17.636
------------------------------------------------------------------------------------------------------------------------
Application Name  : Comogest_GestArmazemWebSrv.exe
Application Version: 1.0.0.0
Started at        : 2023-03-22 14:30:10.976
Running for        :  1 hour 10 minutes 6 seconds
Computer Name      : SERVICOS
Compiler Version  : 320
------------------------------------------------------------------------------------------------------------------------
IntraWeb Version  : 15.2.69
Multi-session      : False
Content Path      : C:\Comograma\Comogest_Gestao_Armazem\wwwroot\
Session count      : 24
------------------------------------------------------------------------------------------------------------------------
Client IP address  : 192.168.1.107
Request PathInfo  : /gestarmazem/$/callback
Request Method    : POST
Request User Agent : Mozilla/5.0 (Linux; Android 7.1.2; PM550 Build/N2G47H; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/111.0.5563.57 Mobile Safari/537.36
Cookies Count      : 1



Any idea on how to solve this?
How to terminate session on this case, when I loose access to the network (wireless) ?
Reply
#2
Hi there,

This exception does/should not cause any side effects on the server side other than possibly showing an error to that specific user.

The "Session is already locked" event happens when the following situation occurs:

1) Session X receives a request (let's call it Request A) and starts processing it. IW "locks" this session, i.e. the session is flagged as "in use" so it can't be destroyed/removed/terminated. This flag will be cleaned when the response is sent back to the browser

2) During that time, that specific Session X can't respond to other requests.

3) If during that time IW receives a new request targeting session X, Request B, it will hold this request and put it in a wait state, up to SessionOptions.LockSessionTimeout milliseconds. If the request A is responded before the SessionOptions.LockSessionTimeout expires, Request B will be processed in sequence and will also be responded. However, if request A takes a long time to respond (imagine a big report being generated), then the Request B wait state will "timeout" and this error will be responded back to the browser (which actually means: the server is busy processing your prior request now and can't process a new request at the moment)

Due to the nature of the callback (an async enter event) I'd suggest that you inspect your code and look for reasons for this to happen. Possibly the user is triggering something that will take a long time and moving the cursor to this input field (CODIGOARTIGO) which has the event attached. In that case, I suggest that you lock the screen while waiting for this action to complete before letting the user move to this field.

Regarding this service "crashing", is there any other exceptions happening? This exception here, as I said, is normal, expected and treated inside IW and won't cause any issues on the server side, so it shouldn't be causing any service crash.
Reply
#3
This is really much more complicated than this. The issue is not about sessions, but another thing that will make, at certain point, the application to stop.
I have a main form with a button (it's an online store) that shows the basket. That second form (the basket) has a button that closes it self (the baklet) and returns to the main form.

First question: I need to update a iwdbgrid when I close the basket. Whats the most appropriate place to do this. On the renderform event of the main form?

The real problem if after I click several times on the button to show the basket (2nd form) and close it, and repeating this several times, without even change basket contents, at certain point it will raize an access violation, reaching at a point that the app will crash.

From the app logs:
------------------------------------------------------------------------------------------------------------------------
Exception message  : Access violation at address 0042E841 in module 'Comogest_FAC_BO2Web.exe'. Read of address 0000000F
Depending on the error condition, it might be possible to restart the application.
Exception class    : EAccessViolation
Exception address  : 0042E841
Exception Time    : 2023-03-27 17:33:36.733
------------------------------------------------------------------------------------------------------------------------
Application Name  : Comogest_FAC_BO2Web.exe
Application Version: 1.0.0.0
Started at        : 2023-03-27 17:31:38.389
Running for        :  1 minute 58 seconds
Computer Name      : MAGICIAN-69
Compiler Version  : 320
------------------------------------------------------------------------------------------------------------------------
IntraWeb Version  : 15.2.69
Multi-session      : False
Content Path      : E:\Executaveis\Comogest_FAC_BO2Web\wwwroot\
Session count      : 2
Application Path  : E:\Executaveis\Comogest_FAC_BO2Web\
Active Form        : IWOptions (TIWOptions)
Active Form list  : [1] IWOptions (TIWOptions)
Form list          : [1] IWUserSession (TIWUserSession)
                    [2] IWOptions (TIWOptions)
                    [3] DAssinaDocumento (TDAssinaDocumento)
                    [4] TIWDBGridColumn
                    [5] Error retrieving component name/class name: Access violation at address 0040AC90 in module 'Comogest_FAC_BO2Web.exe'. Read of address 8BC35B2E
Browser Name      : Chrome
Browser UserAgent  : Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36
Session ID        : RJqrjDYavt2yT2vgIbc~RsCWsay
Last Access        : 2023-03-27 17:33:36.360
Callback          : True
Callback name      : BTNCARRINHO.DoOnAsyncClick
Runtime parameters :
------------------------------------------------------------------------------------------------------------------------
Client IP address  : 127.0.0.1
Request PathInfo  : /facbo2web/$/callback
Request Method    : POST
Request User Agent : Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36
Cookies Count      : 8
------------------------------------------------------------------------------------------------------------------------
(0002D841){Comogest_FAC_BO2Web.exe} [0042E841] System.SysUtils.Sysutils.CompareText$qqrx20System.UnicodeStringt1 (Line 6553, "System.SysUtils.pas" + 18) + $0
(0003E6BD){Comogest_FAC_BO2Web.exe} [0043F6BD] System.SysUtils.Sysutils.TMBCSEncoding.GetChars (Line 32988, "System.SysUtils.pas" + 1) + $12
(0036B415){Comogest_FAC_BO2Web.exe} [0076C415] IWApplication.TIWApplicationHelper._FindFormByName$qqrx20System.UnicodeStringo (Line 3199, "IWApplication.pas" + 7) + $25
(0036450E){Comogest_FAC_BO2Web.exe} [0076550E] IWApplication.TIWApplication.FindFormByName (Line 888, "IWApplication.pas" + 0) + $2
(003919C8){Comogest_FAC_BO2Web.exe} [007929C8] IWInit.InternalFindUserComponent$qqrx20System.UnicodeString (Line 50, "IWInit.pas" + 7) + $2
(003919E1){Comogest_FAC_BO2Web.exe} [007929E1] IWInit.IsUniqueGlobalComponentName$qqrx20System.UnicodeString (Line 62, "IWInit.pas" + 1) + $2
(000C2EB2){Comogest_FAC_BO2Web.exe} [004C3EB2] System.Classes.IsUniqueGlobalComponentName$qqrx20System.UnicodeString (Line 4212, "System.Classes.pas" + 2) + $2
(000D1BD6){Comogest_FAC_BO2Web.exe} [004D2BD6] System.Classes.FindUniqueName (Line 10960, "System.Classes.pas" + 3) + $2
(000D1CF5){Comogest_FAC_BO2Web.exe} [004D2CF5] System.Classes.TReader.ReadRootComponent (Line 10991, "System.Classes.pas" + 20) + $11
(000CD463){Comogest_FAC_BO2Web.exe} [004CE463] System.Classes.TFiler.Create (Line 9420, "System.Classes.pas" + 5) + $8
(000CB90A){Comogest_FAC_BO2Web.exe} [004CC90A] System.Classes.TStream.ReadComponent (Line 8529, "System.Classes.pas" + 3) + $5
(002D1E2B){Comogest_FAC_BO2Web.exe} [006D2E2B] IWClassesFix.InternalReadComponentRes$qqrx20System.UnicodeStringuirp25System.Classes.TComponent (Line 571, "IWClassesFix.pas" + 7) + $5
(002D1EB9){Comogest_FAC_BO2Web.exe} [006D2EB9] IWClassesFix.InitComponent (Line 587, "IWClassesFix.pas" + 4) + $23
(002D1EF8){Comogest_FAC_BO2Web.exe} [006D2EF8] IWClassesFix.InternalInitInheritedComponent$qqrp25System.Classes.TComponentp17System.TMetaClass (Line 592, "IWClassesFix.pas" + 1) + $8
(002D1F58){Comogest_FAC_BO2Web.exe} [006D2F58] IWClassesFix.TDataModuleEx.$bctr$qqrp25System.Classes.TComponent (Line 600, "IWClassesFix.pas" + 4) + $8
(00D2787B){Comogest_FAC_BO2Web.exe} [0112887B] uCarrinho.TIWCarrinho.IWAppFormCreate (Line 866, "uCarrinho.pas" + 52) + $9
(0035DCC0){Comogest_FAC_BO2Web.exe} [0075ECC0] IWBaseForm.TIWBaseForm.DoCreate (Line 462, "IWBaseForm.pas" + 3) + $8
(0035DA9B){Comogest_FAC_BO2Web.exe} [0075EA9B] IWBaseForm.TIWBaseForm.Create (Line 387, "IWBaseForm.pas" + 21) + $2
(00017DCA){Comogest_FAC_BO2Web.exe} [00418DCA] ScaleMM2.Scale_GetMem$qqri (Line 882, "ScaleMM2.pas" + 1) + $26
(00364583){Comogest_FAC_BO2Web.exe} [00765583] IWApplication.TIWApplication.ShowForm (Line 913, "IWApplication.pas" + 18) + $6
(00D3DEA4){Comogest_FAC_BO2Web.exe} [0113EEA4] uOptions.TIWOptions.BtnCarrinhoAsyncClick (Line 1117, "uOptions.pas" + 19) + $14
(0030A6E0){Comogest_FAC_BO2Web.exe} [0070B6E0] IWControl.TIWCustomControl.DoOnAsyncClick (Line 494, "IWControl.pas" + 4) + $E
(0031793B){Comogest_FAC_BO2Web.exe} [0071893B] IWCallBackFunc.TIWCallBacks.Invoke (Line 132, "IWCallBackFunc.pas" + 14) + $9
(00318B2D){Comogest_FAC_BO2Web.exe} [00719B2D] IWCallBackFunc.TIWCallBacks.PerformCallBack (Line 334, "IWCallBackFunc.pas" + 35) + $6
(00323E46){Comogest_FAC_BO2Web.exe} [00724E46] IWRenderContext.TIWPageContext40.PerformCallBack (Line 864, "IWRenderContext.pas" + 0) + $6
(00338ABF){Comogest_FAC_BO2Web.exe} [00739ABF] IWForm.TIWForm.PerformCallBack (Line 1820, "IWForm.pas" + 3) + $6
(00363ED5){Comogest_FAC_BO2Web.exe} [00764ED5] IWApplication.TIWApplication.PerformCallBack (Line 735, "IWApplication.pas" + 6) + $4
(00336FC5){Comogest_FAC_BO2Web.exe} [00737FC5] IWForm.TIWForm.DoExecuteForm (Line 1271, "IWForm.pas" + 73) + $8
(0035E12A){Comogest_FAC_BO2Web.exe} [0075F12A] IWBaseForm.TIWBaseForm.ExecuteForm (Line 570, "IWBaseForm.pas" + 9) + $5
(00366A93){Comogest_FAC_BO2Web.exe} [00767A93] IWApplication.TIWApplication.ExecuteActiveForm (Line 1671, "IWApplication.pas" + 34) + $2
(003666DD){Comogest_FAC_BO2Web.exe} [007676DD] IWApplication.TIWApplication.ProcessForm (Line 1545, "IWApplication.pas" + 9) + $7
(003A3BC3){Comogest_FAC_BO2Web.exe} [007A4BC3] IWServerSession.TIWServerSession.ExecuteCallback_ActRec._0_Body$qqrv (Line 235, "IWServerSession.pas" + 1) + $E
(003A42EC){Comogest_FAC_BO2Web.exe} [007A52EC] IWServerSession.TIWServerSession.DoExecuteAsCallback$qqr48System.%DelphiInterface$21System.Sysutils.TProc% (Line 320, "IWServerSession.pas" + 3) + $5
(003A3C26){Comogest_FAC_BO2Web.exe} [007A4C26] IWServerSession.TIWServerSession.ExecuteCallback$qqrv (Line 232, "IWServerSession.pas" + 3) + $C
(003A64C2){Comogest_FAC_BO2Web.exe} [007A74C2] IWServerSession.TIWServerSession.DoExecuteSession$qqrx20System.UnicodeStringo (Line 743, "IWServerSession.pas" + 39) + $2
(003A6D57){Comogest_FAC_BO2Web.exe} [007A7D57] IWServerSession.TIWServerSession.ExecuteSession$qqrx20System.UnicodeString (Line 873, "IWServerSession.pas" + 56) + $7
(003946E4){Comogest_FAC_BO2Web.exe} [007956E4] IWServer.TIWServer.ExecuteUrl (Line 676, "IWServer.pas" + 79) + $6
(00394C20){Comogest_FAC_BO2Web.exe} [00795C20] IWServer.TIWServer.Execute (Line 761, "IWServer.pas" + 17) + $6
(003A3387){Comogest_FAC_BO2Web.exe} [007A4387] IWServerSession.HttpExecute$qqrpuci (Line 97, "IWServerSession.pas" + 2) + $3
(00425D9E){Comogest_FAC_BO2Web.exe} [00826D9E] IW.Server.HTTPIndy.Server.Httpindy.THTTPServerIndy.DoCommandGet (Line 246, "IW.Server.HTTPIndy.pas" + 26) + $19
(00408445){Comogest_FAC_BO2Web.exe} [00809445] InCustomHTTPServer.TInCustomHTTPServer.GetSessionFromCookie (Line 1559, "InCustomHTTPServer.pas" + 30) + $10
(00407EE1){Comogest_FAC_BO2Web.exe} [00808EE1] InCustomHTTPServer.TInCustomHTTPServer.DoExecute (Line 1427, "InCustomHTTPServer.pas" + 180) + $F
(003DFB13){Comogest_FAC_BO2Web.exe} [007E0B13] InContext.TInContext.Run (Line 185, "InContext.pas" + 2) + $7
(003DE8AE){Comogest_FAC_BO2Web.exe} [007DF8AE] InTask.TInTask.DoRun (Line 136, "InTask.pas" + 0) + $2
(003F623E){Comogest_FAC_BO2Web.exe} [007F723E] InThread.TInThreadWithTask.Run (Line 626, "InThread.pas" + 1) + $3
(003F5BE9){Comogest_FAC_BO2Web.exe} [007F6BE9] InThread.TInThread.Execute (Line 378, "InThread.pas" + 43) + $5
(000DB80D){Comogest_FAC_BO2Web.exe} [004DC80D] System.Classes.ThreadProc$qqrxp22System.Classes.TThread (Line 14945, "System.Classes.pas" + 18) + $5
(0000B6E0){Comogest_FAC_BO2Web.exe} [0040C6E0] System.ThreadWrapper$qqspv (Line 24423, "System.pas" + 45) + $0

------------------------------------------------------------------------------------------------------------------------

On the 2nd form, to close it, I'm calling Release method and the main form is shown again. I think I don't need to do anything else


Any idea, Alexandre, or anyone else?
Thanks

Running the debugger, it is stoping at TReader.ReadRootComponent at line 11030.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)