Skip to content

fix: return error instead of panicking on execution engine start failure - #725

Open
RohithPariki wants to merge 1 commit into
apache:masterfrom
RohithPariki:fix-engine-startup-panic
Open

RohithPariki wants to merge 1 commit into
apache:masterfrom
RohithPariki:fix-engine-startup-panic

Conversation

@RohithPariki

Copy link
Copy Markdown

Summary

Improves the reliability and fault tolerance of the server during execution engine initialization by returning an error instead of panicking when the orchestrator fails to start.

Problem

In internal/orchestration/engine.go, StartEngine() handled orchestrator startup failures by logging and immediately executing panic("Could not start execution engine"). In production or managed daemon environments, panicking causes an ungraceful crash with an unhandled stack dump rather than allowing the server supervisor to catch the error, log structured diagnostics, and perform an orderly exit.

Changes

  • internal/orchestration/engine.go: Updated StartEngine() signature to return error. Replaced panic() with returning the orchestrator startup error, and returned nil when no orchestrator backend is configured or upon successful startup.
  • internal/app/app.go: Updated NewServices(...) signature to return (*Services, error), propagating the error if executionEngine.StartEngine() fails.
  • cmd/airavata-server/main.go: Handled the error returned by app.NewServices(...), returning fmt.Errorf("build services: %w", err) to allow runServer() and main() to log the failure cleanly and exit with code 1.
  • internal/server/server_test.go: Updated newHarness to handle the (svcs, err) return signature from app.NewServices(...).

Verification

  • Checked all references to NewServices and StartEngine across the repository to ensure all callers (cmd/airavata-server and internal/server/server_test.go) correctly handle errors.
  • Verified zero breaking changes to public API interfaces.

This commit improves the reliability of the execution engine startup by returning an error up the stack to main instead of immediately panicking, allowing graceful handling of startup failures.
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