Skip to content

Enhances error logging for process cleanup#303

Open
davidgs wants to merge 2 commits into
llm-d:mainfrom
davidgs:debug/links
Open

Enhances error logging for process cleanup#303
davidgs wants to merge 2 commits into
llm-d:mainfrom
davidgs:debug/links

Conversation

@davidgs
Copy link
Copy Markdown
Contributor

@davidgs davidgs commented May 21, 2026

What does this PR do?

Adds more specific error logging to stopServer and killProcessOnPort functions within the link checking script. When attempts to kill processes or process groups fail, the e.message is now logged to the console, providing more context about the error.

Why is this change needed?

This change improves the debuggability of the link checking script. By logging detailed error messages when process termination fails, it becomes easier to identify and troubleshoot issues related to orphaned processes or server shutdown failures during the cleanup phase.

How was this tested?

  • Tests added/updated (npm test)
  • Site builds successfully (npm run build)
  • Manual testing performed (npm start)

Checklist

  • Commits are signed off (git commit -s) per DCO
  • Code follows project contributing guidelines
  • Tests pass locally (npm test)
  • Site builds without errors (npm run build)
  • Documentation updated (if applicable)

Related Issues

@netlify
Copy link
Copy Markdown

netlify Bot commented May 21, 2026

Deploy Preview for elaborate-kangaroo-25e1ee ready!

Name Link
🔨 Latest commit 4db2b1d
🔍 Latest deploy log https://app.netlify.com/projects/elaborate-kangaroo-25e1ee/deploys/6a0f2be4332c3600089c91a9
😎 Deploy Preview https://deploy-preview-303--elaborate-kangaroo-25e1ee.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Errors encountered during server shutdown and process termination in the link checker script were previously caught and silently ignored. This change adds `console.error` calls to these catch blocks to log the specific error messages. This improves debuggability by providing visibility into potential issues during cleanup operations without altering the script's existing error handling logic.

Signed-off-by: David G. Simmons <santafen@mac.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 improves the debuggability of the scripts/check-links.mjs cleanup path by adding additional console error logging when server/process termination attempts fail.

Changes:

  • Log error messages when killing a process on the configured port fails during forced shutdown.
  • Log error messages when killing the server process group or main process fails (SIGTERM/SIGKILL paths).
  • Log error messages when killing a PID discovered via lsof fails.
Comments suppressed due to low confidence (2)

scripts/check-links.mjs:155

  • Same as above: failures to signal the process group / process can be an expected state during shutdown (already-exited process => ESRCH). Consider filtering expected error codes or lowering the log level so routine cleanup doesn’t emit scary error output.
        // Negative PID kills the process group
        process.kill(-serverProcess.pid, 'SIGTERM');
      } catch (e) {
        console.error('Error killing process group:', e.message);
        // Fallback to killing just the main process if process group fails
        try {
          serverProcess.kill('SIGTERM');
        } catch (e2) {
          console.error('Error killing main process:', e2.message);
          // Process might already be dead, that's fine

scripts/check-links.mjs:183

  • When process.kill() fails because the PID is already gone (ESRCH), that’s typically not actionable here and will now be logged as an error. Consider filtering expected error codes and include the PID in the log (and/or log the full error object) for unexpected failures to make the output more useful.
        try {
          process.kill(parseInt(pid), 'SIGKILL');
        } catch (e) {
          console.error('Error killing process:', e.message);
          // Process might already be dead
        }

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

Comment thread scripts/check-links.mjs Outdated
Comment thread scripts/check-links.mjs
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: David G. Simmons <davidgs@users.noreply.github.com>
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.

2 participants