Socket
Socket
Sign inDemoInstall

@snyk/node-dump-stacks

Package Overview
Dependencies
14
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.7.0 to 1.8.0

2

CMakeLists.txt

@@ -15,3 +15,3 @@ # This is not part of the project, it's here to help out CLion.

# the version is not otherwise important
$ENV{HOME}/.cache/node-gyp/16.15.1/include/node)
$ENV{HOME}/.cache/node-gyp/18.14.0/include/node)

@@ -18,0 +18,0 @@ add_executable(node_dump_stacks

{
"name": "@snyk/node-dump-stacks",
"version": "1.7.0",
"version": "1.8.0",
"main": "index.js",

@@ -18,10 +18,10 @@ "scripts": {

"@babel/preset-typescript": "^7.13.0",
"@types/jest": "^28.1.4",
"@types/jest": "^29.5.0",
"bunyan": "^1.8.15",
"jest": "^28.1.2",
"jest": "^29.5.0",
"node-gyp": "^9.0.0",
"pino-pretty": "^9.1.1",
"prettier": "~2.7.1"
"pino-pretty": "^10.0.0",
"prettier": "~2.8.7"
},
"gypfile": true
}

@@ -14,5 +14,4 @@ # node-dump-stacks

```
% node test/child.js 1100
{"name":"dump-stacks","blockedMs":1042,"stack":"burnFor (/foo/test/child.js:18:5)\nmain (/foo/test/child.js:6:3)\n/foo/test/child.js:27:1\nModule._compile (internal/modules/cjs/loader.js:1138:30)\n[..]run_main_module.js:17:47\n"}
{"name":"dump-stacks","blockedMs":1100,"stack":"burnFor (/foo/test/child.js:18:5)\nmain (/foo/test/child.js:10:3)\n"}
% node test/child-initial-delays.js 1200
{"name":"dump-stacks","blockedMs":1203,"stack":"burnFor (/foo/test/child-initial-delays.js:22:5)\n/foo/test/child-initial-delays.js:12:3\n"}
```

@@ -23,4 +22,3 @@

processing of sourcemaps is done, and no attempt is made to hide the node internals.
`async` stack traces are not processed, which means the second stack is shorter,
as it's after an `async` event.
`async` stack traces are not processed.

@@ -46,3 +44,9 @@

As this is a native module, it is sensitive to `node` build and runtime versions. That is, you cannot build on one
version, then run on a different version, and you cannot build on one platform and run on another.
There are no binaries available for this package, either in the source, in the npm package, or in THE CLOUD.
If you are struggling with CI vs. docker image, consider adding `npm rebuild` to your `Dockerfile`, which will
isolate your production build from your CI build.
## Local development

@@ -71,2 +75,3 @@ Node v14, v16 and v18 are currently supported. Other versions are likely to work, PRs accepted.

attempting to report blocks.
* `DUMP_STACKS_OUTPUT_STDOUT=1`: Output blocked event loop logs to stdout. Defaults to stderr.
* `DUMP_STACKS_ENABLED=false`: Do Nothing At All; don't even execute the native module

@@ -73,0 +78,0 @@

import { ChildProcess, spawnSync } from 'child_process';
describe('running the child', () => {
it('fires twice', async () => {
it('fires twice to stderr without including DUMP_STACKS_STDOUT_OUTPUT', async () => {
const child = spawnSync(

@@ -9,3 +9,3 @@ process.argv[0],

{
stdio: ['ignore', 'inherit', 'pipe'],
stdio: ['ignore', 'pipe', 'pipe'],
encoding: 'utf-8',

@@ -51,2 +51,49 @@ env: {

it('fires twice to stdout when DUMP_STACKS_STDOUT_OUTPUT=1', async () => {
const child = spawnSync(
process.argv[0],
[require.resolve('./child'), '250'],
{
stdio: ['ignore', 'pipe', 'pipe'],
encoding: 'utf-8',
env: {
DUMP_STACKS_OBSERVE_MS: '10',
DUMP_STACKS_CHECK_MS: '10',
DUMP_STACKS_REPORT_ONCE_MS: '100',
DUMP_STACKS_IGNORE_INITIAL_SPINS: '0',
DUMP_STACKS_STDOUT_OUTPUT: '1'
},
},
);
if (child.error) {
throw child.error;
}
expect([child.status, child.signal]).toEqual([0, null]);
const prefix = '{"name":"dump-stacks"';
expect(child.stdout).toContain(prefix);
const lines = child.stdout
.split('\n')
.filter((line) => line.startsWith(prefix))
.map((line) => JSON.parse(line));
expect(lines).toHaveLength(2);
expect(lines[0]).toMatchObject({
name: 'dump-stacks',
blockedMs: expect.any(Number),
stack: expect.stringContaining('burnFor'),
});
expect(lines[0].blockedMs).toBeGreaterThan(250 - 10 - 10);
expect(lines[0].blockedMs).toBeLessThan(500);
expect(lines[1]).toMatchObject({
name: 'dump-stacks',
blockedMs: expect.any(Number),
stack: expect.stringContaining('burnFor'),
});
expect(lines[1].blockedMs).toBeGreaterThan(250 - 10 - 10);
expect(lines[1].blockedMs).toBeLessThan(500);
});
it('captures total block time', async () => {

@@ -53,0 +100,0 @@ const child = spawnSync(

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc