diff --git a/locust/main.py b/locust/main.py index 67b278f8a1..91b449e4f9 100644 --- a/locust/main.py +++ b/locust/main.py @@ -544,6 +544,9 @@ def assign_equal_weights(environment, **kwargs): # Fire locust init event which can be used by end-users' code to run setup code that # need access to the Environment, Runner or WebUI. environment.events.init.fire(environment=environment, runner=runner, web_ui=web_ui) + if log.unhandled_greenlet_exception: + # treat exceptions in init handlers as fatal. They are already logged so no need to log anything more. + sys.exit(1) if web_ui: web_ui.start()