@@ -213,6 +213,9 @@ async def __invoke_accumulator(
213213 _ = await new_instance (request_iterator , output )
214214 # send EOF to the output stream
215215 await output .put (STREAM_EOF )
216+ except asyncio .CancelledError :
217+ # Task cancelled during shutdown (e.g. SIGTERM) — not a UDF fault.
218+ return
216219 # If there is an error in the accumulator operation, log and
217220 # then send the error to the result queue
218221 except BaseException as err :
@@ -243,6 +246,9 @@ async def process_input_stream(self, request_iterator: AsyncIterable[Accumulator
243246 case _:
244247 _LOGGER .debug (f"No operation matched for request: { request } " , exc_info = True )
245248
249+ except asyncio .CancelledError :
250+ # Task cancelled during shutdown (e.g. SIGTERM) — not a UDF fault.
251+ return
246252 # If there is an error in the accumulator operation, log and
247253 # then send the error to the result queue
248254 except BaseException as e :
@@ -274,6 +280,9 @@ async def process_input_stream(self, request_iterator: AsyncIterable[Accumulator
274280
275281 # Now send STREAM_EOF to terminate the global result queue iterator
276282 await self .global_result_queue .put (STREAM_EOF )
283+ except asyncio .CancelledError :
284+ # Task cancelled during shutdown (e.g. SIGTERM) — not a UDF fault.
285+ return
277286 except BaseException as e :
278287 err_msg = f"Accumulator Streaming Error: { repr (e )} "
279288 _LOGGER .critical (err_msg , exc_info = True )
0 commit comments