Skip to content

Close keep_alive_loop's Timer and drop unused connections from the precompile workload - #15

Open
deveshjawla wants to merge 1 commit into
JuliaMessaging:mainfrom
deveshjawla:fix-precompile-leaks
Open

deveshjawla wants to merge 1 commit into
JuliaMessaging:mainfrom
deveshjawla:fix-precompile-leaks

Conversation

@deveshjawla

Copy link
Copy Markdown

Two leftover handles stop a process from becoming idle, which makes PackageCompiler's create_app / create_sysimage hang when MQTTClient is a dependency.

1. keep_alive_loop never closes its Timer (src/client.jl)

timer = Timer(0; interval=check_interval) is a repeating timer. When the loop exits (after disconnect), the function returns without closing it. The libuv handle stays active until the Timer happens to be garbage collected, so the process keeps a live timer after every disconnect. PackageCompiler waits for background tasks, IO and timers to finish before it snapshots the process, so it waits indefinitely. Fix: close(timer) before returning.

2. Two unused MakeConnection calls in the precompile workload (ext/PrecompileMQTT.jl)

udsclient, udsconnection = MakeConnection("/tmp/mqtt.sock")
tcpclient, tcpconnection = MakeConnection("test.mosquitto.org", 1883)

Nothing in the workload uses these results. The second call runs a DNS lookup of test.mosquitto.org (getaddrinfo) at precompile time, which needs network access and makes precompilation depend on an outside host. Removing both lines leaves the rest of the workload unchanged.

Testing: Pkg.test() with Mosquitto on localhost:1883 passes the same as on main: client tests 79/79, utils 26/26, integration 20/20, plus the TCP smoke tests. We have used these two changes in a vendored copy for some time, and with them create_app completes.

main also has #14 (the Windows pipe fix), which has not been released since v0.3.1. A release with these would let us drop our vendored copy.

🤖 Generated with Claude Code

…ecompile workload

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant