← OSS Labs
fastify/fastify · OSS Lab

Duplicate closeIdleConnections invocation on shutdown for built-in servers

Native server closeIdleConnections count exceeds one

lockNot currently playableReady-check eligible · human review pending
EasyAPI & Request FlowReady-check eligible · human review pending
OSS Labs are training exercises derived from public open-source bug-fix history. Completing a lab is not an upstream contribution or merged PR. Buglyst is not affiliated with these projects.
c2ba18cSource commit
d33f017Parent commit
MITLicense
385Files
79,226Visible LOC
~20mEst. time

What this lab trains

checkRepository navigation
checkFailing test reproduction
checkRoot cause tracing
checkMinimal patch reasoning
checkPR-style explanation
checkHTTP request/response flow

Failing signal

What you’ll see when you run the visible regression test.

SymptomNative server closeIdleConnections count exceeds oneEntry point hintThe test creates a server and counts closeIdleConnections calls. It sees 2. One is Node's, one is Fastify's.

Repo navigation focus

A public-safe starting path for the large repo snapshot.

Start here
  • test/custom-http-server.test.js
Likely area
  • fastify.js
  • lib/server.js
Investigation path
  1. Run the failing test: node --test test/custom-http-server.test.js.
  2. The test counts how many times closeIdleConnections fires — it gets 2 instead of 1.
  3. Open fastify.js. Find the preClose lifecycle block and the closeIdleConnections call.
  4. Note that this fires for ALL server types — native and custom. Native servers already handle this.
  5. Add `options.serverFactory` guard so the extra call only applies to custom server instances.
Repo scale
  • 385 files
  • ~79k LOC
  • Real Fastify repo snapshot

Also trains company-style patterns

Company-style, not official, not affiliated.

idempotencypaginationretry failuresstale cachebackend service lifecyclequeue processinghealth checkstimeouts

PR-style report (preview)

The structured report you produce on accept. This is the format, not a real completion.

differencePR-STYLE REPORT
Sample format
Duplicate closeIdleConnections invocation on shutdown for built-in serversfastify/fastify

Problem

A regression reproduced from public bug-fix history causes a visible test to fail on the parent snapshot.

Root cause

Written by you, in your own words, after tracing the failing test into the runtime source. (Filled in from your submission — not provided here.)

Fix summary

A minimal patch that makes the visible regression test pass without breaking neighbouring behaviour.

Files changed

  • descriptiontest/<regression>.test.js
  • descriptionlib/<runtime-source>.js

Files inspected

  • descriptiontest/<regression>.test.js
  • descriptionlib/<runtime-source>.js

Tests run

  • terminalVisible regression test
  • terminalHidden edge-case validation

Validation result

Visible checks: pendingHidden validation: pending

Resume-safe summary

Completed an OSS-backed Buglyst debugging lab based on public bug-fix history: reproduced a failing test, traced the root cause, and shipped a minimal patch that passed visible and hidden validation. Not an upstream contribution.

OSS Labs are training exercises derived from public open-source bug-fix history. Completing a lab is not an upstream contribution or merged PR. Buglyst is not affiliated with these projects.