-
Notifications
You must be signed in to change notification settings - Fork 429
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
Delete client log files when deleting workspace #3374
Conversation
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.
This works, but has a possibly unwanted side-effect.
If you activate the command to clean up the language server, it seems to delete the log file that is in use by the starting language client. Would it be possible to move the workspace cleanup prior to
Line 114 in 31f7f3f
initializeLogFile(clientLogFile); |
That way the newly created log file is unaffected by the delete.
I tried the following change to your PR : diff --git a/src/extension.ts b/src/extension.ts
index 938cf62..7d8c1ba 100644
--- a/src/extension.ts
+++ b/src/extension.ts
@@ -110,7 +110,12 @@ export async function activate(context: ExtensionContext): Promise<ExtensionAPI>
if (!storagePath) {
storagePath = getTempWorkspace();
}
+ const workspacePath = path.resolve(`${storagePath}/jdt_ws`);
clientLogFile = path.join(storagePath, 'client.log');
+ const cleanWorkspaceExists = fs.existsSync(path.join(workspacePath, cleanWorkspaceFileName));
+ if (cleanWorkspaceExists) {
+ deleteClientLog(storagePath);
+ }
initializeLogFile(clientLogFile);
const telemetryService: Promise<TelemetryService> = Telemetry.startTelemetry(context);
@@ -137,7 +142,6 @@ export async function activate(context: ExtensionContext): Promise<ExtensionAPI>
}).then(async (requirements) => {
const triggerFiles = await getTriggerFiles();
return new Promise<ExtensionAPI>(async (resolve) => {
- const workspacePath = path.resolve(`${storagePath}/jdt_ws`);
const syntaxServerWorkspacePath = path.resolve(`${storagePath}/ss_ws`);
let serverMode = getJavaServerMode();
@@ -315,13 +319,11 @@ export async function activate(context: ExtensionContext): Promise<ExtensionAPI>
}
}));
- const cleanWorkspaceExists = fs.existsSync(path.join(workspacePath, cleanWorkspaceFileName));
if (cleanWorkspaceExists) {
const data = {};
try {
cleanupLombokCache(context);
deleteDirectory(workspacePath);
- deleteClientLog(storagePath);
deleteDirectory(syntaxServerWorkspacePath);
} catch (error) {
data['error'] = getMessage(error);
Let me know if that works. The reason I kept the client log deletion separate from the workspace deletions is because those deletions also trigger the "clean workspace" telemetry event, and since telemetry initialization is done asynchronously, we can't guarantee that event would succeed if we moved that whole "deletion" block up. If you find a nicer way, I'm open to it. |
On last thing. We have Lines 255 to 270 in 31f7f3f
One should detect failures in establishing a connection and the other can detect errors during client/server communication. If there are many errors being logged (from calling "stop" on the jdt.ls.core bundle), we have the ability to detect them and maybe prevent the client from attempting to re-initialize. |
Signed-off-by: Snjezana Peco <snjezana.peco@redhat.com>
@rgrunber I have updated the PR. |
@snjeza , were you able to reproduce the issue. The best I could do is by calling |
I have reproduced the issue in the following way;
Java LS stops the org.eclipse.jdt.ls.core plugin at https://github.com/eclipse-jdtls/eclipse.jdt.ls/blob/a31867d0ee8bd1fd348a7ba52469fc35e1da9369/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/BundleUtils.java#L168 |
It's not reproducing the issue for me. After running |
@rgrunber Could you try the following in Eclipse?
|
Thanks, that's what was needed. I had to add |
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.
Works for me. Feel free to merge when ready.
I think we should keep the original issue open to better understand how this is happening for those other users. Do you think they have some extension on their system that brings in o.e.team.core
?
|
So |
Fixes #3349
I can only reproduce the problem when I stop the o.e.jdt.ls.core plugin while debugging Java LS.
The PR deletes the client.log.* files when run
Java: Clean the Java Language Server Workspace
.