Skip to content
DataMiner DoJo

More results...

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Search in posts
Search in pages
Search in posts
Search in pages
Log in
Menu
  • Updates & Insights
  • Questions
  • Learning
    • E-learning Courses
    • Empower Replay: Limited Edition
    • Tutorials
    • Open Classroom Training
    • Certification
      • DataMiner Fundamentals
      • DataMiner Configurator
      • DataMiner Automation
      • Scripts & Connectors Developer: HTTP Basics
      • Scripts & Connectors Developer: SNMP Basics
      • Visual Overview – Level 1
      • Verify a certificate
    • Video Library
    • Books We Like
    • >> Go to DataMiner Docs
  • Expert Center
    • Solutions & Use Cases
      • Solutions
      • Use Case Library
    • Markets & Industries
      • Media production
      • Government & defense
      • Content distribution
      • Service providers
      • Partners
      • OSS/BSS
    • Agile
      • Agile Webspace
      • Everything Agile
        • The Agile Manifesto
        • Best Practices
        • Retro Recipes
      • Methodologies
        • The Scrum Framework
        • Kanban
        • Extreme Programming
      • Roles
        • The Product Owner
        • The Agile Coach
        • The Quality & UX Coach (QX)
    • DataMiner DevOps Professional Program
      • About the DevOps Program
      • DataMiner DevOps Support
  • Downloads
  • More
    • DataMiner Releases & Updates
    • Feature Suggestions
    • Climb the leaderboard!
    • Swag Shop
    • Contact
    • Global Feedback Survey
  • PARTNERS
    • All Partners
    • Technology Partners
    • Strategic Partner Program
    • Deal Registration
  • >> Go to dataminer.services

Booking Manager Custom Events Element Lock

Solved427 views11th October 2024Element Lock Race Condition SRM SRM Booking Manager
2
Richard Coulson [DevOps Member]284 10th October 2024 0 Comments

Hello,

I am running into a race condition when triggering multiple simultaneous automations from SRM booking manager custom events.

When a booking event fires it launches a script which then triggers a subscript that should lockout the dummies defined in the subscript. See below:

var subscript = engine.PrepareSubScript("MakeSplice");
subscript.SelectDummy("Source", source);
subscript.SelectDummy("Destination", destination);
subscript.LockElements = true;
subscript.WaitWhenLocked = true;
subscript.Synchronous = true;
subscript.StartScript();

If I trigger the multiple scripts manually I can see the first subscript locks the element, and the following subscripts wait for the first to unlock before proceeding, as I would expect. However, when the booking manager triggers the same scripts they do not queue properly. Although the first script to fire locks the element, it does not prevent competing scripts from making changes on the same element.

Is this expected behaviour or a bug? Is there some other way I can enforce the element lock when triggering scripts from the booking manager?

Marieke Goethals [SLC] [DevOps Catalyst] Selected answer as best 11th October 2024

2 Answers

  • Active
  • Voted
  • Newest
  • Oldest
2
Gelber Mahecha [SLC] [DevOps Enabler]1.62K Posted 10th October 2024 0 Comments

Hi Richard,

Instead of relying on the LockElements subscript property, I suggest using a named Mutex object to enforce non-concurrent script execution.  To do so, define a static object as a field of the Script Class:

private static Mutex mutex= new Mutex(false, "MyScriptMutexObject");

Now, in the Run method (or at any other place in code that you want to ensure won't be concurrently executed), use a try/finally statement to acquire and release the Mutex object:

try {

mutex.WaitOne();

// Non-concurrent code here

}

finally {

mutex.ReleaseMutex();

}

Be aware that using WaitOne with no arguments will block the thread indefinitely, which could lead to a cascade of failed script executions in case one of them acquired the mutex but couldn't complete it during the script's timeout. You may want to use the version with a timeout ( mute.WaitOne(TimeSpan.FromSeconds(30), false)) so that subsequent executions will have the opportunity to gracefully complete, logging the detected lock condition.

Marieke Goethals [SLC] [DevOps Catalyst] Selected answer as best 11th October 2024
You are viewing 1 out of 2 answers, click here to view all answers.
Please login to be able to comment or post an answer.

My DevOps rank

DevOps Members get more insights on their profile page.

My user earnings

0 Dojo credits

Spend your credits in our swag shop.

0 Reputation points

Boost your reputation, climb the leaderboard.

Promo banner DataMiner DevOps Professiona Program
DataMiner Integration Studio (DIS)
Empower Katas
Privacy Policy • Terms & Conditions • Contact

© 2025 Skyline Communications. All rights reserved.

DOJO Q&A widget

Can't find what you need?

? Explore the Q&A DataMiner Docs

[ Placeholder content for popup link ] WordPress Download Manager - Best Download Management Plugin