6

Scenario:

2 x front-end load balanced servers (round robin) Both running the same DD4T MVC application Single delivery DB behind some services that abstract the Tridion2011SP1Provider.

Symptoms:

Intermittent 100% CPU usage when accessing Model.Fields[id] which ends up crashing the W3WP process.

Diagnostics done:

Debugdiag stack trace points to a non-terminating thread calling the .ContainsKey method and a race-condition in the IDictionary type that IFieldSet abstracts.

Question:

Is this a common scenario to be expected in a load balanced scenario? Are there any obvious workarounds (other than locking on multiple reads?) - I'm thinking .TryGetValue, or implementing a custom dictionary that is thread-safe, for example ConcurrentDictionary?

3
  • Can you tell a bit more why and where (service, web app) you think a race condition occurs? If you have two different AppDomains (2 IIS pools on 2 servers), then they should not interfere with each other. So, I think that you can rule that out, unless your service somehow blocks. If this happens in the service, then yes you will need to have threadsafe dictionaries, but without more information and code, this is hard to say.
    – Raimond
    Mar 1, 2014 at 11:57
  • It's not clear from your question whether you used a debug build for your debugdiag session. If not, perhaps doing so would yield more information. Mar 2, 2014 at 7:16
  • Sounds to me like moving to ConcurrentDictionary is a good plan anyhow. I put it on the DD4T issue list (code.google.com/p/dynamic-delivery-4-tridion/issues/…).
    – Quirijn
    Mar 3, 2014 at 10:20

1 Answer 1

0

this is common issue when we are using HashMap (HashSet) simultaneously with different threads, the code base should use concurrent versions of these structures

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.