workers-sdk icon indicating copy to clipboard operation
workers-sdk copied to clipboard

🐛 BUG: wrangler tail does not recover or exit when websocket disconnects

Open Manouchehri opened this issue 2 years ago • 7 comments

Which Cloudflare product(s) does this pertain to?

Wrangler core

What version(s) of the tool(s) are you using?

3.7.0

What version of Node are you using?

No response

What operating system are you using?

macOS

Describe the Bug

I've had this issue for awhile:

When I have an active wrangler tail running, and my internet disconnects and reconnects, logs stop coming in, but the command keeps on "running" as if it was still connected to Cloudflare.

I end up running like:

while sleep 1 ; do wrangler tail ; done

and then ctrl+c every few hours to make sure it's still working. This is obviously not a great developer experience.

Question: is there any sort of a "watchdog" on wrangler tail that's supposed to detect when a connection is disconnected?

Please provide a link to a minimal reproduction

No response

Please provide any relevant error logs

There's no error logs when the disconnect happens; the "bug" is the lack of error logs.

Manouchehri avatar Sep 11 '23 16:09 Manouchehri

I tried reproducing this. I deployed a simple Worker and started tailing it. Made a number of requests. Saw the logs coming through. I turned off my Internet connection; Wrangler did not exit or log any message about being disconnected. I turned on my Internet connection. Made another request. Wrangler displayed the logs from that request and then exited.

This is not quite what is described here. Has the behaviour changed since this issue was created?

Clearly this is also not ideal. We should handle the websocket disconnect and reconnect when it becomes available again.

petebacondarwin avatar Jan 12 '24 14:01 petebacondarwin

hi @Manouchehri :) are you still running into this issue?

lrapoport-cf avatar Feb 05 '24 15:02 lrapoport-cf

hi @Manouchehri :) we haven't heard from you in a while, so we’re going to close this issue for now. if this is still a problem, please feel free to open a new issue referencing this one. please be sure to include an updated summary and any additional details and a repro and we will revisit and investigate further. thanks!

lrapoport-cf avatar Feb 26 '24 15:02 lrapoport-cf

Sorry, I'm still having this issue.

Manouchehri avatar Feb 26 '24 15:02 Manouchehri

@Manouchehri could you follow up on @petebacondarwin 's comment above with additional details?

lrapoport-cf avatar Feb 26 '24 15:02 lrapoport-cf

This is not quite what is described here. Has the behaviour changed since this issue was created?

Pretty sure I'm still having the same issue.

This reproduces the error I think:

while sleep 1 ; do wrangler tail -e production ; done

Then throw your MacBook into your bag, and open it when you get home. It usually doesn't reconnect or exit for me.

Manouchehri avatar Feb 26 '24 16:02 Manouchehri

Confirmed, still having the issue. I started wrangler tail -e production, closed my laptop, ate lunch, and now there's no more logs showing up (yet wrangler hasn't exited or given any errors at all).

Manouchehri avatar Feb 26 '24 17:02 Manouchehri

I'm still having this issue on 3.31.0. I run into it multiple times per day.

@petebacondarwin What OS are you testing on?

Manouchehri avatar Mar 10 '24 16:03 Manouchehri

This is on my todo list for this week. I'll look into it and update by Friday.

petebacondarwin avatar Mar 13 '24 14:03 petebacondarwin

OK on the current latest build of Wrangler, I now see (following the steps I used above) the Wrangler process just effectively hangs when the Internet connection goes down transiently. This concurs with the original posters experience. I'll look into fixing this.

petebacondarwin avatar Mar 15 '24 15:03 petebacondarwin

Awesome, thank you!

Manouchehri avatar Mar 18 '24 18:03 Manouchehri

@petebacondarwin Which release should this be fixed in?

I'm still having issues with dead logs sometimes.

Manouchehri avatar Apr 03 '24 19:04 Manouchehri

It landed in https://github.com/cloudflare/workers-sdk/releases/tag/wrangler%403.35.0

petebacondarwin avatar Apr 03 '24 19:04 petebacondarwin