Queued event may be sent multiple times
Closed this issue · 1 comments
jirenius commented
Issue
If a subscription queues an events (change
or add
) which introduces a resource reference to a resource that is loaded but not yet sent, the event may be sent multiple times.
How to recreate
Assume we have the following resources:
test.a
- a simple modeltest.b
- a simple modeltest.collection
- an empty collectiontest.model
- contains reference totest.a
andtest.b
.
- Client sends request:
get.test.model
- Resgate sends NATS request:
get.test.model
- Resgate sends NATS requests:
get.test.a
andget.test.b
- Service responds to
get.test.a
(but notget.test.b
), makingtest.a
loaded but not sent to client. - Service sends
event.test.collection.add
event, addingtest.b
reference, causingtest.collection
to start queuing events. - Service sends
event.test.collection.add
event, addingtest.a
reference. - Service responds to
get.test.b
request. - Resgate faultily sends the
event.test.collection.add
event fortest.a
two times to client, corrupting the state of the client.
Impact
The bug has no security impact, and low impact on usage as it only affects a rare corner case. There are no reported occurrences in production or development environments.
In case the bug is encountered, the client will get a corrupted state not matching that of the service.