-
Notifications
You must be signed in to change notification settings - Fork 350
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
Interactive Graph Bug Fix: Ensure that we're bounding and snapping BEFORE checking if the new destination results in a valid graph. #1356
Conversation
GeraldRequired Reviewers
Don't want to be involved in this pull request? Comment |
npm Snapshot: PublishedGood news!! We've packaged up the latest commit from this PR (6380fc1) and published it to npm. You Example: yarn add @khanacademy/perseus@PR1356 If you are working in Khan Academy's webapp, you can run: ./dev/tools/bump_perseus_version.sh -t PR1356 |
Size Change: +169 B (+0.02%) Total Size: 845 kB
ℹ️ View Unchanged
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1356 +/- ##
==========================================
+ Coverage 69.74% 70.91% +1.16%
==========================================
Files 488 493 +5
Lines 103291 103478 +187
Branches 7454 10529 +3075
==========================================
+ Hits 72045 73377 +1332
+ Misses 31130 30101 -1029
+ Partials 116 0 -116
... and 141 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
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.
Neat! Good job tracking this down too 🕵🏽
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.
Can you add a test for the changed behavior? Also, do you know where the infinite loop was occurring? Did it happen because Mafs tried to plot an infinite number of points? I'm not seeing any potential for infinite loops in the old reducer logic itself.
If the infinite loop is in Mafs, then we might want to submit a bugfix upstream. I could take that on.
@benchristel Ooo I absolutely will! I didn't add one initially as I wasn't sure what it would really show 🤔, but I can definitely see two tests that I could add now:
Key Investigation notes:
What is the issue?The issue, as far as I can tell, was as follows:
Next Steps for this ticket:Given this .. I feel like the issue probably isn't with mafs so much as something that was happening between webapp and Perseus when the graph was allowed to hit the invalid state. I feel like I should be able to recreate this issue in Perseus if it was an issue with Mafs specifically. With the logic added prior to this comment, it should no longer be possible at all to hit this invalid state. That being said, I'll still work on adding the same fallback checks to Sinusoid as we are using in Quadratic just to keep things safe and consistent! I'll also add the two tests I mentioned above. In terms of completing the investigation:I'll make a new DRAFT PR on a different branch with some strategic console logs/logic changes to test my theory that it's the fact that the sinusoid graph is allowed to become invalid at all that results in the browser crashing. I'll do these tests tomorrow morning and report back here if I'm able to find the exact root cause. If I'm still not able to find anything concrete about this exact root cause after these tests, I may simply leave a note on LEMS-2056 about investigating this issue further with a summary of the current discovery. LEMS-2056 is an investigation ticket made to specifically look into performance issues with our Graphs, with a particular focus on Quadratics and Sinusoids. Hopefully that clearly explains my discoveries so far! I'm happy to jump on a call tomorrow if you want to discuss further or if an alternative approach is desired. :) |
@SonicScrewdriver Thanks for that write-up! Really interesting that it's only reproducible in webapp. I'm going to do a timeboxed investigation into what the issue might be there. |
Summary:
This is a fix for an issue in our Sinusoid graphs, where moving the points to the edge of the graph would cause the entire browser to crash. I believe that this was due the fact that we were bounding and snapping our points to the graph settings AFTER determining if the newDestination is a valid location, which means that points placed at the edge of the graph could end up in an invalid location. This made it possible to get the graph into a bit of an infinite state.
By moving the boundAndSnap logic prior to checking whether it is a valid location, we can make sure that this loop is impossible. Repeating this order of operations for the Quadratic Graph actually manages to solve a separate issue that was considered a "Won't Do" earlier! :)
Issue: LEMS-2064 & LEMS-2066
Test plan: