From 4cb77c1743fd6d58d874211aafcbb68f036cbd9b Mon Sep 17 00:00:00 2001 From: Tim Wojtulewicz Date: Wed, 11 Jan 2023 17:44:05 -0700 Subject: [PATCH] Don't close the kqueue manually on shutdown on Windows --- src/iosource/Manager.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/iosource/Manager.cc b/src/iosource/Manager.cc index 5eb9859429..61e6b5df07 100644 --- a/src/iosource/Manager.cc +++ b/src/iosource/Manager.cc @@ -89,8 +89,17 @@ Manager::~Manager() pkt_dumpers.clear(); +#ifndef _MSC_VER + // There's a bug here with builds on Windows that causes an assertion with debug builds + // related to libkqueue returning a zero for the file descriptor. The assert happens + // because something else has already closed FD zero by the time we get here, and Windows + // doesn't like that very much. We only do this close when shutting down, so it should + // be fine to just skip it. + // + // See https://github.com/mheily/libkqueue/issues/151 for more details. if ( event_queue != -1 ) close(event_queue); +#endif } void Manager::InitPostScript()