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 loading homeworks for teachers #655

Merged
merged 10 commits into from
Jul 6, 2023
Merged

Conversation

nilsreichardt
Copy link
Member

Summary

This PR fixes:

It's required to this all in one pull request because otherwise it would introduce a new bug.

What was the issue?

I started to debug on this problem because of #654. I found out it was because TypeOfUser.student was used as a backup when it's null (see #573). However, just reverting it to TypeOfUser.unknown was not option because this would introduce #497 again.

Therefore, I wondered, why typeOfUser can be null. The reason for this was the last time online reporter. Because .set() has been used for Firestore, Firestore instantly was setting it null (I think null is used for Firestore.currentTimestamp() when the client is offline or the server hasn't responded yet). Using .update() fixed the issue that the user document only contained lastOnline.

But using update() in the last online reporter always caused #497. Even using TypeOfUser.student or TypeOfUser.unknown couldn't be as a workaround. After hours of debugging I found that when signing our the following line was causing the issue:

onError: _homeworkSubjectStream.addError);

The issue is that we listened to _homeworkSubjectStream and when an error occurred, we the .addError method of _homeworkSubjectStream used. This ended up into an infinity loop which resulted in the freeze (#497),

This was by far one of my hardest bugs... I needed ~5,5h to find the solution and it was extremely hard to debug.

Fixes #608
Fixes #654
Fixes #497

@docs-page
Copy link

docs-page bot commented May 9, 2023

To view this pull requests documentation preview, visit the following URL:

docs.page/sharezoneapp/sharezone-app~655

Documentation is deployed and generated using docs.page.

@github-actions
Copy link

github-actions bot commented May 9, 2023

Visit the preview URL for this PR (updated for commit 6f82e64):

https://sharezone-test--pr655-fix-loading-homework-u5o2f9ji.web.app

(expires Thu, 13 Jul 2023 10:18:21 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 4cb3ae61e1e018abfd9841fd3239f5b49ccc034b

Copy link
Collaborator

@Jonas-Sander Jonas-Sander left a comment

Choose a reason for hiding this comment

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

See comment above

Comment on lines 34 to 35
// deleting the user of something). This can result into hard bug and side
// effects, especially because there is no error. The .update() method would
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hard bug? Do you mean hard to find?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, hard bugs means bugs that are hard to debug, hard to find, hard to locate, etc

Copy link
Member Author

Choose a reason for hiding this comment

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

I have added this definition to the comment

@Jonas-Sander
Copy link
Collaborator

This was by far one of my hardest bugs... I needed ~5,5h to find the solution and it was extremely hard to debug.

I think this bug was on me... Sorry!! 🙈😁

@Jonas-Sander
Copy link
Collaborator

Although in my opinion there should be:

  • A lint that warns of piping a stream into itself in this way (at least the error I guess?)
  • A debug feature that warns when a stream goes into this kind of infinity loop

If I have time maybe I'm gonna raise an issue on the Dart side, but no promises yet. I guess that there might be reasons why it might be hard to actually implement it as well.

@nilsreichardt
Copy link
Member Author

Although in my opinion there should be:

  • A lint that warns of piping a stream into itself in this way (at least the error I guess?)
  • A debug feature that warns when a stream goes into this kind of infinity loop

If I have time maybe I'm gonna raise an issue on the Dart side, but no promises yet. I guess that there might be reasons why it might be hard to actually implement it as well.

Definitely, agree. Unfortunately, I couldn't also use performance tools, like DevTools because they're not really working for web and say that I should use Chrome DevTools, however even Chrome DevTools couldn't record it properly.

@nilsreichardt nilsreichardt added this pull request to the merge queue May 9, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 9, 2023
@nilsreichardt nilsreichardt added this pull request to the merge queue May 9, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 9, 2023
@nilsreichardt nilsreichardt added this pull request to the merge queue May 9, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 9, 2023
@nilsreichardt nilsreichardt added this pull request to the merge queue May 9, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 9, 2023
@nilsreichardt nilsreichardt added this pull request to the merge queue May 9, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 9, 2023
@nilsreichardt nilsreichardt added this pull request to the merge queue May 9, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 9, 2023
@nilsreichardt nilsreichardt added this pull request to the merge queue May 9, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 10, 2023
@nilsreichardt nilsreichardt added this pull request to the merge queue May 10, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 10, 2023
@nilsreichardt nilsreichardt added this pull request to the merge queue May 10, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 10, 2023
This reverts commit fc20462.
@nilsreichardt
Copy link
Member Author

@Jonas-Sander Any ideas why the android integration test are not passing anymore because of the changes?

@Jonas-Sander
Copy link
Collaborator

@Jonas-Sander Any ideas why the android integration test are not passing anymore because of the changes?

No, no idea, sorry

@Jonas-Sander Jonas-Sander added this pull request to the merge queue May 15, 2023
@Jonas-Sander Jonas-Sander removed this pull request from the merge queue due to a manual request May 15, 2023
@Jonas-Sander Jonas-Sander added this pull request to the merge queue May 15, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 15, 2023
@github-actions github-actions bot removed the testing label Jul 1, 2023
@nilsreichardt nilsreichardt enabled auto-merge July 1, 2023 18:58
@nilsreichardt nilsreichardt added this pull request to the merge queue Jul 1, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Jul 1, 2023
@Jonas-Sander Jonas-Sander added this pull request to the merge queue Jul 4, 2023
@Jonas-Sander
Copy link
Collaborator

@nilsreichardt Should we release a new version after this is merged?

@nilsreichardt
Copy link
Member Author

Yes, makes sense also because of #671

@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 4, 2023
@nilsreichardt nilsreichardt added this pull request to the merge queue Jul 4, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 4, 2023
@nilsreichardt nilsreichardt enabled auto-merge July 6, 2023 10:18
@nilsreichardt nilsreichardt added this pull request to the merge queue Jul 6, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 6, 2023
@nilsreichardt nilsreichardt added this pull request to the merge queue Jul 6, 2023
Merged via the queue into main with commit 72bd5b9 Jul 6, 2023
@nilsreichardt nilsreichardt deleted the fix-loading-homeworks branch July 6, 2023 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants