Skip to content
This repository was archived by the owner on Aug 7, 2023. It is now read-only.
This repository was archived by the owner on Aug 7, 2023. It is now read-only.

Responsibly aborting in node #18

Description

@Raynos

Based on a conversation with @benjamingr ( groundwater/nodejs-symposiums#5 (comment) ).

We recommend aborting and core dumps as the debugging best practice. However we don't document how to do so responsibly to ensure uptime and availability.

People object to exiting and restarting as its a potential DDOS attack vector, I've brushed this off in the past by saying "it's a bug. Just get paged and fix this bug", however I no longer think this can be ignored for a few reasons

  • I've seen accidental internal DDOS due to cascading failures.
  • I've seen how even 10 minutes of outage can lose millions in revenue.
  • I've even seen accidental DDOS simply due to an embedded gossip library having a corruptive bug.
  • I've seen a fleet of servers being destroyed due to a single user uuid and round robin load balancing

I 100% believe a core dump is the only way to debug that 1 in a 100 edgecase. We all speak positively about how amazing post mortem debugging is but there is little sharing around how to do so responsibly.

Here is a straw man suggestion and I would love feedback:

  • a programmer error is a bug and needs human attention to verify any undefined state. We recommend setting up alerts or email notifications and verifying the impact of the programmer error.
  • running an available service is important, you cannot just abort without consequence. You need a technique to avoid repeated aborting.

We could implement --abort-on-uncaught-exception-once=filepath flag.

  • it would check the file on filepath, if it exists, read the value of the file as Unix time stamp (second granularity).
  • if the time is less then 24hr in the past then instead of aborting create an error and pass it to process.on(uncaughtException)
  • if the file does not exist or time is greater then 24hr in the past then write the current Unix time stamp (second granularity) to the file then continue to abort.

This functionality could be implemented outside of node core. If it is we have to clearly in the node core documentation, instruct people how to use --abort-on-uncaught-exception safely.

Because the process will not abort for 24hr the application developer must use process.on(uncaughtException) to avoid exiting and to be able to degrade to partial availability.

I would love to hear some feedback on how to best responsibly use post mortem debugging techniques

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions