monorepo with multiple workers - does each one need a separate worker registry?

I'm running multiple workers at once, and getting the following error: ✘ [ERROR] failed to start worker registry Error: listen EADDRINUSE: address already in use 127.0.0.1:6284 Should I set the (undocumented) WRANGLER_WORKER_REGISTRY_PORT env var for each of them, or is it nothing to worry about? 🙂
36 Replies
Hello, I’m Allie!
There should only be one for your entire device
daniel_klungo
daniel_klungoOP6mo ago
Roger that! Thanks for the reply 🙂
Hello, I’m Allie!
Since it is complaining about a port-in-use, my guess is that some other app is listening on it, and for whatever reason isn’t responding like a Registry should
daniel_klungo
daniel_klungoOP6mo ago
Oh, I just figured it was because I’m launching several workers at once, and one of the previous ones have started the registry
Hello, I’m Allie!
May be that? It may have claimed the port, but not actually started the Registry? Basically, the Registry is used to facilitate multi-Worker comms, like Service Bindings
daniel_klungo
daniel_klungoOP6mo ago
I have a port cleanup script I run in cases like these, and it finds nothing in the port at least when running it after shutting down the processes.
Hello, I’m Allie!
Maybe try starting the first process, give it time to settle, then start the others?
daniel_klungo
daniel_klungoOP6mo ago
That sounds possible! They’re launched at the same time, so might not have reached the serving state yet
Hello, I’m Allie!
Otherwise, might be good to file a bug report
daniel_klungo
daniel_klungoOP6mo ago
A bug report might be better then, given that this probably happen for other people using turborepo with multiple workers too
Hello, I’m Allie!
I can make it when I get back in a bit, if that is easier?
daniel_klungo
daniel_klungoOP6mo ago
That’d be great! :MeowHeartCloudflare: Feel free to cc me in, I’m @poacher2k on GitHub
Hello, I’m Allie!
!remind 1h Registry Start Turborepo Wangler GH Iss
Flare
Flare6mo ago
:zep_check: I will remind you in 1 hour at Jun 14, 2024 at 10:20 CEST
daniel_klungo
daniel_klungoOP6mo ago
Thank you again for all the helpful replies! Hope your day is great 🙂
Hello, I’m Allie!
You too!
daniel_klungo
daniel_klungoOP6mo ago
btw, this haven't always crashed like this, but I'm guessing it might be a somewhat recent change I'll see if I can run the tasks in sequence instead of parallell, but given that they're servers and not tasks that run to completion, I have a hunch this might not work with turbo perhaps I can setup the tasks with timeouts or something between them 🤷‍♂️
Hello, I’m Allie!
Yeah, iirc Turbo doesn’t support that. I think I tried asking for that at one point
daniel_klungo
daniel_klungoOP6mo ago
makes sense 👆
daniel_klungo
daniel_klungoOP6mo ago
Works
No description
Hello, I’m Allie!
Oh, that works too :lul:
daniel_klungo
daniel_klungoOP6mo ago
🔨 🔨 🔨 I have another issue on GH for something else that happens every single time I run the commands and haven't in a while, which is that the auth tokens for some reason isn't being picked up, so I have to abort -> rerun and it works it used to just complain about the missing token, but now it helpfully launches the authorization website automatically too just turbo things perhaps the sleep solves this too!
Flare
Flare6mo ago
Reminder for @HardlyWorkin': Registry Start Turborepo Wangler GH Iss Set <t:1718349653:R>
Hello, I’m Allie!
GitHub
🐛 BUG: Worker Registry fails to start(concurrent dev sessions) · Is...
Which Cloudflare product(s) does this pertain to? Wrangler core What version(s) of the tool(s) are you using? 3.60.3 What version of Node are you using? 22.2.0 What operating system and version are...
daniel_klungo
daniel_klungoOP6mo ago
awesome, thank you!
Hello, I’m Allie!
Also, just to check, does your last name mean "Clearing in the forest"?
daniel_klungo
daniel_klungoOP6mo ago
close! more like shelter in the forest 🙂
Hello, I’m Allie!
Ja, jeg er åbenbart ikke helt så god til at oversætte til engelsk som jeg troede... 😅
daniel_klungo
daniel_klungoOP6mo ago
nært nok! 😄
Hard@Work
Hard@Work6mo ago
@daniel_klungo https://github.com/cloudflare/workers-sdk/issues/6037 Fix up, should be in next release 🤞
GitHub
🐛 BUG: Worker Registry fails to start(concurrent dev sessions) · Is...
Which Cloudflare product(s) does this pertain to? Wrangler core What version(s) of the tool(s) are you using? 3.60.3 What version of Node are you using? 22.2.0 What operating system and version are...
daniel_klungo
daniel_klungoOP6mo ago
Wohoo! 🎉
Hard@Work
Hard@Work6mo ago
Oh, btw, if it wasn't clear, I'm the work account of @HardlyWorkin' Samme person, ny konto
daniel_klungo
daniel_klungoOP6mo ago
Haha, I assumed! I’m the arbeidskonto of @poacher2k 😎
Pol
Pol5mo ago
Has this been fixed for you @daniel_klungo on latest version (3.62.0)? It's happening to me running multiple workers on the same monorepo. Using the sleep trick fixes the issue. Also, seems to be a bit random. Sometimes, without using the sleep, it works, but most of the times the occupied port error is thrown
daniel_klungo
daniel_klungoOP5mo ago
Haven’t tried! Can try later today, but I’m guessing if it’s not working for you it won’t for me either. Perhaps try longer sleeps? Hmmm
Pol
Pol5mo ago
Nono, with sleeps it works 100% of the time without sleeps it mostly never works, I guess due to a race condition with that port I'm using the latest wrangler Maybe the release doesn't include that fix
Want results from more Discord servers?
Add your server