In pipeline the spinner keeps spinning even when the application crashed/stopped

Hello,

Problem description

I’m using pipeline to select some settings for my plots (1st step), and then (2nd pipeline step) perform necessary computations and show plots. The problem is that sometimes the computations crash due to some memory problems and the panel serve ... process gets killed. I would like to inform the user that something went wrong.

Example

The problem is that generally even if the app stops, the user does not know about this.
Below there is a simple app, that waits 3 seconds, and then displays hello message. In gif below you see that when I stop the application, the spinner keeps spinning and the user is unaware of the problem.

import panel as pn
import param
from time import sleep


class Settings(param.Parameterized):
    def panel(self):
        return pn.pane.Markdown('This is phase 1')

    
class Plots(param.Parameterized):
    def panel(self):
        sleep(3)
        return pn.pane.Markdown('** Hello from phase 2 **')


pipeline = pn.pipeline.Pipeline(
    stages=[('Settings', Settings), ('Plots', Plots)],
)

pn.Column(
    pipeline.title,
    pipeline.buttons,
    pipeline.network,
    pipeline.stage
).servable()

Could you advice me on how to tackle this problem?