theia-ide / sprotty

A next-gen web-based graphics framework
Apache License 2.0
138 stars 23 forks source link

[server] Revise server-side smodel synch #171

Closed JanKoehnlein closed 7 years ago

JanKoehnlein commented 7 years ago

With 277d385c1f60054db9f16bad3cac348647404267 I introduced a revision number to make sure ComputedBoundsActions are not applied to a different (later) version of the model. This race could happen on the server when DefaultDiagramServer#updateModel() was called between the sending RequestBoundsAction and the arrival of the associated CBA.

The resulting sync also involves a lock and looks a bit dangerous.

An better solution could be to send the entire model instead of just bounds updates in the CBA, and not set the currentModel on the server before the arrival of the CBA and the application of the layout.

spoenemann commented 7 years ago

I think the solution with synchronize is ok and makes sense. We should just make sure the lock is not held longer than necessary. Calling other services such as the layout engine or listeners while holding the lock can be dangerous (deadlocks!).

JanKoehnlein commented 7 years ago

Done