workers-sdk
workers-sdk copied to clipboard
๐ BUG: Starting inspector on 0.0.0.0:9229 failed: address already in use
What version of Wrangler are you using?
2.0.26
What operating system are you using?
Pop!_OS 22.04 LTS
Describe the Bug
run pnpm wrangler pages dev -- next dev in next.js project folder.
trying to run with --inspector-port and different port, same result.
checked with netstat, port 9229 and any different ports that i tried not in use.
wrangler did working (serve proxy next dev and /functions).
other software version details: node 16.17.0 with nvm 0.39.1 pnpm 7.9.3
Hey there! Thank you for submitting this bug report.
I can definitely reproduce this issue on macOS 12.4 with pnpm and wrangler 2.0.27. I'm not sure why it's occurring yet though. @petebacondarwin Any ideas?
We'd fixed this problem for plain Worker development, might not have added it to the pages commands. I'll have a look.
@threepointone I appreciate you!
FYI: The related bug for plain workers seems to be #1777 and was fixed in #1786.
I also see this error in the latest wrangler 2.1.8 (and all recent versions before I tested).
Same issue with wranger 2.0.27
2.1.9 issue still here Doesn't work on Linux, WSL2, Docker (Alpine,Ubuntu) Works only on Windows (
2.1.10 issue still here Macos
still seeing with wrangler 2.1.11 on macOS 12.6
same bug on 2.1.13, Ubuntu 22.04, node v.19.0.0.
failed with --inspector-port 9230 too.
I installed wrangler 2.0.29 instead.
sudo npm install -g [email protected]
Now it is working. But, the same bug Starting inspector on 0.0.0.0:9229 failed: address already in use is still there in the log.
Compiling worker to "/tmp/functionsWorker-0.18839135994122236.js"...
Compiled Worker successfully.
Retrieving cached values for userId from node_modules/.cache/wrangler
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ [b open a [d open [c clear [x to โ
โ browser, Devtools, console, exit โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
Starting inspector on 0.0.0.0:9229 failed: address already in use
[pages:wrn] Service bindings are experimental. There may be breaking changes in the future.
[pages:inf] Worker reloaded! (23.59KiB)
[pages:inf] Listening on 0.0.0.0:8788
[pages:inf] - http://127.0.0.1:8788
[pages:inf] - http://192.168.86.44:8788
[pages:inf] Updated `Request.cf` object cache!
GET / 200 OK (53.32ms)
GET /favicon.ico 200 OK (25.28ms)
And then I found another problem. In 2.0.19, the --kv MY_TABLE isn't read from file. Here the KV tables are in memory only. So I tested 2.1.1 and found out that it worked same as 2.0.19 in regards to both bugs. And then I randomly selected 2.0.6 and found that it will both read KV from disk and work.
i'm still seeing this on wrangler dev --local on 2.2.1. no matter the port supplied either via --inspector-port or the inspector_port value in the wrangler.toml, the address is always considered in use when there is nothing running on the provided port
I'm seeing this issue on 2.4.0. i made some comments in #1864 that I think might help in debugging this. I suspect it's simply that the inspectPort is passed to the miniflare cli command on top of the pages dev command so they both are unable to start.
Running --inspect-port 0 doesn't fix the issue. Just FYI this blocks development if using the cloudflare/pages template in remix-run.
Seems to work on Wrangler 2.4.2 though the warning itself still shows.
I'm experiencing this issue (or similar?) on 2.4.2 when using --experimental-local. I don't have this issue with --local.
*** Fatal uncaught kj::Exception: kj/async-io-unix.c++:945: failed: ::bind(sockfd, &addr.generic, addrlen): Address already in use; toString() = 127.0.0.1:9229
stack: /home/redacted/node_modules/@cloudflare/workerd-linux-64/bin/workerd@2b55fca /home/redacted/node_modules/@cloudflare/workerd-linux-64/bin/workerd@2b55d6f /home/redacted/node_modules/@cloudflare/workerd-linux-64/bin/workerd@2b54105 /home/redacted/node_modules/@cloudflare/workerd-linux-64/bin/workerd@14f6295 /home/redacted/node_modules/@cloudflare/workerd-linux-64/bin/workerd@2b1f0f6 /home/redacted/node_modules/@cloudflare/workerd-linux-64/bin/workerd@14f6570 /home/redacted/node_modules/@cloudflare/workerd-linux-64/bin/workerd@14c584d /home/redacted/node_modules/@cloudflare/workerd-linux-64/bin/workerd@14c4e48 /home/redacted/node_modules/@cloudflare/workerd-linux-64/bin/workerd@14c4bec /home/redacted/node_modules/@cloudflare/workerd-linux-64/bin/workerd@2b8b298 /home/redacted/node_modules/@cloudflare/workerd-linux-64/bin/workerd@2b8ae89 /home/redacted/node_modules/@cloudflare/workerd-linux-64/bin/workerd@2b6f6a8 /home/redacted/node_modules/@cloudflare/workerd-linux-64/bin/workerd@2b88fc8 /home/redacted/node_modules/@cloudflare/workerd-linux-64/bin/workerd@14ba289 /usr/lib/libc.so.6@2328f /usr/lib/libc.so.6@23349 /home/redacted/node_modules/@cloudflare/workerd-linux-64/bin/workerd@14ba024
โ [ERROR] local worker: MiniflareCoreError [ERR_RUNTIME_FAILURE]: The Workers runtime failed to start. There is likely additional logging output above.
at Miniflare.#waitForRuntime
(/home/redacted/node_modules/@miniflare/tre/dist/src/index.js:6121:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Miniflare.#init
(/home/redacted/node_modules/@miniflare/tre/dist/src/index.js:6011:9)
at async Mutex.runWith
(/home/redacted/node_modules/@miniflare/tre/dist/src/index.js:2284:16)
at async startLocalWorker
(/home/redacted/node_modules/wrangler/wrangler-dist/cli.js:144106:11)
{
code: 'ERR_RUNTIME_FAILURE',
cause: undefined
}
The port wasn't already running, and changing the port number with the flag didn't change anything. Wrangler doesn't immediately terminate, and during that time, the port is in use until it exits. I'm not able to run the worker at all during this, unfortunately.
If easy to implement, could we possibly get a flag to disable the inspector entirely to avoid such issues? There's one to change the port, after all.
I solved it with add --ip '127.0.0.1'.
wrangler pages dev . --ip '127.0.0.1'
Seeing this issue with Wrangler 3 as well. Exact same issue and message that @FunPineapple described. Windows, WSL.
npx wrangler dev pages public results in:
*** Fatal uncaught kj::Exception: kj/async-io-unix.c++:945: failed: ::bind(sockfd, &addr.generic, addrlen): Address already in use; toString() = 127.0.0.1:87881502024
stack:
/home/project/node_modules/@cloudflare/workerd-linux-64/bin/workerd@2e82fda
/home/project/node_modules/@cloudflare/workerd-linux-64/bin/workerd@2e82d7f
/home/project/node_modules/@cloudflare/workerd-linux-64/bin/workerd@2e80fe5
/home/project/node_modules/@cloudflare/workerd-linux-64/bin/workerd@154ba55
/home/project/node_modules/@cloudflare/workerd-linux-64/bin/workerd@154c3d0
/home/project/node_modules/@cloudflare/workerd-linux-64/bin/workerd@150cfdd
/home/project/node_modules/@cloudflare/workerd-linux-64/bin/workerd@1511d47
/home/project/node_modules/@cloudflare/workerd-linux-64/bin/workerd@1511ac4
/home/project/node_modules/@cloudflare/workerd-linux-64/bin/workerd@1511aac
/home/project/node_modules/@cloudflare/workerd-linux-64/bin/workerd@2eb9858
/home/project/node_modules/@cloudflare/workerd-linux-64/bin/workerd@2eb9449
/home/project/node_modules/@cloudflare/workerd-linux-64/bin/workerd@2eb7708
/home/project/node_modules/@cloudflare/workerd-linux-64/bin/workerd@2eb74ca
/home/project/node_modules/@cloudflare/workerd-linux-64/bin/workerd@1502293
/lib/x86_64-linux-gnu/libc.so.6@29d8f /lib/x86_64-linux-gnu/libc.so.6@29e3f
/home/project/node_modules/@cloudflare/workerd-linux-64/bin/workerd@1502024
I too am having the same issue when attempting to attach a debugger to the existing process.
hi folks, are y'all still experiencing this issue with latest wrangler version?