Replies: 3 comments 4 replies
-
Thanks @ndr-brt for a great write-up. Let me look through the issues you outlined and I'll get back with responses ASAP. |
Beta Was this translation helpful? Give feedback.
-
Another issue, we miss idempotency, e.g. when a provider confirms a negotiation 2 times, the consumer should not respond with a 500 but should assert "well, I already confirmed it, no problem with that". This was reported in #545 |
Beta Was this translation helpful? Give feedback.
-
Thanks for your review. I assume these issues arise the complexity of the code and would like opportunity to point out another discussion, I opened some time ago, where I'm making a suggestion how we could reduce the complexity there. Dominik Pinsel dominik.pinsel@daimler.com, Daimler TSS GmbH, legal info/Impressum |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
In the last days some bugs and issues popped up regarding the state machines (
TransferProcessManager
and*ContractNegotiationManager
).Seems like we haven't defined a clear pattern for the state machines and that is causing (potential) problems.
The state is not always updated
Problem
There are some methods that fetch entities with
nextfForState
and then they do not always update the state.This could lead to situations where there are are more than
batchSize
entities in the same state and they are not updated, in that case no other entities will be processed causing them to stale. (problem mentioned here #393 )Solution
Every time an entity is fetched to be processed, its state should be updated, to make sure that every entity could receive enough attention.
The state is not moved to an "not to be processed" state before executing an async operation
Problem
This is the problem described here: #538 . When an entity is fetched from the
nextForState
and an async operation is called, it should be set in a state that's not fetched by the state machine loop, otherwise that can cause useless loops (as described in the issue)Solution
Define 3 type of states:
nextForState
, processed and moved to a processing state (async operation), to another to be processed state (sync operation) or to a final state (nothing else should be done)nextForState
.COMPLETED
,ENDED
,ERROR
, ...The state is updated without fetching the entity again after an asynchronous operation
Problem
Sometimes, after an async call result evaluation (inside the
whenComplete
block), the state is updated and the entity saved to the store, but using the entity that was fetched fromnextForState
, this could lead to problems if in the meantime another async operation happens (e.g. a message is received from a peer)Solution
After an async operation the entity should be fetched again before being updated and stored.
nextForState
does not scale wellProblem
Reading entities to be processed by their state could lead to poor performances:
batchSize
there'll be too many queries for a single loop iteration (useless database load)batchSize
there'll be too much time from processing a state to processing another one(issue TransferProcessManager only acts on 5 transfers #393)
Solution
Do only one fetch for every loop iteration that reads the older entities in any "to be processed" state in a single batch and process them in a way described by their state.
There are actions that don't follow the loop order
Problem
There are interface methods that permit the modification of the entities outside the state machine/command queue loop (e.g.
confirmed
inConsumerContractNegotiationManager
). This could lead to errors in the case where that entity is already leased by another thread.Solution
Every operation on the entities should be executed by the loop. Every of those method should create and enqueue a command that will be executed in the loop.
I'd like to gather some impressions by everyone to eventually open some issues.
Beta Was this translation helpful? Give feedback.
All reactions