Skip to content

Conversation

fioan89
Copy link
Collaborator

@fioan89 fioan89 commented Sep 15, 2025

JetBrains team reported in the past a couple of errors in the log, one of them being A workspace build is already active. The issue can be reproduced if the user hits the Stop action for example quite quick. It takes maybe one or two seconds to make rest api request, then for the backend to enqueue the build and change the workspace action. If we hit the action buttons really fast then this error could be reproduced.

One approach I tried was to disable the action buttons in the context menu for the duration the request is executed. But for some reason the "enabled" property is not working in context menu, only when the actions are rendered on a UI "page".

Instead, I decided to refactor the existing code and (also) visually report the errors in the UI screen to make the user aware in some cases that a job is already running on the backend.

Another error reported by JetBrains is a RejectedExecutionException in the rest api client, and from the stack trace it seems the thread pool in the rest client was at some point shutdown.
I think it is some sort of race condition, some thread calling shutting down the rest api client while the UI thread still executes polling and user's action. I tried to reproduce the issue with no success, and so I'm improving the logging around plugin de-initialization in the hope that next time the sequence of events is more helpful.

JetBrains team reported in the past a couple of errors in the log, one of them
being `A workspace build is already active`. The issue can be reproduced if the user
hits the `Stop` action for example quite quick. It takes maybe one or two seconds
to make rest api request, then for the backend to enqueue the build and change the
workspace action. If we hit the action buttons really fast then this error could be
reproduced.

One approach I tried was to disable the action buttons in the context menu for the duration
the request is executed. But for some reason the "enabled" property is not working in context
menu, only when the actions are rendered on a UI "page".

Instead, I decided to refactor the existing code and (also) visually report the errors in the
UI screen to make the user aware in some cases that a job is already running on the backend.
Another error reported by JetBrains is a  `RejectedExecutionException` in the rest api client,
and from the stack trace it seems the thread pool in the rest client was at some point shutdown.
I think it is some sort of race condition, some thread calling shutting down the rest api client
while the UI thread still executes polling and user's action. I tried to reproduce the issue with
no success, and so I'm improving the logging around plugin de-initialization in the hope that next
time the sequence of events is more helpful.
@fioan89
Copy link
Collaborator Author

fioan89 commented Sep 15, 2025

Screenshot 2025-09-15 at 23 46 47

Copy link

@jcjiang jcjiang left a comment

Choose a reason for hiding this comment

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

The changes you made around improving logging and visually displaying errors make sense. Could still be helpful to get thoughts from an engineer, but I approve.

Copy link
Member

@code-asher code-asher left a comment

Choose a reason for hiding this comment

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

Looks good!

@fioan89 fioan89 merged commit 3867a15 into main Sep 16, 2025
6 checks passed
@fioan89 fioan89 deleted the fix-report-errors-while-executing-actions branch September 16, 2025 20:34
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.

3 participants