-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix initialization ordering issue #5219
Conversation
TradeManager must be inited before MailboxMessageService
@chimp1984 Could you please have a quick look at these changes, just to be sure we are not missing any hidden sideffect that the original order should have prevented. Thanks! |
I also experienced non-reproducable issues with MailboxMessages in the TraderChat. They are stuck in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK
I tested just that use case and it fixes the problem.
The underlying problem is that the order how listeners are registered and the domains are initialized is not sufficiently clearly organized.
SupportManager registers its listener in the constructor, others in onAllServicesInitialized.
Listener are moslty held in HashSets, so the order of execution is not related to the order how they get added, which is semantically correct as listeners should not rely on order of execution, but as we see the domains would require more precise order.
It would require a larger refactoring to get those processes better defined.
I think the suggested fix carries probably low risk but all main use cases specially those involving mailbox messages should be tested well.
The decryptedMailboxMessageWithPubKeys and decryptedDirectMessageWithPubKeys in SupportManager are remaining TODOs from the past mailbox message refactoring efforts. We hold already the data in the MailboxMessageService and should rather use that as our data owner, instead of the way how we listen and keep track of the mailboxMessages in SupportManager. That would be more in line with other use cases and more clear. But all changes in that area carry quite some risk and complexity...
Upon receipt of onAllServicesInitialized, TraderChatManager should call tryApplyMessages in order to process any pending mailbox messages stored up while offline.
Further to @ripcurlx comment about trader chat messages, there was an issue where trader chat messages were not propagated to the GUI upon startup if a password protected wallet was used. TraderChatManager was not processing mailbox messages when initialized via |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK - tested quite a bit with mailbox messages during trading, chat and mediation and everything worked so far for me. I wasn't able to re-produce my chat mailbox issues with this PR until now. I'll keep an eye for this while continuing release testing, but I think this is save to be merged.
Fixes #5210
TradeManager must be inited before MailboxMessageService. Fixes two NPE scenarios described in #5210
Scenario 1. Start up with a Mailbox message queued for delivery to DisputeManager
Trade -> processModel -> provider
as the TradeManager has not yet been initialized viainitPersistedTrades
.Scenario 2. Start up with a password protected wallet.
DomainInitialisation::initDomainServices()
is used. It needs to calltradeManager.onAllServicesInitialized()
beforearbitrationManager / mediationManager / refundManager
are started.