Opened 5 years ago

Closed 5 years ago

#6206 defect closed duplicate (duplicate)

MultiService.stopService doesn't handle failures in startService

Reported by: Itamar Turner-Trauring Owned by:
Priority: normal Milestone:
Component: core Keywords:
Cc: Dustin J. Mitchell Branch:
Author:

Description

Imagine a MultiService with subservices A and B. It starts A, which throws an exception. Since there's no exception handler, MultiService.startService will pass the exception up the call stack, and B will therefore not be started. Now when MultiService.stopService is called, B.stopService will also be called, which is wrong, since B was never started.

One solution is to have MultiService to track which services it has successfully started in startService, and only stop those when stopService is called.

Alternatively, if A.startService throws an exception, perhaps B.startService should be called anyway.

In either case there's the question of whether A.stopService should be called if A.startService threw an exception. If the answer is "no", then perhaps we need to fix that in twisted.application.app.startApplication as well.

Change History (2)

comment:1 Changed 5 years ago by Dustin J. Mitchell

Cc: Dustin J. Mitchell added

comment:2 Changed 5 years ago by Jean-Paul Calderone

Resolution: duplicate
Status: newclosed

Exact duplicate of #495, which I already mentioned in #6202.

Note: See TracTickets for help on using tickets.