RuleWorld / bionetgen

Rule-based modeling framework
https://bionetgen.org/
MIT License
59 stars 25 forks source link

Circular function definitions create infinite loop #217

Open jrfaeder opened 4 years ago

jrfaeder commented 4 years ago

BioNetGen allows both parameters and functions to be defined with reference to parameters and functions that are defined later, and it attempts to resolve these dependencies either after reading the block (parameters) or at run time (functions). The latter is problematic because rather than detecting circular definitions it generates an infinite recursive loop that causes BNG to hang. When this occurs within RuleBender, the resulting process can consume all available memory and cause a system crash. Here's a simple model that demonstrates the problem:

begin functions
  g f()
  f g()
end functions
begin reaction rules
  0-> A() f
end reaction rules
generate_network()