OutOfBoundsException in Web 1

Hello,

Has anyone ever had an “Unhandled OutOfBoundsException” error with the web 1 framework (Xojo 2019 3.2) under obscure circumstances?

This error comes with “RuntimeLockUnlockObjects”. What does it mean?

I never see this error when I run my project from the IDE in debug. But it happens in production when the project is compiled and run on my server (Standalone, Apache, Windows server).

This error is then displayed in the browser, but I remember that Greg said that it was not a Javascript error but that it was an unhandled error in the Xojo code.

However, I don’t use an array in my code when this error is triggered (unfortunately the error is not systematically triggered, it is rarely triggered, I can’t figure out under which circumstances).

  • My app is 100% custom controls (WebControlWrapper).

  • The error seems to occur more often since I build the app in 64 bits.

  • Looking deeper into where I might use arrays at the time the error is triggered, I see that the “WEtitre” control is part of an array of webControlWrapper controls, but these controls are all present as soon as the app is launched in the browser and are often already in use without issue before the error is triggered. The only other place where an array index is used is in the webControlWrapper’s “SetupCSS” event handler: styles(0).Value("z-index")="1"

Stack:
RuntimeRaiseException
RaiseOutOfBoundsException
RuntimeLockUnlockObjects
fenAction.F125action%%o<fenAction>A1v
pgMaster.pgMaster.WEtitre_click%%o<pgMaster.pgMaster>o<WEclasseTitre>A1v
Delegate.IM_Invoke%%o<WEclasseTitre>A1v
AddHandler.Stub.37%%A1v
WEclasseTitre.Event_ExecuteEvent%b%o<WEclasseTitre>sA1v
WebControlWrapper._ExecuteEvent%b%o<WebControlWrapper>sA1v
WebControl.!_ExecuteEvent%b%ssA1v
WebSession._HandleEvent%%o<WebSession>so<_HTTPServer.HTTPRequestContext>
WebSession._HandleRequest%i8%o<WebSession>so<_HTTPServer.HTTPRequestContext>
WebApplication._HandleHTTPRequest%%o<WebApplication>o<_HTTPServer.HTTPRequestContext>
_HTTPServer.HTTPRequestThread.Event_Run%%o<_HTTPServer.HTTPRequestThread>```

What code do you have in fenAction.Action?

1 Like

Thanks Greg!!

For example, the client edits a price in the browser’s web app. My javascript code then calls the server via a Xojo.triggerServerEvent.

FenAction.action is then called in my Xojo code via the webControlWrapper click event.

FenAction.action receives the parameter “p() As Variant”, which contains the parameters sent from the client side by the Xojo.triggerServerEvent.

In FenAction.action, the first parameter of p() contains the number of the action to do. The other parameters are relative to the action (e.g. id of the article to update, price…).

For example, the code of fenAction.action :

dim nbPar As integer=p.Ubound+1

if nbPar>0 then
  
  dim numFct As integer = p(0)
  
  select case numFct
    
  case 1 
    
    if nbPar>2 and art.updatePrice(p(1), div.retEncode(p(2)), paramJv, a_db, self)=1 then
      
      self.ExecuteJavaScript("require(['pg125'], function(pg125) {" _
      +"pg125.updatePrice("+paramJv+");"+"});")
      
    end
    
  case 2 
    
    //.......
    
  end
  
  
end

And the art.updatePrice method makes calls to the database to check the validity of the article id and price, updates the price, and returns the validated price or an error number via the “ParamJv” parameter that is returned to the browser.

I would check and make sure that nbPar is correct in every case.

2 Likes

yes, that’s what I thought too, I’ll check everything, I hope it’s that! Thanks a lot Greg!

1 Like