some time ago, in a project not so far away, we had a problem. :) a connection-less channel had to be used for polling between two services, to detect failures/reboots on remote ends. it was meant not to use “too much bandwidth”, so connection was checked every 15[s], or so. there was one “surprise” awaiting though – what will happen if remote end will manage to restart in between two checks? crash will not be detected and application states will get out of sync! the answer was simple – add a boot-ID.
boot-ID is a simple, pseudo-random string, that is re-generated by an application upon each start and is never stored persistently. this way, each time application starts, it gets new boot-ID. adding this mechanism to heartbeats/ping-pong messages, polling can be arbitrary long and still detect a failure, since each time reboot/reset occurs, new boot-ID is assigned thus remote application knows “logical connection” was lost.
UUID is an example of possible boot-ID, but in fact any string will do, as long as it is not probable to get the same ID twice in a row. mechanism is trivial to implement and bullet-proof in real-life.