From 59e03259d1126b6c0bb3a2c2cdea4f967bb23bd8 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Fri, 23 Mar 2018 14:18:27 +0000 Subject: prosody, util.startup: Switch from async.once() to long-lived thread, to avoid GC --- prosody | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'prosody') diff --git a/prosody b/prosody index b2e74af7..87207f4b 100755 --- a/prosody +++ b/prosody @@ -50,8 +50,13 @@ if #arg > 0 and arg[1] ~= "--config" then end local startup = require "util.startup"; +local async = require "util.async"; -startup.prosody(); +-- Note: it's important that this thread is not GC'd, as some C libraries +-- that are initialized here store a pointer to it ( :/ ). +local thread = async.runner(); + +thread:run(startup.prosody); local function loop() -- Error handler for errors that make it this far @@ -88,4 +93,4 @@ cleanup(); prosody.events.fire_event("server-stopped"); log("info", "Shutdown complete"); -os.exit(prosody.shutdown_code) +os.exit(prosody.shutdown_code); -- cgit v1.2.3