meshery/meshery
View on GitHub[Performance] Prevent double-unlock panic in startNighthawkServer
Open
#18978 opened on Apr 29, 2026
help wanted
Description
Current Behavior
startNighthawkServer locks nighthawkStatus with a deferred unlock, but it also manually unlocks the same mutex on two error paths.
That creates a double-unlock risk that can panic the server while handling a failed Nighthawk startup.
Expected Behavior
The function should unlock the mutex exactly once on every path.
Screenshots/Logs
Relevant code path:
server/helpers/load_test_interface.godefer nighthawkStatus.Unlock()near the top ofstartNighthawkServer- extra
nighthawkStatus.Unlock()calls before returning errors
Environment
- Host OS: Linux
- Platform: Kubernetes
- Meshery Server Version: current master
- Meshery Client Version: current master
To Reproduce
- Trigger the Nighthawk startup path.
- Make
cmd.Start()fail, or makeos.Stat(transformCommand)fail. - Observe the function hit a manual unlock and then hit the deferred unlock on return.
Contributor Guides and Handbook
- 🛠 Meshery Build & Release Strategy
- 📚 Instructions for contributing to documentation
- 🎨 Wireframes and designs for Meshery UI in Figma (open invite)
- 📺 Self-paced Contributor Trainings
- 🙋🏾🙋🏼 Questions: Discussion Forum and Community Slack