Tuesday, December 11, 2012

Web Apps, WebSessions and Threads, Oh My!

During the 2012r2 beta cycle a bug was reported regarding data bleed between WebSessions but were unable to reproduce it internally. We've been looking into the issue today as we finally have an example project that reliably reproduces the problem. If you see this behavior in your project, please be aware this bug:

  • Only appears to happen on the default page
  • Only happens if you're using a tight-loop or thread with a low sleep period
  • Any data that has been entered by a user in one session will appear in the same fields on another browser.

What you can do about it

If you're using a thread or a loop, set a sufficiently large sleep period. Unfortunately the low threshold seems to be somewhat dependent on the speed of the hardware you are running on, so you may need to do some experiments.


What we're doing about it

We're working diligently on isolating and fixing this bug. Our plan is to have a new beta out with this and a few other minor fixes soon.

3 comments:

Gerard said...


in 2012r2 I saw a NilObjectexeption for session even after I had explicitly had this code at the top of a method

if Session = nil then Return
if Session.Available = false then Return


... some sql to get a recordSet

if Session.db.errormessage <> "" then // <- Here I got a NilObjectExc

now do a tight loop across the RecordSet

I was running under the IDEdebugger, and got the NilObjEx on the line as indicated above.

The session appeared to became null on the line Session.db
The db wasn't null.
The session variable/call did recover because as I CONTNUED and looped over the REcordSet,
the session variable became non-nil again and I could get the db information out and onto the screen.



"If you're using a thread or a loop, set a sufficiently large sleep period. "
So, how do I set the sleep value?

Tobias Bußmann said...

I think the possibly long and threaded DB calls are the issue here. This is could be a case where storing a local reference to the session could help. Try to add Dim Session As Session = Session at the top of the method.

Greg O'Lone said...

@Gerard

If you're in a loop:

While not RS.EOF
...do some stuff...
App.CurrentThread.Sleep(100) //This value
Wend