sempr-tk / sempr

SEMPR - Semantic Environment Mapping, Processing and Reasoning
BSD 3-Clause "New" or "Revised" License
7 stars 1 forks source link

Module specific data -- "race" condition #35

Open niniemann opened 6 years ago

niniemann commented 6 years ago

Situation

Some modules need to persist data. That's one reason why the PredefinedID exists: Allow a module to give it a never changing, known name.

Problem

When loading all entities and emitting their loaded() events, it may occur that an entity is to be processed by the module before its own specific entity is loaded() (and known to e.g. to the ActiveObjectStore). The module queries for its data, gets nothing in return, and thus creates a new entity with the same name. Which crashes when persisting it. --> The order in which objects are loaded matters.

Solution

I don't know. Maybe allow modules to be persisted in general? Or add an initialization step that can be used to load the necessary entities first?

niniemann commented 5 years ago

One workaround could be to not persist data computed by processing modules. Use temporary entities instead.