Waitress "Client disconnected while serving" and "Bad file descriptor"

I'm getting messages from waitress that Client disconnected while serving.
After many requests I get a OSError: [Errno 9] Bad file descriptor and the server exits (see output below).

I'm using Plone 2.5.8.

I can reproduce it with a Dexterity content with a field of type plone.namedfile.field.NamedBlobFile (with files of approx. 20MB) and a template with an <audio> or <video> element with preload="auto" or preload="metadata".

The problem doesn't occur with preload="none". But then we don't get the metadata (e.g. duration) and the control shows 0:00.

Pinning waitress = 2.1.2 solves the Bad file descriptor issue (see this comment by wesleybl).

But the Client disconnected while serving issue is still there.

Is there a way to configure it? Maybe timeout?

sudo /path/to/plone/zeocluster/bin/zeoserver start
...
daemon process started, pid=1231

sudo /path/to/plone/zeocluster/bin/client1 fg
...
2022-07-10 08:38:26,203 INFO    [Zope:45][MainThread] Ready to handle requests
Starting server in PID 1236.
2022-07-10 08:38:26,210 INFO    [waitress:485][MainThread] Serving on http://0.0.0.0:8080
2022-07-10 08:38:52,452 INFO    [waitress:430][waitress-2] Client disconnected while serving /VirtualHostBase/http/*****:80/Plone/VirtualHostRoot/podcast/1/@@download/audio/audio.mp3
2022-07-10 08:38:52,483 INFO    [waitress:430][waitress-3] Client disconnected while serving /VirtualHostBase/http/*****:80/Plone/VirtualHostRoot/podcast/2/@@download/audio/audio.mp3
2022-07-10 08:38:52,492 INFO    [waitress:430][waitress-1] Client disconnected while serving /VirtualHostBase/http/*****:80/Plone/VirtualHostRoot/podcast/4/@@download/audio/audio.mp3
2022-07-10 08:38:52,499 INFO    [waitress:430][waitress-0] Client disconnected while serving /VirtualHostBase/http/*****:80/Plone/VirtualHostRoot/podcast/3/@@download/audio/audio.mp3
2022-07-10 08:39:26,010 INFO    [waitress:430][waitress-0] Client disconnected while serving /VirtualHostBase/http/*****:80/Plone/VirtualHostRoot/podcast/2/@@download/audio/audio.mp3
2022-07-10 08:39:28,117 INFO    [waitress:430][waitress-0] Client disconnected while serving /VirtualHostBase/http/*****:80/Plone/VirtualHostRoot/podcast/3/@@download/audio/audio.mp3
2022-07-10 08:39:32,929 INFO    [waitress:430][waitress-3] Client disconnected while serving /VirtualHostBase/http/*****:80/Plone/VirtualHostRoot/podcast/4/@@download/audio/audio.mp3
Traceback (most recent call last):
  File "/path/to/plone/zeocluster/parts/client1/bin/interpreter", line 307, in <module>
    exec(compile(__file__f.read(), __file__, "exec"))
  File "/path/to/plone/buildout-cache/eggs/cp39/Zope-4.8.1-py3.9.egg/Zope2/Startup/serve.py", line 255, in <module>
    sys.exit(main() or 0)
  File "/path/to/plone/buildout-cache/eggs/cp39/Zope-4.8.1-py3.9.egg/Zope2/Startup/serve.py", line 251, in main
    return command.run()
  File "/path/to/plone/buildout-cache/eggs/cp39/Zope-4.8.1-py3.9.egg/Zope2/Startup/serve.py", line 217, in run
    serve()
  File "/path/to/plone/buildout-cache/eggs/cp39/Zope-4.8.1-py3.9.egg/Zope2/Startup/serve.py", line 203, in serve
    server(app)
  File "/path/to/plone/buildout-cache/eggs/cp39/plone.recipe.zope2instance-6.11.0-py3.9.egg/plone/recipe/zope2instance/ctl.py", line 942, in serve
    return serve_paste(app, global_conf, **kws)
  File "/path/to/plone/buildout-cache/eggs/cp39/plone.recipe.zope2instance-6.11.0-py3.9.egg/plone/recipe/zope2instance/ctl.py", line 917, in serve_paste
    waitress.serve(app, **kw)
  File "/path/to/plone/buildout-cache/eggs/cp39/waitress-2.1.1-py3.9.egg/waitress/__init__.py", line 19, in serve
    server.run()
  File "/path/to/plone/buildout-cache/eggs/cp39/waitress-2.1.1-py3.9.egg/waitress/server.py", line 322, in run
    self.asyncore.loop(
  File "/path/to/plone/buildout-cache/eggs/cp39/waitress-2.1.1-py3.9.egg/waitress/wasyncore.py", line 245, in loop
    poll_fun(timeout, map)
  File "/path/to/plone/buildout-cache/eggs/cp39/waitress-2.1.1-py3.9.egg/waitress/wasyncore.py", line 172, in poll
    r, w, e = select.select(r, w, e, timeout)
OSError: [Errno 9] Bad file descriptor

I would suggest you provide a reproducible test case to waitress, per this comment: