- Home
- Skills
- APIs & Backend
- Repair Service Startup & Shutdown Failures
More screenshots
Works with the AI tools you already use
Repair Service Startup & Shutdown Failures
Repair Service Startup & Shutdown Failures is a bounded ToolForge Labs workflow.
$8.99
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.
What you get
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.
How to install
Works the same in every agent - Claude, Cursor, Codex, Copilot and 20+ more.
- 1
Download the ZIP
Free skills download straight away. Paid skills unlock right after purchase.
- 2
Unzip into your skills folder
Every agent reads skills from one folder on your machine. Drop the unzipped folder in there.
- 3
Ask your agent to use it
Restart the agent if it was already running. It picks the skill up automatically - no config needed.
Skills folder by agent
Click the path to copy it. Create the folder if it does not exist yet.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill passes our trust checks below.
Security scanned
Passed our 8-point scan before listing
Fresh listing
Recently published to Agensi
30-day refund
Not a fit? Get your money back
Trust & safety
Security scanned
Verified clean 21 days ago
- Passed all security checks, Safe to install