Skip to content
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: Improve message sender / handler robustness in resync scenarios #13733

Merged
merged 21 commits into from
May 19, 2022

Conversation

TatuLund
Copy link
Contributor

@TatuLund TatuLund commented May 11, 2022

Process resync messages via normal message queue and use semaphor to protect resync process (i.e. do not allow other messages while performing resync)

This PR is adopted from similar fixes for Vaadin 8

vaadin/framework#11791
vaadin/framework#12043
vaadin/framework#12178

This is alternative and possibly more comprehensive fix than

#13727

Fixes #13726

@github-actions
Copy link

github-actions bot commented May 11, 2022

Unit Test Results

   965 files  +  24     965 suites  +24   45m 16s ⏱️ + 2m 45s
6 274 tests +158  6 226 ✔️ +159  48 💤 ±0  0 ±0 
6 497 runs  +156  6 443 ✔️ +157  54 💤 ±0  0 ±0 

Results for commit 7d98249. ± Comparison against base commit 6a5710d.

♻️ This comment has been updated with latest results.

@pepijnve
Copy link
Contributor

@TatuLund could you have a look at the changes I made in #13727 as well? I think a variant of that might still be useful. forceMessageHandling still calls RequestResponseTracker#endRequest which may already call MessageSender#sendInvocationsToServer. If that happens the later call to MessageSender#resynchronize will set the flag, but this will not actually get sent since a request may already be in progress. It might be a good idea to set the resynchronizeRequested first before triggering endRequest.

@TatuLund
Copy link
Contributor Author

@pepijnve Yes, I had overlooked that part.

@pepijnve
Copy link
Contributor

pepijnve commented May 12, 2022

@TatuLund for my own local testing I've adapted my earlier PR in https://github.com/datadobi/flow/tree/fix13726
Just FYI; feel free to use or implement differently as you see fit.

@mshabarov
Copy link
Contributor

How did you test this patch? Could we use the approach suggested here #13726 (comment) to make an IT test?

@mshabarov mshabarov requested a review from Artur- May 17, 2022 11:13
@pepijnve
Copy link
Contributor

pepijnve commented May 17, 2022

The issue from this ticket is still reproducible with this patch, but we didn't expect it to be resolved 100% thought. Since the patch was proven with the legacy framework, I'll propose to apply it.

@mshabarov there's a further patch to forceMessageHandling that I referenced earlier that I believe would solve this. Could this also be applied since this was the actual issue that Datadobi reported and fixed initially? It would be a shame if this PR, which was meant to supersede my own one, doesn't actually fix the real problem of resync not working reliably.

See 46ebd66

Copy link
Contributor

@mshabarov mshabarov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @pepijnve , I'll have a look how we can combine these two solutions.

@pepijnve
Copy link
Contributor

pepijnve commented May 17, 2022

I've rebased https://github.com/datadobi/flow/tree/fix13726 on this PR branch for you. It's one followup commit to Tatu's earlier work. The essence of this commit is that in forceMessageHandling the desire to resynchronise is registered before calling endRequest. If this is not done, endRequest may end up sending out a request itself and that then causes the resynchronize request to fail because a request is already in flight. You end up throwing an IllegalStateException at com/vaadin/client/communication/RequestResponseTracker.java:66.

@mshabarov
Copy link
Contributor

mshabarov commented May 18, 2022

@pepijnve thanks a lot for rebasing your changes. I've applied your patch to the current branch, it looks good.

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@mshabarov mshabarov dismissed Artur-’s stale review May 19, 2022 06:22

Artur's comments have been covered.

@mshabarov mshabarov merged commit 358ae99 into master May 19, 2022
@mshabarov mshabarov deleted the fix13726 branch May 19, 2022 06:29
vaadin-bot pushed a commit that referenced this pull request May 19, 2022
…13733)

Process re-sync messages via normal message queue and use semaphore to protect re-sync process (i.e. do not allow other messages while performing re-sync).

This PR is adopted from similar fixes for Vaadin 8.

vaadin/framework#11791
vaadin/framework#12043
vaadin/framework#12178

This also changes the method `forceMessageHandling` in a way that the desire to resynchronise is registered before calling `endRequest`. If this is not done, `endRequest` may end up sending out a request itself and that then causes the re-sync request to fail because a request is already in flight. This ends up throwing an IllegalStateException at com/vaadin/client/communication/RequestResponseTracker.java.

Fixes #13726

Co-authored-by: Artur <[email protected]>
Co-authored-by: Pepijn Van Eeckhoudt @pepijnve
vaadin-bot pushed a commit that referenced this pull request May 19, 2022
…13733)

Process re-sync messages via normal message queue and use semaphore to protect re-sync process (i.e. do not allow other messages while performing re-sync).

This PR is adopted from similar fixes for Vaadin 8.

vaadin/framework#11791
vaadin/framework#12043
vaadin/framework#12178

This also changes the method `forceMessageHandling` in a way that the desire to resynchronise is registered before calling `endRequest`. If this is not done, `endRequest` may end up sending out a request itself and that then causes the re-sync request to fail because a request is already in flight. This ends up throwing an IllegalStateException at com/vaadin/client/communication/RequestResponseTracker.java.

Fixes #13726

Co-authored-by: Artur <[email protected]>
Co-authored-by: Pepijn Van Eeckhoudt @pepijnve
vaadin-bot pushed a commit that referenced this pull request May 19, 2022
…13733)

Process re-sync messages via normal message queue and use semaphore to protect re-sync process (i.e. do not allow other messages while performing re-sync).

This PR is adopted from similar fixes for Vaadin 8.

vaadin/framework#11791
vaadin/framework#12043
vaadin/framework#12178

This also changes the method `forceMessageHandling` in a way that the desire to resynchronise is registered before calling `endRequest`. If this is not done, `endRequest` may end up sending out a request itself and that then causes the re-sync request to fail because a request is already in flight. This ends up throwing an IllegalStateException at com/vaadin/client/communication/RequestResponseTracker.java.

Fixes #13726

Co-authored-by: Artur <[email protected]>
Co-authored-by: Pepijn Van Eeckhoudt @pepijnve
mshabarov pushed a commit that referenced this pull request May 19, 2022
…13733) (#13806)

Process re-sync messages via normal message queue and use semaphore to protect re-sync process (i.e. do not allow other messages while performing re-sync).

This PR is adopted from similar fixes for Vaadin 8.

vaadin/framework#11791
vaadin/framework#12043
vaadin/framework#12178

This also changes the method `forceMessageHandling` in a way that the desire to resynchronise is registered before calling `endRequest`. If this is not done, `endRequest` may end up sending out a request itself and that then causes the re-sync request to fail because a request is already in flight. This ends up throwing an IllegalStateException at com/vaadin/client/communication/RequestResponseTracker.java.

Fixes #13726

Co-authored-by: Artur <[email protected]>
Co-authored-by: Pepijn Van Eeckhoudt @pepijnve

Co-authored-by: Tatu Lund <[email protected]>
Co-authored-by: Artur <[email protected]>
mshabarov pushed a commit that referenced this pull request May 19, 2022
…13733) (#13804)

Process re-sync messages via normal message queue and use semaphore to protect re-sync process (i.e. do not allow other messages while performing re-sync).

This PR is adopted from similar fixes for Vaadin 8.

vaadin/framework#11791
vaadin/framework#12043
vaadin/framework#12178

This also changes the method `forceMessageHandling` in a way that the desire to resynchronise is registered before calling `endRequest`. If this is not done, `endRequest` may end up sending out a request itself and that then causes the re-sync request to fail because a request is already in flight. This ends up throwing an IllegalStateException at com/vaadin/client/communication/RequestResponseTracker.java.

Fixes #13726

Co-authored-by: Artur <[email protected]>
Co-authored-by: Pepijn Van Eeckhoudt @pepijnve

Co-authored-by: Tatu Lund <[email protected]>
Co-authored-by: Artur <[email protected]>
mshabarov pushed a commit that referenced this pull request May 20, 2022
…13733) (#13805)

Process re-sync messages via normal message queue and use semaphore to protect re-sync process (i.e. do not allow other messages while performing re-sync).

This PR is adopted from similar fixes for Vaadin 8.

vaadin/framework#11791
vaadin/framework#12043
vaadin/framework#12178

This also changes the method `forceMessageHandling` in a way that the desire to resynchronise is registered before calling `endRequest`. If this is not done, `endRequest` may end up sending out a request itself and that then causes the re-sync request to fail because a request is already in flight. This ends up throwing an IllegalStateException at com/vaadin/client/communication/RequestResponseTracker.java.

Fixes #13726

Co-authored-by: Artur <[email protected]>
Co-authored-by: Pepijn Van Eeckhoudt @pepijnve

Co-authored-by: Tatu Lund <[email protected]>
Co-authored-by: Artur <[email protected]>
mshabarov pushed a commit that referenced this pull request Jun 10, 2022
…13733) (#13805)

Process re-sync messages via normal message queue and use semaphore to protect re-sync process (i.e. do not allow other messages while performing re-sync).

This PR is adopted from similar fixes for Vaadin 8.

vaadin/framework#11791
vaadin/framework#12043
vaadin/framework#12178

This also changes the method `forceMessageHandling` in a way that the desire to resynchronise is registered before calling `endRequest`. If this is not done, `endRequest` may end up sending out a request itself and that then causes the re-sync request to fail because a request is already in flight. This ends up throwing an IllegalStateException at com/vaadin/client/communication/RequestResponseTracker.java.

Fixes #13726

Co-authored-by: Artur <[email protected]>
Co-authored-by: Pepijn Van Eeckhoudt @pepijnve

Co-authored-by: Tatu Lund <[email protected]>
Co-authored-by: Artur <[email protected]>
taefi pushed a commit that referenced this pull request Jun 10, 2022
…13733) (#13805)

Process re-sync messages via normal message queue and use semaphore to protect re-sync process (i.e. do not allow other messages while performing re-sync).

This PR is adopted from similar fixes for Vaadin 8.

vaadin/framework#11791
vaadin/framework#12043
vaadin/framework#12178

This also changes the method `forceMessageHandling` in a way that the desire to resynchronise is registered before calling `endRequest`. If this is not done, `endRequest` may end up sending out a request itself and that then causes the re-sync request to fail because a request is already in flight. This ends up throwing an IllegalStateException at com/vaadin/client/communication/RequestResponseTracker.java.

Fixes #13726

Co-authored-by: Artur <[email protected]>
Co-authored-by: Pepijn Van Eeckhoudt @pepijnve

Co-authored-by: Tatu Lund <[email protected]>
Co-authored-by: Artur <[email protected]>
ZheSun88 pushed a commit that referenced this pull request Sep 21, 2022
…13733)

Process re-sync messages via normal message queue and use semaphore to protect re-sync process (i.e. do not allow other messages while performing re-sync).

This PR is adopted from similar fixes for Vaadin 8.

vaadin/framework#11791
vaadin/framework#12043
vaadin/framework#12178

This also changes the method `forceMessageHandling` in a way that the desire to resynchronise is registered before calling `endRequest`. If this is not done, `endRequest` may end up sending out a request itself and that then causes the re-sync request to fail because a request is already in flight. This ends up throwing an IllegalStateException at com/vaadin/client/communication/RequestResponseTracker.java.

Fixes #13726

Co-authored-by: Artur <[email protected]>
Co-authored-by: Pepijn Van Eeckhoudt @pepijnve
mshabarov pushed a commit that referenced this pull request Sep 22, 2022
…13733)

Process re-sync messages via normal message queue and use semaphore to protect re-sync process (i.e. do not allow other messages while performing re-sync).

This PR is adopted from similar fixes for Vaadin 8.

vaadin/framework#11791
vaadin/framework#12043
vaadin/framework#12178

This also changes the method `forceMessageHandling` in a way that the desire to resynchronise is registered before calling `endRequest`. If this is not done, `endRequest` may end up sending out a request itself and that then causes the re-sync request to fail because a request is already in flight. This ends up throwing an IllegalStateException at com/vaadin/client/communication/RequestResponseTracker.java.

Fixes #13726

Co-authored-by: Artur <[email protected]>
Co-authored-by: Pepijn Van Eeckhoudt @pepijnve
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Client resynchronisation can cause IllegalStateException
5 participants