diff --git a/tests/ice.cpp b/tests/ice.cpp
index 9873bdbe24b115680b38b0420443ee45f83603b8..32928af1e437188c6aa4a07702128b3bf0f2d645 100644
--- a/tests/ice.cpp
+++ b/tests/ice.cpp
@@ -92,7 +92,10 @@ IceTest::setUp()
     if (!upnpContext) {
         if (!ioContext) {
             ioContext = std::make_shared<asio::io_context>();
-            ioContextRunner = std::make_shared<std::thread>([&] { ioContext->run(); });
+            ioContextRunner = std::make_shared<std::thread>([&] {
+                auto work = asio::make_work_guard(*ioContext);
+                ioContext->run();
+            });
         }
         upnpContext = std::make_shared<dhtnet::upnp::UPnPContext>(ioContext, nullptr);
     }