Hi James,

Can you confirm which version of the code you're looking at?  (trunk?  
revision?)

In addition, I would also have thought all the variables in that method are 
local to the session too ... is there any chance you've shared the session 
across more than one thread?

It would be great if you could reproduce this in a test case, but I realise the 
difficulties of trying to create test cases for multi-threaded scenarios.

Cheers,
    Richard

  From: James Crowley 
  Sent: Friday, April 23, 2010 1:09 PM
  To: [email protected] ; [email protected] 
  Subject: [nhusers] Thread safety problem in 
QueryParameters.PrepareParameterTypes ?


  Hi guys,


  Are you aware of a threading issue within 
QueryParameters.PrepareParameterTypes? I've got two threads (operating over 
different sessions) that, when run starting from the same execution point at 
the start of the PrepareParameterTypes method. All works fine when the other 
thread is frozen, but when both are run at the same time, there are issues with 
the parameter locations.


  It's something to do with here:


  while ((location < sqlParameters.Count) && 
(sqlParameters[location].ParameterPosition != null))
  location++;


  in that this can actually result in location being equal to 
sqlParameters.Count (and later having an IndexOutOfRange exception being 
thrown). However, it's only happening because ParameterPosition is unexpectedly 
set. Still trying to figure out how, as all I can see are local variables right 
now.


  I'm still trying to pin this down exactly, but wanted to check if you were 
already aware of not?


  Thanks,


  James



  -- 
  You received this message because you are subscribed to the Google Groups 
"nhusers" group.
  To post to this group, send email to [email protected].
  To unsubscribe from this group, send email to 
[email protected].
  For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to