Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

MaxListenersExceedsWarning when used with http2

Open
#87 8 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
javascript, node.js
Domain
backend

Research direction

Start by reproducing the warning with serve-static under Node 7.10.0 and an http2 server, then inspect how the middleware and on-finished add and remove listeners. Confirm whether listeners are eventually removed and determine whether serve-static can prevent the warning; the issue is done when the behavior and an appropriate fix or limitation are established.

Written by the indexing model from the issue text.

Description

awaiting more info

I am aware of #7 which was closed a while ago now. However the issue still is occurring for me, using node 7.10.0. I think that is probably because I am using the http2 as the server and because the app that it is serving is a polymer custom components one, so calling index.html does cause an immediate request for quite a large number of additional files (approx 40 if I remember correctly) which should be being served through serve-static.

I have put a trace on the warning and confirmed it comes from the on-finished module as expressed in #7. I have also puts some instrumentation in the module that is adding and removing the listeners, so I am pretty sure that although a lot are added they are all eventually removed again, to I don't think there is an actual memory leak happening.

I report it here to see if there is anything that serve static could do to prevent the warning occuring

Dominant language
JavaScript
Stars
1.4k
Forks
240
Avg merge
14d 9h
Merged PRs (30d)
1

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from expressjs/serve-static

All issues in expressjs/serve-static

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.