-
-
Notifications
You must be signed in to change notification settings - Fork 44
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 error in chatroom after leaving a group #1718
Fix error in chatroom after leaving a group #1718
Conversation
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.
Review ready!
7cb122e
to
4623096
Compare
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.
@taoeffect, seems ready for your review.
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.
Preliminary review ready
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.
Merge conflicts + continuing questions about operator
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.
OK, interesting. This PR implements the same strategy as the comment you left on Slack, and I believe it has the same issue as what I mentioned - namely that by removing the sideEffect
we now no longer leave the group on the 2nd device.
However I found additional issues in the PR while following the steps here.
In [Tab1] this happens after u1 leaves the group: (EDIT: I think Ricardo & I just fixed this in a recent PR that was merged to e2e-protocol
!)
In [Tab2] u1 remains in the group and this appears in the console:
Since both you and @corrideat are working on this same thing, and since @corrideat is also very deep in the details of what is going on here, I'm going to ask him to have a look at this issue and see if he can address it fully, so don't worry about updating this PR.
This change in this PR fixes the error of leaving group when there are several devices that user signed in on. |
I don't think these errors are related to this Issue #1718 (anything related to chatroom or leaving group). |
@Silver-IT I've reviewed this PR and, while it looks like it'd work, I see a couple of issues:
I've made a fix that addresses this in a different way; mostly keeping things as they are but adding a new hook to avoid duplicate messages. It also avoids sending the leaveChatRoom action when leaving a group. See commit 3b1987e. |
Closing in favor of #1779 |
Actions sending other actions is fine when it happens for the same contract. Actions sending other actions for a different contract is problematic because it can lead to an inconsistent state or a deadlock, since now you have multiple contracts to take care of.
I guess you mean that you avoid
Apart from avoiding cross-contract issues by using a side-effect You had:
Suppose that a client for some reason leaves the group but the If you see, I'm checking before making the action as well. However, you're right that making the call multiple times is not ideal. I think, ideally, we could have some kind of key to check whether that action is queued or not (although, this is something that should be benchmarked, the answer may not be obvious).
Small correction,
I mean that this issue shows that where checks are done and how they are done can affect (and break) the application in ways that are non-obvious and that avoiding this as much as possible by being consistent is a good way to avoid it. Right now, we have: Actions in controllersThese define outgoing operations and do not affect the state Action processorsThese define changes to the state Action side effectsThese define actions / changes to a different state (e.g., the UI, another contract (indirectly), etc.) IMHO, sending a OTOH, actions in controllers could work, but they should not be used for ensuring state correctness. I know that this is already done in some places, and I think we should get rid of this as much as possible.
|
In my solution, it's avoided. The
Correct. I think it's what you called TotallyI have some agreement in your solution and also have some opinions either. What I would like to say at this moment, is that we should avoid making actions that sending several actions inside of it. But now, we don't have right solution about it and we have many actions that are working that way. I think we should discuss more and find the proper solution for all of them and start working on it. IMHO, I prefer to merge this PR, instead of the last commits for preSendHook and things related. |
Upon closer inspection, it doesn't seem like it'd cause a deadlock
is safe if
I think that this is something we need to avoid.
I still think that a side-effect here is a better approach to maintain state consistency. I'm still reviewing #1728. |
To recap, it seems like we have two main ways of handling this:
They are both a way of ensuring that the duplicate leave action doesn't happen. Personally, I think that this belongs into a side-effect because it's more resilient to errors or omissions. However, what you propose could also work. |
From what I've read about the discussion above, and from discussions with @corrideat on a call, here's what I've been able to discern:
That is a very unlikely situation, and another way to ensure that that the Either way - thanks to One more thing: it was my fault for not noticing sooner that both of you were working on the same issues. If I had noticed, I would have asked @Silver-IT not to work on those issues, because they are touching on low-level changes that @corrideat is also working on. My mistake. Now that we have already merged @corrideat's PR, I think to not lose time we should just move forward with the decision we've made, because ultimately it doesn't make much of a difference whether the actions happen in the sideEffect or the |
@taoeffect, I don't think these issues(#1766, #1645) are related to the low-level changes. And #1716 Also, I have already fixed them in PR #1728, so I don't think we would lose time to fix them. |
That link is broken but I think you're referring to this:
I'll let @corrideat respond to that.
From what I remember from speaking with @corrideat, there are still issues with PR #1728 and involve lower level fixes to address. See his comment here: |
I am pretty sure that this PR is much stable than any other branches which are branched off of the the So, two things are remaining at the moment, I think.
Nothing is related to the contract process, sideEffect functions. I think the best solution to fix the first stuff (Unstable login process) is to add two actions; |
@Silver-IT I'm responding to individual comments here, and there is an overall response at the bottom.
That's a good point. I can see the potential for a race condition happening here. It depends on how things are being scheduled, and something that I'll look into.
It could very well be, but it still doesn't work in various leaving / re-joining scenarios.
Correct.
Correct.
That's correct, there are some further issues. Please see my response below.
Sorry, this is something that has been lost in the background. Although I'm not entirely sure that these actions fix all of the issues we have regarding the login, I agree that this is probably a better way than the current login state-based approach. I also feel that for the issues it doesn't solve, it'd make it at least easier to troubleshoot. For this, I too would like this implemented. General responseWe've been having a lot of back and forth regarding these issues, and I concur that there are some unhandled situations in the login process that must be handled, as well as re. leaving and joining. It's been unfortunate that, in addition to the issues we were already facing, I made some changes to It's also been unfortunate that we've been working in parallel on the same issues, because that's time and effort that could've gone into other things. Therefore, I think that from now on we should coördinate to avoid this situation. I'm sorry on my part that communication on this hasn't been as fluid as it could've been, and that I didn't catch this sooner. Since there are some remaining issues, I propose we do as follows:
How does that sound? |
@corrideat, I have been working in debugging and fixing login issues in the PR #1728. Having checked the console very carefully, I can say that it is currently working well as I expected, no more redundant process it is making anymore. The main problem is the login process, especially managing If we implement |
Summary of Changes