question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[v3.1.0] RulesEngine does not update the compiled rules atomically.

See original GitHub issue

Starting this thread to discuss the synchronization issue due to the compiled rule not updated atomically.

Current Workaround

We need to perform:

  1. RulesEngine.RemoveWorkflow(string workflowName) and
  2. RulesEngine.AddWorkflow(WorkflowRules[] workflowRules) in sequence to clear the compiled rules (_compileRules) in RulesCache.cs.
  3. The compiled rules are then refreshed when we call RulesEngine.ExecuteAllRulesAsync(string workflowName, params RuleParameter[] ruleParams)(see [1], [2], [3]).

Synchronization Issue

Caller needs to synchronize the incoming requests for a worflow name by SemaphoreSlim lock (or equivalent) when they need to execute rules via the above three operations otherwise workflow rules may not be executed say if one of the requests is trying to ExecuteAllRulesAsync while the other request is RulesEngine.RemoveWorkflow.

Proposed

Provide an atomic way to update the (_compileRules) in RulesCache.cs by a new method RulesEngine.AddOrUpdateWorkflowRules(WorkflowRules[] workflowRules, params Type[] type) .

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
abbasc52commented, Jun 8, 2021

this has been fixed in v3.2.0

1reaction
abbasc52commented, Jun 7, 2021

We don’t have any strict cadence, as for this new change, we should be good to release by 9th or 10th June

Read more comments on GitHub >

github_iconTop Results From Across the Web

CHANGELOG.md - microsoft/RulesEngine
Cache system added so that rules compilation is stored and thus made more efficient. Fix. Concurrency issue which arose by dictionary was resolved....
Read more >
Highest scored 'drools' questions
I understand that Drools is Open Source and JESS is not, but how do they compare in ... 3 answers ... Expert/Rule Engine...
Read more >
microsoft/RulesEngine: A Json based Rules Engine ...
Here, workflow is a list of deserialized objects based on the schema explained above Once initialised, the Rules Engine needs to execute the...
Read more >
Drools Documentation
Drools is a business rule management system with a forward-chaining and backward-chaining inference based rules engine, allowing fast and reliable evaluation of ...
Read more >
Drools Documentation - Red Hat on GitHub
You may use drools-compiler to produce rule packages "out of process", and then deploy them to a runtime system. This runtime system only...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found