Skip to content

fix(server): suppression of a potential raised exception with running processes manipulation#212

Merged
mdevolde merged 1 commit into
jxmorris12:masterfrom
mdevolde:fix/terminate_server
Jul 1, 2026
Merged

fix(server): suppression of a potential raised exception with running processes manipulation#212
mdevolde merged 1 commit into
jxmorris12:masterfrom
mdevolde:fix/terminate_server

Conversation

@mdevolde

@mdevolde mdevolde commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

fix(server): suppression of a potential raised exception with running processes manipulation

Why the pull request was made

To avoid a potential exception raised in the close method of the server, and having a silent close.

Summary of changes

  • Supress a ValueError that can be raised in _RUNNING_SERVER_PROCESSES.remove if our server is not yet or not anymore in this list.

Screenshots (if appropriate):

Not applicable.

How has this been tested?

Applied local tests.

Resources

Not applicable.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update (changes to documentation only)
  • Refactor / code style update (non-breaking change that improves code structure or readability)
  • Tests / CI improvement (adding or updating tests or CI configuration only)
  • Chore / maintenance (non-breaking change that does not affect functionality, such as updating dependencies or fixing typos)
  • Other (please describe):

Checklist

  • Followed the project's contributing guidelines.
  • Updated any relevant tests.
  • Updated any relevant documentation.
  • Added comments to your code where necessary.
  • Formatted your code, run the linters, checked types and tests.
  • Added your changes to the CHANGELOG file, if applicable.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR hardens local server shutdown by preventing LanguageTool._terminate_server() from raising when the server process is unexpectedly missing from the global _RUNNING_SERVER_PROCESSES tracking list, improving reliability of close()-based cleanup.

Changes:

  • Suppress ValueError around _RUNNING_SERVER_PROCESSES.remove(self._server) during server termination.
  • Document the fix in the changelog.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/language_tool_python/server.py Makes _terminate_server() resilient to missing process entries in _RUNNING_SERVER_PROCESSES.
CHANGELOG.md Adds a “Fixed” entry describing the shutdown exception prevention.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/language_tool_python/server.py
Comment thread CHANGELOG.md Outdated
@codecov-commenter

codecov-commenter commented Jul 1, 2026

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.66%. Comparing base (9cd9cc0) to head (1e4d0fb).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #212      +/-   ##
==========================================
+ Coverage   80.65%   80.66%   +0.01%     
==========================================
  Files          13       13              
  Lines        1768     1769       +1     
==========================================
+ Hits         1426     1427       +1     
  Misses        342      342              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mdevolde mdevolde force-pushed the fix/terminate_server branch from 6469c0c to 1e4d0fb Compare July 1, 2026 13:22
@mdevolde mdevolde merged commit 3ebb352 into jxmorris12:master Jul 1, 2026
13 checks passed
@mdevolde mdevolde deleted the fix/terminate_server branch July 1, 2026 13:27
mdevolde added a commit to mdevolde/language_tool_python that referenced this pull request Jul 1, 2026
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