{"id":22427245,"url":"https://github.com/node-3d/segfault-raub","last_synced_at":"2025-08-01T10:31:51.953Z","repository":{"id":36370896,"uuid":"208971527","full_name":"node-3d/segfault-raub","owner":"node-3d","description":"Catches SIGSEGV and prints diagnostic information","archived":false,"fork":false,"pushed_at":"2024-11-04T19:11:17.000Z","size":490,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-25T10:01:53.362Z","etag":null,"topics":["addon","debug","native","node-3d","segfault","sigsegv"],"latest_commit_sha":null,"homepage":"https://github.com/node-3d/node-3d","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"ddopson/node-segfault-handler","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/node-3d.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-17T06:03:48.000Z","updated_at":"2024-11-08T10:22:51.000Z","dependencies_parsed_at":"2024-11-25T10:00:54.528Z","dependency_job_id":"69e7fa38-008c-446b-87a4-4f2a774a9a4b","html_url":"https://github.com/node-3d/segfault-raub","commit_stats":{"total_commits":188,"total_committers":25,"mean_commits":7.52,"dds":"0.30319148936170215","last_synced_commit":"9c1cbf72b1df58f1cf93a410237ffbe58a77f580"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-3d%2Fsegfault-raub","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-3d%2Fsegfault-raub/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-3d%2Fsegfault-raub/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-3d%2Fsegfault-raub/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/node-3d","download_url":"https://codeload.github.com/node-3d/segfault-raub/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228364059,"owners_count":17908319,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["addon","debug","native","node-3d","segfault","sigsegv"],"created_at":"2024-12-05T20:11:16.914Z","updated_at":"2024-12-05T20:11:17.788Z","avatar_url":"https://github.com/node-3d.png","language":"C++","readme":"# Segfault handler for Node.js\n\nThis is a part of [Node3D](https://github.com/node-3d) project.\n\n[![NPM](https://badge.fury.io/js/segfault-raub.svg)](https://badge.fury.io/js/segfault-raub)\n[![ESLint](https://github.com/node-3d/segfault-raub/actions/workflows/eslint.yml/badge.svg)](https://github.com/node-3d/segfault-raub/actions/workflows/eslint.yml)\n[![Test](https://github.com/node-3d/segfault-raub/actions/workflows/test.yml/badge.svg)](https://github.com/node-3d/segfault-raub/actions/workflows/test.yml)\n\n```\nnpm i -s segfault-raub\n```\n\nThis module report debug information on process crash (and some other events).\nIt doesn't affect the performance while the program is running normally.\n\nThe module prints to both\n**STDERR** and to the **\"segfault.log\"** file (if it exists inside **\"working directory\"**).\nIf there is no such file, it\n**won't be created**, so it is up to you if the log-file is needed.\n\n\u003e Note: this **addon uses N-API**, and therefore is ABI-compatible across different\nNode.js versions. Addon binaries are precompiled and **there is no compilation**\nstep during the `npm i` command.\n\nA zero-setup is available: just require the module and it comes pre-equipped with several\nsignal listeners enabled by default.\n\n```js\nrequire('segfault-raub');\n```\n\n\u003e Note: if your project tree contains multiple versions of this module, the first one imported\nwill seize `global['segfault-raub']`. The rest of them will only re-export `global['segfault-raub']`\nand **WILL NOT** import their own **binaries**.\n\n---\n\nIf you want to use a custom location instead of \"**segfault.log**\", use:\n\n```js\nrequire('segfault-raub').setLogPath(\"C:/my/log/file.txt\");\n```\n\n**You must create this file first, it must be there when the crash happens.**\n\nSee the [TypeScript declarations](/index.d.ts) with comments.\n\n\n## Configuring Signals\n\nAs listed below, some signals (platform specific) are enabled by default. But they can be\nenabled/disabled manually:\n\nExample:\n\n```js\nconst {\n    setSignal,\n    EXCEPTION_ACCESS_VIOLATION, SIGSEGV,\n    EXCEPTION_BREAKPOINT, SIGTRAP,\n} = require('segfault-raub');\n\nsetSignal(EXCEPTION_ACCESS_VIOLATION, false);\nsetSignal(SIGSEGV, false);\n\nsetSignal(EXCEPTION_BREAKPOINT, true);\nsetSignal(SIGTRAP, true);\n\n// This enables capturing every signal on Windows.\nsetSignal(EXCEPTION_ALL, true);\n```\n\nOn **Windows**, all the **Unix** signals are `null`, and the opposite is true.\nPassing `null` as the first parameter to `setSignal` **has no effect and is safe**.\n\n\n## Demo Methods\n\nThese are be helpful to see how the signals are reported and if the log files are being written properly.\n\n* `causeSegfault` - Causes a memory access violation.\n* `causeDivisionInt` - Divides an integer by zero.\n* `causeOverflow` - Runs infinite recursion (stack overflow).\n* `causeIllegal` - Raises an \"illegal instruction\" exception.\n\nExample:\n\n```js\nconst { causeSegfault } = require('segfault-raub');\ncauseSegfault();\n```\n\n\n## Windows Signals\n\n| Signal                             | Enabled | Description                                        |\n| :---                               | :---:   | :---                                               |\n| EXCEPTION_ALL                      | no      | All of the below.                                  |\n| EXCEPTION_ACCESS_VIOLATION         | yes     | Memory access was denied.                          |\n| EXCEPTION_ARRAY_BOUNDS_EXCEEDED    | yes     | Array was accessed with an illegal index.          |\n| EXCEPTION_INT_DIVIDE_BY_ZERO       | yes     | Attempt to divide by an integer divisor of 0.      |\n| EXCEPTION_ILLEGAL_INSTRUCTION      | yes     | Attempt to execute an illegal instruction.         |\n| EXCEPTION_NONCONTINUABLE_EXCEPTION | yes     | Can't continue after an exception.                 |\n| EXCEPTION_STACK_OVERFLOW           | yes     | The thread used up its stack.                      |\n| EXCEPTION_INVALID_HANDLE           | yes     | An invalid handle was specified.                   |\n| EXCEPTION_FLT_DIVIDE_BY_ZERO       | no      | Attempt to divide by a float divisor of 0.f.       |\n| EXCEPTION_DATATYPE_MISALIGNMENT    | no      | A datatype misalignment was detected.              |\n| EXCEPTION_BREAKPOINT               | no      | A Breakpoint has been reached.                     |\n| EXCEPTION_SINGLE_STEP              | no      | Continue single-stepping execution.                |\n| EXCEPTION_FLT_DENORMAL_OPERAND     | no      | One of the operands is denormal.                   |\n| EXCEPTION_FLT_INEXACT_RESULT       | no      | The result cannot be represented exactly.          |\n| EXCEPTION_FLT_INVALID_OPERATION    | no      | Floating-point invalid operation.                  |\n| EXCEPTION_FLT_OVERFLOW             | no      | The exponent of operation is too large.            |\n| EXCEPTION_FLT_STACK_CHECK          | no      | The Stack gone bad after a float operation.        |\n| EXCEPTION_FLT_UNDERFLOW            | no      | The exponent of operation is too low.              |\n| EXCEPTION_INT_OVERFLOW             | no      | The result of operation is too large.              |\n| EXCEPTION_PRIV_INSTRUCTION         | no      | Operation is not allowed in current mode.          |\n| EXCEPTION_IN_PAGE_ERROR            | no      | Can't access a memory page.                        |\n| EXCEPTION_INVALID_DISPOSITION      | no      | Invalid disposition returned.                      |\n| EXCEPTION_GUARD_PAGE               | no      | Accessing PAGE_GUARD-allocated modifier.           |\n\n\n## Unix Signals\n\n| Signal     | Handling | Enabled | Description                                        |\n| :---       | :---:    | :---:   | :---                                               |\n| SIGABRT    |    A     | yes     | Process abort signal.                              |\n| SIGFPE     |    A     | yes     | Erroneous arithmetic operation.                    |\n| SIGSEGV    |    A     | yes     | Invalid memory reference.                          |\n| SIGILL     |    A     | yes     | Illegal instruction.                               |\n| SIGBUS     |    A     | yes     | Access to an undefined portion of a memory object. |\n| SIGTERM    |    T     | no      | Termination signal.                                |\n| SIGINT     |    T     | no      | Terminal interrupt signal.                         |\n| SIGALRM    |    T     | no      | Alarm clock.                                       |\n| SIGCHLD    |    I     | no      | Child process terminated, stopped, or continued.   |\n| SIGCONT    |    C     | no      | Continue executing, if stopped.                    |\n| SIGHUP     |    T     | no      | Hangup.                                            |\n| SIGKILL    |    T     | no      | Kill (cannot be caught or ignored).                |\n| SIGPIPE    |    T     | no      | Write on a pipe with no one to read it.            |\n| SIGQUIT    |    A     | no      | Terminal quit signal.                              |\n| SIGSTOP    |    S     | no      | Stop executing (cannot be caught or ignored).      |\n| SIGTSTP    |    S     | no      | Terminal stop signal.                              |\n| SIGTTIN    |    S     | no      | Background process attempting read.                |\n| SIGTTOU    |    S     | no      | Background process attempting write.               |\n| SIGUSR1    |    T     | no      | User-defined signal 1.                             |\n| SIGUSR2    |    T     | no      | User-defined signal 2.                             |\n| SIGPROF    |    T     | no      | Profiling timer expired.                           |\n| SIGSYS     |    A     | no      | Bad system call.                                   |\n| SIGTRAP    |    A     | no      | Trace/breakpoint trap.                             |\n| SIGURG     |    I     | no      | High bandwidth data is available at a socket.      |\n| SIGVTALRM  |    T     | no      | Virtual timer expired.                             |\n| SIGXCPU    |    A     | no      | CPU time limit exceeded.                           |\n| SIGXFSZ    |    A     | no      | File size limit exceeded.                          |\n\n* `T` - Abnormal termination of the process.\n* `A` - Abnormal termination of the process with additional actions.\n* `I` - Ignore the signal.\n* `S` - Stop the process.\n* `C` - Continue the process, if it is stopped; otherwise, ignore the signal.\n\n\n## Legal notice\n\nThis package is derived from [segfault-handler](https://github.com/ddopson/node-segfault-handler).\nThe original licensing rules apply, see `LICENSE_node-segfault-handler`.\n\nAlso this project uses [callstack walker](https://github.com/JochenKalmbach/StackWalker)\nwhich is licensed under BSD-2 Clause.\n\nThe rest of this package (the newly introduced files) is licensed under MIT.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnode-3d%2Fsegfault-raub","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnode-3d%2Fsegfault-raub","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnode-3d%2Fsegfault-raub/lists"}