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 stringification of RowIndex to prevent grid hard crashing #5423

Open
wants to merge 1 commit into
base: latest
Choose a base branch
from

Conversation

caitlinwolters-RL
Copy link

@caitlinwolters-RL caitlinwolters-RL commented Jul 29, 2022

There have been several GitHub issues referencing this problem:

#5068
#4767

It is difficult to reproduce in a sandbox environment, but in real-world applications we are seeing this problem manifest throughout the grid.

Screen Shot 2022-07-29 at 12 15 40 PM

Essentially, In certain circumstances, rowIndex will briefly be null. If the row attempts to re-render while rowIndex is null, the grid hard crashes.

This often seems linked to filtering the grid in rapid succession, or updating rows when a filter is applied.

This simple fix prevents a hard crash and filtering works as intended.

rowIndex is occasionally null. It seems that if the row re-renders when the rowIndex is null, AG Grid will hard crash. This change prevents AG Grid from hard crashing.
@StephenCooper
Copy link
Member

Thanks for this PR, I am going to investigate this and the linked issues that you provided.

@gportela85
Copy link
Member

@caitlinwolters-RL @StephenCooper We never created short-circuit here on purpose, if the grid is attempting to do any operations on a null rowIndex, it's a sign that something else is wrong in the process. Preventing the grid from hard crashing here will just end up with a broken viewport anyway.

@caitlinwolters-RL
Copy link
Author

@gportela85 when we monkeypatch AG Grid to not hard crash here, our grid works as intended. Without the fix, our grid crashes when filtering multiple times in succession.

This error appears to be the result of a race condition, which, in enterprise applications, is difficult to avoid given multiple layers of implementation.

@gportela85
Copy link
Member

@caitlinwolters-RL This is exactly the reason why we don't patch this, now it looks like everything is fine but you probably have a memory leak somewhere because functions are being called on rows that are no longer rendered and this will make it very hard to find out where. It would be better if you submitted a reproducible scenario of what you are fixing using Plunkr. We need to know exactly what race conditions are creating this scenario so we can patch this correctly. Simply hiding the error is not the way to go.

@kiril-matev
Copy link

Hi @caitlinwolters-RL!

Thank you for looking into other issues where this was reported.

Unfortunately none of these reports contained a live example so we didn't investigate. I've now reopened the issues you listed and asked the users for reproduction examples.

As @gportela85 mentioned we'd like to fix the underlying issue instead of apply a patch to deal with one of its symptoms. This is why we need to be able to reproduce the issue in a live example.

I understand it's difficult to build an example demonstrating an intermittent issue that only manifests itself occasionally. Even so, without a live example we're not sure what is the grid state at the time this issue occurs. This is why we can start our investigation with a live example from you that reproduces this issue even if it takes a long time to use it to reproduce it. The live scenario would answer important questions about how the grid is configured.

We're looking forward to your response so we can progress this.

@genghongkai
Copy link

How to accurately add the added data to the correct position through applyTransaction when expanded is false ?

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.

None yet

5 participants