SAM_STOP(3)

πŸ’– SAM_STOP(3) β€” sam_mark_failed πŸ’–

okay bestie, welcome to the Corosync Cluster Engine Programmer's Manual, section 3 πŸŽ€ this one's about sam_mark_failed, and ngl it's the "yeah no this process is DONE" button. let's get into it πŸ¦‹


✨ NAME ✨

sam_mark_failed β€” Mark process failed πŸ’€


✨ SYNOPSIS ✨

#include <corosync/sam.h>

cs_error_t sam_mark_failed (void);

✨ DESCRIPTION ✨

so the sam_mark_failed function is used with SAM_RECOVERY_POLICY_CMAP β€” mostly alongside SAM_RECOVERY_POLICY_RESTART β€” to mark a process failed. periodt.

and like… a process that's been marked failed gets killed without sending the warn signal, and the control process will exit exactly the way it does with the SAM_RECOVERY_POLICY_QUIT policy. 😭

also the Condb key state gets set to failed so the corosync watchdog can take whatever action it needs to take. it's giving "we handled it, the watchdog handles the rest" energy πŸ‘‘


✨ RETURN VALUE ✨

this call returns the CS_OK value if it worked, otherwise an error is returned. simple as that 🫢


✨ ERRORS ✨

here's the vibe-check-failed list, bestie:

  • CS_ERR_BAD_HANDLE β€” the library was not initialized by calling sam_initialize(3), or it was already finalized πŸ™ˆ
  • CS_ERR_INVALID_PARAM β€” the recovery policy doesn't have the SAM_RECOVERY_POLICY_CMAP flag set πŸ’…
  • CS_ERR_LIBRARY β€” some internal error showed up (communication with the parent process) 😭

✨ SEE ALSO ✨

and the lil bonus error-code glossary that comes along with it 🌈

  • CS_ERR_TRY_AGAIN β€” Resource temporarily unavailable
  • CS_ERR_INVALID_PARAM β€” Invalid argument
  • CS_ERR_ACCESS β€” Permission denied
  • CS_ERR_LIBRARY β€” The connection failed
  • CS_ERR_INTERRUPT β€” System call interrupted by a signal
  • CS_ERR_NOT_SUPPORTED β€” The requested protocol/functionality not supported
  • CS_ERR_MESSAGE_ERROR β€” Incorrect auth message received
  • CS_ERR_NO_MEMORY β€” Not enough memory to complete the requested task

lowkey important: once a process is marked failed it's killed with no warn signal β€” no goodbye, no warning shot, just gone. and the Condb key state flips to failed. know that going in, bestie πŸŽ€

that's the whole page, you ate it up fr fr ⭐ this was the corosync Man Page, page SAM_STOP(3), dated 21/05/2010 β€” mwah, go slay some clusters πŸ’–βœ¨πŸ§š

πŸ“¦ where this page comes from