A small desktop app had a familiar failure: leave its window open for a while, come back, and scanning no longer works. The window was still there. The local server behind it was not. In the server log, ten of sixteen launches ended with an automatic shutdown message. Closing the app normally followed a different path, so the repeated shutdowns deserved their own explanation.

The heartbeat was asking the wrong question

The window displayed a web view that sent a ping to the server. The original rule was simple: if no ping arrived for twenty seconds, the server assumed the app was gone and exited. That sounds like cleanup, but it quietly equated two different things. A web view that cannot run a JavaScript timer is not necessarily a closed app.

One hidden-window observation made the distinction visible. After the window had been covered for eight minutes and twenty-seven seconds, the web view stopped sending pings. The old rule would have shut the server down twenty seconds later, leaving an apparently open app with nothing behind its scan button. The log captured the missed ping; when the window became active again, it captured the ping returning. The signal had gone away and come back while the app itself remained open.

Let the parent tell the server when it is gone

The app now holds the writing end of a pipe connected to the server's standard input. When the app exits, that pipe closes and the server sees end of file. The ping remains useful as a diagnostic observation, but missing it no longer counts as proof that the parent is dead. Shutdown logs include the reason and the age of the last ping, so a future failure leaves evidence instead of an ambiguous silence.

The new path was tried with an ordinary quit and with the app process killed; in both cases the server exited within a second and recorded the pipe closing. In a separate ten-minute hidden-window test, the server stayed up and two scans worked afterward. Those tests support the narrower conclusion: this app can survive a suspended web-view timer and still shut down when its parent disappears. The physical close and minimize controls, and the recovery banner on screen, were not visually tested in that session.

The mistake was not that a timer stopped. It was treating the timer as an authority on whether the whole app existed. A heartbeat is only as reliable as the thing that has to send it.