https://promptfoo.dev/ logo
Error closing server: Server is not running
# ❓|questions
e
After upgrading to 0.120.1 (still in 0.120.4) a strange bug occured when viewing evals through localhost. I used promptfoo eval and promptfoo view to view the evals. When pressing Ctrl+C to stop the server, I see the following logs in the command line: Shutting down server... Error closing server: Server is not running. (-> yellow) Server closed Till now this is not causing any problems for me, but I was wondering if this is part of an underlying bug that could cause problems. I just wanted to let you know.
The error seems to come from server.ts in this section: // Close Socket.io connections first, then the HTTP server io.close(() => { httpServer.close((err) => { clearTimeout(forceCloseTimeout); if (err) { logger.warn(
Error closing server: ${err.message}
); } logger.info('Server closed'); resolve(); }); }); io.close() should already close the underlying HTTP server. So there is no need to close the server, too. Maybe you could change it to this: io.close(() => { if (!httpServer.listening) { clearTimeout(forceCloseTimeout); logger.info('Server closed'); return resolve(); } httpServer.close((err) => { clearTimeout(forceCloseTimeout); if (err) logger.warn(
Error closing server: ${err.message}
); logger.info('Server closed'); resolve(); }); }); I would be glad if you let me know if this was helpful and eliminated the (mostly) unnecessary log. 😄
m
Thank you! Just created https://github.com/promptfoo/promptfoo/pull/6646 Let me know if you'd like some swag.
e
I'm glad I could help in some way. Thank you, I would love to get promptfoo swag, because I'm a real fan of what you are doing. 😄 I hope it is no problem that I am based in Germany.
@michaelmichaelmichael Hello, I hope everything’s going well! A while ago you mentioned sending Promptfoo swag for helping with that bug. I just wanted to kindly check if there’s any update on that — absolutely no rush if things got busy!