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: Disposed geometryGroup softlocks sector load #3946

Merged
merged 7 commits into from
May 8, 2024

Conversation

Strepto
Copy link
Contributor

@Strepto Strepto commented Nov 22, 2023

Type of change

Bug

Jira ticket 📘

https://cognitedata.atlassian.net/browse/

Description 📝

This fixes an issue where a sector would load a disposed geometry group, and then never be loadable again.

The stack trace of the issue this fixes:

Uncaught Error: Already disposed/dereferenced
    at U.ensureNotDisposed (index.js:2:1391445)
    at U.reference (index.js:2:1390996)
    at bt.updateGeometry (index.js:2:1449747)
    at r (index.js:2:1911821)
    at Object.next (index.js:2:1912155)
    at e.next (index.js:2:2678779)
    at n._next (index.js:2:2678354)
    at n.next (index.js:2:2677942)
    at index.js:2:2706978
    at s._next (index.js:2:2705280)

I'm not actually sure why the reference imbalance happens. It seems to be easier to trigger with a small sector MemoryCache, but it may happen without any sector cache at all. It does not seem to happen if network cache is disabled. So its a probably a combination of a few factors and hard to reliably reproduce.

This PR suggests a workaround fix by not failing hard if the sector is already disposed, as this would stop all loading and the sector would never recover from the exception. Only fix for the user was a refresh of the website.

A more long term fix would be to identify the race-condition that causes a disposed sector geometry group to be loaded.

How has this been tested? 🔍

See below, I can try to add some tests if I understand what causes the issue.

Test instructions ℹ️

(In reveal Examples with a local model): Reduce budget to (1%) and navigate around a model (such as Huldra) quickly. (Move backwards / forwards / spin / anything). The log message should appear quite reliably. In real world testing this is harder to reproduce, but still happens especially with a low budget (3 - 4 million triangles budget).

Checklist ☑️

  • I am proud of this feature.
  • I have performed a self-review of my own code.
  • I have added PR type (Feat, Bug, Chore, Test, Docs, Style, Refactor) to the PR title.
  • I have manually tested this for different scenarios (different models, formats, devices, browsers).
  • I have commented my code in hard-to-understand areas.
  • I have made corresponding changes to the public documentation.
  • I have added unit and visuals tests to prove that my feature works to the best of my ability.
  • I have refactored the code for readability to the best of my ability.
  • I have checked that my changes do not introduce regressions in the public documentation.
  • I have outlined any known defects / lacking capabilities in the contents of this PR.
  • I have listed any remaining work that should follow this PR in the description or jira/miro/etc.
  • I have added TSDoc to any public facing changes.
  • I have added "developer documentation" in any package README.md that is related / applicable to this PR.
  • I have noted down and am currently tracking any technical debt introduced in this PR.
  • I have thoroughly thought about the architecture of this implementation.
  • I have asked peers to test this feature.

Copy link

codecov bot commented Nov 22, 2023

Codecov Report

Attention: Patch coverage is 20.00000% with 16 lines in your changes are missing coverage. Please review.

Project coverage is 73.52%. Comparing base (a987ab4) to head (ba902ee).
Report is 452 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3946      +/-   ##
==========================================
- Coverage   73.54%   73.52%   -0.03%     
==========================================
  Files         357      357              
  Lines       35855    35870      +15     
  Branches     2734     2735       +1     
==========================================
+ Hits        26369    26372       +3     
- Misses       9381     9393      +12     
  Partials      105      105              
Files Coverage Δ
...r/packages/utilities/src/three/AutoDisposeGroup.ts 93.54% <50.00%> (-3.01%) ⬇️
...ewer/packages/cad-parsers/src/sector/SectorNode.ts 57.47% <12.50%> (-7.01%) ⬇️

"@reveal/utilities": "workspace:*"
}
}
{
Copy link
Contributor Author

@Strepto Strepto Dec 6, 2023

Choose a reason for hiding this comment

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

This file was changed to lf file endings, which I believe should be correct?

},
"dependencies": {
"@reveal/data-providers": "workspace:*",
"@reveal/logger": "workspace:*",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a logger reference is the only change in this file except for line endings

@Strepto Strepto marked this pull request as ready for review December 6, 2023 08:39
@Strepto Strepto requested a review from a team as a code owner December 6, 2023 08:39
Copy link
Contributor

@christjt christjt left a comment

Choose a reason for hiding this comment

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

LGTM!

@christjt christjt enabled auto-merge (squash) May 8, 2024 08:35
@christjt christjt merged commit cb258f3 into cognitedata:master May 8, 2024
14 checks passed
@Strepto Strepto deleted the nih/fix/ignore-disposed branch May 8, 2024 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants