forked from parcel-bundler/watcher
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Segmentation Fault Crash (parcel-bundler#40)
* create repro * debug config * add locking mechanism * tweaks * cleanup * Delete crash.log * Delete tasks.json * up the stress * kind of fixed it * remove segfault-handler for alpine
- Loading branch information
1 parent
23a3678
commit 1f1486b
Showing
8 changed files
with
135 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,6 @@ prebuilds/ | |
node_modules/ | ||
token.txt | ||
.DS_Store | ||
.idea | ||
.idea | ||
stress-test | ||
crash.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "lldb", | ||
"request": "launch", | ||
"name": "Launch Program", | ||
"preLaunchTask": "npm: rebuild", | ||
"program": "node", | ||
"args": ["${workspaceFolder}/stress-test.js"], | ||
"cwd": "${workspaceFolder}" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
const watcher = require('./'); | ||
const path = require('path'); | ||
const fs = require('fs-extra'); | ||
// const SegfaultHandler = require('segfault-handler'); | ||
|
||
// SegfaultHandler.registerHandler('crash.log'); | ||
|
||
let backend = []; | ||
if (process.platform === 'darwin') { | ||
backends = ['fs-events']; | ||
} else if (process.platform === 'linux') { | ||
backends = ['inotify']; | ||
} else if (process.platform === 'win32') { | ||
backends = ['windows']; | ||
} | ||
|
||
async function run(backend) { | ||
console.log('Run Stress Test For:', backend); | ||
|
||
console.log('Initialising...'); | ||
let stressTestDir = path.join(__dirname, 'stress-test'); | ||
await fs.ensureDir(stressTestDir); | ||
await watcher.subscribe(stressTestDir, () => {}, { | ||
backend, | ||
}); | ||
|
||
let currentRunId = 0; | ||
while (true) { | ||
console.log('Running stress test:', currentRunId); | ||
await fs.remove(stressTestDir); | ||
await Promise.all( | ||
new Array(100).fill('').map(async (_, dirName) => { | ||
let dir = path.join(stressTestDir, dirName.toString(10)); | ||
for (let filename = 0; filename < 250; filename++) { | ||
let filepath = path.join(dir, filename.toString(10)); | ||
await fs.outputFile(filepath, ''); | ||
} | ||
await fs.remove(dir); | ||
}), | ||
); | ||
currentRunId++; | ||
} | ||
} | ||
|
||
for (let backend of backends) { | ||
run(backend); | ||
} |