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

Watch + node --inspect failed: address already in use #1776

Closed
noygal opened this issue Jul 23, 2018 · 3 comments
Closed

Watch + node --inspect failed: address already in use #1776

noygal opened this issue Jul 23, 2018 · 3 comments

Comments

@noygal
Copy link

noygal commented Jul 23, 2018

🐛 bug report

When trying to use parcel middleware feature with the node --inspect flag on I get consecutive errors:

$node --inspect server.js
Debugger listening on ws://127.0.0.1:9229/fde5fc2f-e474-454c-ba0a-6b47e78970fa
For help see https://nodejs.org/en/docs/inspector
⠋ Building...Starting inspector on 127.0.0.1:9229 failed: address already in use
Starting inspector on 127.0.0.1:9229 failed: address already in use
✨  Built in 83ms.
Starting inspector on 127.0.0.1:9229 failed: address already in use
Starting inspector on 127.0.0.1:9229 failed: address already in use
Starting inspector on 127.0.0.1:9229 failed: address already in use
Starting inspector on 127.0.0.1:9229 failed: address already in use
Starting inspector on 127.0.0.1:9229 failed: address already in use
Starting inspector on 127.0.0.1:9229 failed: address already in use

🎛 Configuration (server.js, index.html)

const Bundler = require('../parcel/src/Bundler');
const app = require('express')();

const file = 'index.html'; // Pass an absolute path to the entrypoint here
const options = {
  watch: true
}; // See options section of api docs, for the possibilities

// Initialize a new bundler using a file and options
const bundler = new Bundler(file, options);

// Let express use the bundler middleware, this will let Parcel handle every request over your express server
app.use(bundler.middleware());

// Listen on port 8080
app.listen(8080);
<html>
<body>
</body>
</html>

🤔 Expected Behavior

I should be able to use node --inspect feature, it solidly work till v1.8.1

😯 Current Behavior

I cannot launch my sever with debug tools turned on

💁 Possible Solution

I investigate the issue for couple of hours, my immediate suspect was the workfarm: https://github.com/noygal/parcel/tree/master/src/workerfarm , but this wasn't the issue.

The real issue was with a similar code found in the watcher dependency:
https://github.com/DeMoorJasper/fswatcher-child

The code is nearly identical to the workfarm code, so I open a PR with the fix that exist on parcel:
DeMoorJasper/fswatcher-child#2

In any case I would migrate this code to parcel package itself, such a sensitive (and duplicated) code should be under parcel package ownership.

🔦 Context

💻 Code Sample

🌍 Your Environment

Software Version(s)
Parcel > 1.8.1
Node > 4
npm/Yarn N/A
Operating System N/A
@DeMoorJasper
Copy link
Member

I can confirm this bug, also had it last time I tried to performance test Parcel

@reduardo7
Copy link

Maybe it's related to nodejs/node#9435

@DeMoorJasper
Copy link
Member

Should be resolved, was an issue with the watcher

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

No branches or pull requests

3 participants