convergencelabs / convergence-project

The project used for Convergence Project Management and Issue Reporting
https://convergence.io
42 stars 5 forks source link

Deleting the collection of an open model creates an error condition #226

Open mmacfadden opened 3 years ago

mmacfadden commented 3 years ago

Versions

Describe the Bug When a collection is deleted all of its open models are deleted in the database. However, if a model in that collection is open, the RealTimeModelActor is not notified and does not know that it's underlying data has been deleted. This can lead to a number of hard to diagnose exceptions when the model is interacted with. for example if a new user tries to open the model it will fail with a persistence error saying Unable to get the valueIdPrefix for the model.

Step To Reproduce

  1. Create a realtime model in the test collection.
  2. Open the model in the admin console.
  3. In another browser tab, delete the test collection
  4. Try to edit the model.

Expected Behavior RealTimeModels should be notified when their containing collection is deleted and be closed down. An appropriate cause should be sent to the user.

mmacfadden commented 3 years ago

An example exception that can be produced if trying to open a model that is presently open by another session but deleted:

Unable to get the valueIdPrefix for the model
com.convergencelabs.convergence.server.backend.datastore.EntityNotFoundException: 
    at com.convergencelabs.convergence.server.backend.datastore.OrientDBUtil$.assertOneDoc(OrientDBUtil.scala:325) ~[classes/:?]
    at com.convergencelabs.convergence.server.backend.datastore.OrientDBUtil$.$anonfun$singleResultCommand$1(OrientDBUtil.scala:59) ~[classes/:?]
    at scala.util.Success.flatMap(Try.scala:258) ~[scala-library-2.13.5.jar:?]
    at com.convergencelabs.convergence.server.backend.datastore.OrientDBUtil$.singleResultCommand(OrientDBUtil.scala:59) ~[classes/:?]
    at com.convergencelabs.convergence.server.backend.datastore.domain.model.ModelStore.$anonfun$getAndIncrementNextValuePrefix$1(ModelStore.scala:181) ~[classes/:?]
    at com.convergencelabs.convergence.server.backend.db.PooledDatabaseProvider.$anonfun$withDatabase$3(PooledDatabaseProvider.scala:58) ~[classes/:?]
    at com.convergencelabs.convergence.server.util.TryWithResource.tryWithResolvedResource(TryWithResource.scala:50) ~[classes/:?]
    at com.convergencelabs.convergence.server.util.TryWithResource.com$convergencelabs$convergence$server$util$TryWithResource$$tryWithResource(TryWithResource.scala:36) ~[classes/:?]
    at com.convergencelabs.convergence.server.util.TryWithResource$.apply(TryWithResource.scala:78) ~[classes/:?]
    at com.convergencelabs.convergence.server.backend.db.PooledDatabaseProvider.$anonfun$withDatabase$1(PooledDatabaseProvider.scala:56) ~[classes/:?]
    at scala.util.Success.flatMap(Try.scala:258) ~[scala-library-2.13.5.jar:?]
    at com.convergencelabs.convergence.server.backend.db.PooledDatabaseProvider.withDatabase(PooledDatabaseProvider.scala:55) ~[classes/:?]
    at com.convergencelabs.convergence.server.backend.datastore.AbstractDatabasePersistence.withDb(AbstractDatabasePersistence.scala:32) ~[classes/:?]
    at com.convergencelabs.convergence.server.backend.datastore.domain.model.ModelStore.getAndIncrementNextValuePrefix(ModelStore.scala:178) ~[classes/:?]
    at com.convergencelabs.convergence.server.backend.services.domain.model.RealtimeModelManager.respondToClientOpenRequest(RealtimeModelManager.scala:476) [classes/:?]
    at com.convergencelabs.convergence.server.backend.services.domain.model.RealtimeModelManager.onOpenModelWhileInitialized(RealtimeModelManager.scala:466) [classes/:?]
    at com.convergencelabs.convergence.server.backend.services.domain.model.RealtimeModelManager.onOpenRealtimeModelRequest(RealtimeModelManager.scala:162)