Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Receives SIGTERM during "DDoS" #821

Open
Maxim-Mazurok opened this issue Jun 20, 2022 · 1 comment
Open

Receives SIGTERM during "DDoS" #821

Maxim-Mazurok opened this issue Jun 20, 2022 · 1 comment
Labels

Comments

@Maxim-Mazurok
Copy link

Environment Versions

  1. OS Type: Windows 11
  2. Node version: $ node --version v16.3.0
  3. http-server version: $ http-server --version v14.1.0

Steps to reproduce

  1. Run this code:
    const serveProcess = childProcess.exec('http-server -a :: -p 3000 -c-1 ./dist');
    
    serveProcess.stdout.on('data', (data) => {
        console.log(data);
    });
    
    serveProcess.stderr.on('data', (data) => {
        console.error(data);
    });
    
    serveProcess.on('close', (code, signal) => {
        console.log(`Server process closed with code ${code} or signal ${signal}`);
        process.exit();
    });
    serveProcess.on('exit', (code, signal) => {
        console.log(`Server process exited with code ${code} or signal ${signal}`);
    });
  2. Clone https://github.com/talentlessguy/simple-ddos and run node demo/app.js
  3. Wait for a bit, observe the first script reporting:
    Server process exited with code 1 or signal null
    Server process closed with code 1 or signal null
    
  4. Try to run the server script again, observe error:
    code: 'EADDRINUSE',
    errno: -4091,
    syscall: 'listen',
    address: '::',
    port: 3000
    

(you can run npx -y kill-port 3000 to forcefully kill the http-server)

Expected result

I expect http-server not to receive SIGTERM signal. I'm pretty sure that it's sending it to itself somehow?

Actual result

See in repro steps

Other information

My use-case is running cypress tests using http-server, and when I disabled cache using -c-1 - it started to fail midway. When I run tests individually - they pass, but when I run them all sequentially - the server gets sigterm signal.

I'll probably just ignore it because despite the server getting this signal, it still continues to work just fine.

This is kinda a problem when I do want to kill it tho, once all tests are done. Because tree-kill npm module that I use normally to kill http-server, doesn't work in this scenario.

@github-actions
Copy link

This issue has been inactive for 180 days

@github-actions github-actions bot added the stale label Dec 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant