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

Do not run EDT code in CodyFixHighlightPass:doCollectInformation #2289

Merged
merged 2 commits into from
Sep 13, 2024

Conversation

pkukielka
Copy link
Contributor

@pkukielka pkukielka commented Sep 13, 2024

Fixes #2287

Changes

Looks like we cannot do EDT actions in the CodyFixHighlightPass:doCollectInformation or we are risking a deadlock.

Test plan

It's a bit hard to test deterministically but for me adding and removing few special characters on an empty file was triggering IDE crash pretty quickly (10-20 sec).
I used combination of:

Option + \ («)
Option + P (Ļ)
Backspace

In a random order.
Timing matters, keep changing the tempo of the keystrokes.

// >= HighlightSeverity.INFO
myHighlights.mapNotNull {
try {
val range = document.codyRange(it.startOffset, it.endOffset)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

codyRange already contains the same check.

if (progress.isCanceled) {
break
}

val range =
Copy link
Contributor Author

Choose a reason for hiding this comment

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

No need to recompute the same thing again

Copy link
Contributor

@mkondratek mkondratek left a comment

Choose a reason for hiding this comment

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

tried it a few times.
before this change I was able to reproduce it
after this change I am not able to repro it

lgtm

@pkukielka pkukielka merged commit 03e9897 into main Sep 13, 2024
12 of 13 checks passed
@pkukielka pkukielka deleted the pkukielka/fix-CodyFixHighlightPass branch September 13, 2024 11:53
pkukielka added a commit that referenced this pull request Sep 19, 2024
Fixes #2287

## Changes 

Looks like we cannot do EDT actions in the
`CodyFixHighlightPass:doCollectInformation` or we are risking a
deadlock.

## Test plan

It's a bit hard to test deterministically but for me adding and removing
few special characters on an empty file was triggering IDE crash pretty
quickly (10-20 sec).
I used combination of:

`Option + \` (`«`)
`Option + P` (`Ļ`)
`Backspace`

In a random order.
Timing matters, keep changing the tempo of the keystrokes.
pkukielka added a commit that referenced this pull request Sep 19, 2024
Fixes #2287

## Changes 

Looks like we cannot do EDT actions in the
`CodyFixHighlightPass:doCollectInformation` or we are risking a
deadlock.

## Test plan

It's a bit hard to test deterministically but for me adding and removing
few special characters on an empty file was triggering IDE crash pretty
quickly (10-20 sec).
I used combination of:

`Option + \` (`«`)
`Option + P` (`Ļ`)
`Backspace`

In a random order.
Timing matters, keep changing the tempo of the keystrokes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants