- Home
- Skills
- APIs & Backend
- Repair Service Startup & Shutdown Failures
More screenshots
Works with the AI Agents you already use
Repair Service Startup & Shutdown Failures
Repair Service Startup & Shutdown Failures is a bounded ToolForge Labs workflow.
$1
Repair Service Startup & Shutdown Failures
Example session with this skill installed
My Node.js Express app on Kubernetes is getting SIGKILLed before it finishes processing long-running requests during a rollout. I have a 30s terminationGracePeriod. Fix the signal handling.
- Read your context and instructions
- Compiled the repair service startup
I have analyzed the lifecycle contract between Kubernetes and your Node.js process. The current implementation lacks a SIGTERM handler that pauses traffic admission and waits for the HTTP server to close existing connections within the 30-second window.
Graceful Shutdown Implementation
const express = require('express');
const http = require('http');
const app = express();
const server = http.createServer(app);
// Track active connections for draining
let isShuttingDown = false;
app.use((req, res, next) => {
if (isShuttingDown) {
res.set('Connection', 'close');
res.status(503).send('Server is shutting down');
return;
}
next();
});
function gracefulShutdown(signal) {
console.log(`${signal} received. Starting graceful shutdown...`);
isShuttingDown = true;
// Stop accepting new connections via K8s readiness probe if applicable
// Or simply stop the server from accepting new socket connections
server.close(() => {
console.log('Http server closed.');
// Close DB connections, flush logs, etc. here
process.exit(0);
});
// Force shutdown after a safety margin (e.g., 25s for a 30s K8s limit)
setTimeout(() => {
console.error('Could not close connections in time, forceful shutdown');
process.exit(1);
}, 25000);
}
process.on('SIGTERM', () => gracefulShutdown('SIGTERM'));
process.on('SIGINT', () => gracefulShutdown('SIGINT'));
server.listen(3000);
Next steps
- Update your Kubernetes deployment manifest to ensure the
readinessProbepoints to a/healthendpoint that returns 503 whenisShuttingDownis true. - Verify that your containerized environment does not use an
npm startwrapper that swallows signals; usenode index.jsdirectly in the Docker CMD. - Run the included implementation and trigger a manual
kill -15to verify the "Http server closed" log appears.
Connects securely to your tools. The creator never sees your data.
About this skill
Repair Service Startup & Shutdown Failures is a bounded ToolForge Labs workflow. Repair service lifecycle failures across startup sequencing, dependency initialization, readiness/liveness, background task ownership, signal handling, draining, graceful shutdown, finalization, and restart recovery. Works from repositories or partial hooks/probe logs. Produces bounded repairs and deterministic lifecycle tests without inventing deployment results. It works from a full repository or partial evidence such as snippets, logs, configuration, traces, tickets, and architecture notes. The skill preserves existing product and security policy, separates verified facts from assumptions, avoids invented execution claims, and produces concrete repair or review steps with focused deterministic validation or traceable evidence.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for APIs & Backend.
Cannot verify production systems, external services, or facts that are not present in supplied evidence. With partial context it returns bounded diagnosis/review, explicit assumptions, and a deterministic validation plan rather than claiming successful execution.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 2 months ago
Permissions
Use a clean branch or a controlled review workspace. Supply repository files, logs, traces, configuration, or evidence needed for the task. Review all patches/findings before merge or operational action; keep production credentials and destructive production actions out of the workflow.