Skip to content

feat(daemon): copy service binary to DataDir instead of tmpfs#610

Merged
wizzomafizzo merged 2 commits intomainfrom
feat/service-binary-datadir
Apr 4, 2026
Merged

feat(daemon): copy service binary to DataDir instead of tmpfs#610
wizzomafizzo merged 2 commits intomainfrom
feat/service-binary-datadir

Conversation

@wizzomafizzo
Copy link
Copy Markdown
Member

  • Move service binary copy from TempDir (RAM-backed tmpfs) to DataDir (persistent storage), reducing RAM usage by ~50MB on memory-constrained platforms like MiSTer
  • The kernel demand-pages from disk so only accessed code pages consume RAM, rather than pinning the full binary in tmpfs
  • Extract prepareBinary and cleanupServiceBinary methods from inline code in Start()/stopService()
  • Add -trimpath build flag for reproducible builds and to strip local filesystem paths from binaries
  • Add unit tests for prepareBinary

Move the service binary copy from TempDir (RAM-backed tmpfs) to DataDir
(persistent storage). The kernel demand-pages from disk so only accessed
code pages consume RAM, instead of pinning the full ~50MB binary.

Also adds -trimpath build flag and tests for prepareBinary.
@sentry
Copy link
Copy Markdown

sentry bot commented Apr 4, 2026

Codecov Report

❌ Patch coverage is 58.53659% with 17 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/service/daemon/daemon.go 52.77% 13 Missing and 4 partials ⚠️

📢 Thoughts on this report? Let us know!

Port 0 was rejected by isValidAPIPort, causing NewTestConfigWithPort to
silently fall back to the default port 7497. Parallel tests then competed
for port 7497, causing flaky CI failures in TestSSE_ReceivesNotifications.

Allow port 0 through apiPortLocked when set programmatically (tests) while
keeping it rejected by SetAPIPort and isValidAPIPort (config files, API).
The server now writes the actual bound port back to config when port 0 is
used so tests can discover which port to connect to.
@wizzomafizzo wizzomafizzo merged commit 0bd2937 into main Apr 4, 2026
10 checks passed
@wizzomafizzo wizzomafizzo deleted the feat/service-binary-datadir branch April 4, 2026 07:41
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