-
Notifications
You must be signed in to change notification settings - Fork 3k
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
fix for windows debug support #14048
Conversation
❌ @snoglobe, your commit ba54a17 has 7 failures in test/js/node/watch/fs.watch.test.ts - 3 failing on 🍎 14 x64test/js/web/streams/streams.test.js - 1 failing on 🍎 14 aarch64test/js/web/streams/streams.test.js - 1 failing on 🍎 14 x64test/js/web/fetch/fetch-tcp-stress.test.ts - timeout on 🍎 13 aarch64test/js/web/fetch/fetch-tcp-stress.test.ts - timeout on 🍎 14 x64test/cli/install/registry/bun-install-registry.test.ts - 2 failing on 🍎 14 aarch64test/js/node/test/parallel/child-process-exec-timeout-kill.test.js - 1 failing on 🍎 13 aarch64test/cli/hot/watch.test.ts - 1 failing on 🪟 x64test/cli/hot/watch.test.ts - 1 failing on 🪟 x64-baselinetest/cli/watch/watch.test.ts - 2 failing on 🪟 x64-baselinetest/cli/watch/watch.test.ts - 2 failing on 🪟 x64 |
note: failed builds are due to buildkite |
import { Location, SourceMap } from "./sourcemap"; | ||
import { createServer, AddressInfo } from "node:net"; | ||
|
||
export function getAvailablePort(): number { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to wait for the callback to be called?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it works fine without waiting for callback
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does node gurantee that the address will always be set before the listen callback is invoked?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
server.address() returns null before the 'listening' event has been emitted or after calling server.close().
@@ -9,7 +9,7 @@ buildSync({ | |||
entryPoints: ["src/extension.ts", "src/web-extension.ts"], | |||
outdir: "dist", | |||
bundle: true, | |||
external: ["vscode"], | |||
external: ["vscode", "ws"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this intentional?
yes; build fails otherwise
…On Thu, Sep 19, 2024 at 5:07 PM Jarred Sumner ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In packages/bun-vscode/scripts/build.mjs
<#14048 (comment)>:
> @@ -9,7 +9,7 @@ buildSync({
entryPoints: ["src/extension.ts", "src/web-extension.ts"],
outdir: "dist",
bundle: true,
- external: ["vscode"],
+ external: ["vscode", "ws"],
Is this intentional?
—
Reply to this email directly, view it on GitHub
<#14048 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGC3MRFXZGREDAC32PERZDLZXNRLFAVCNFSM6AAAAABOQZ3VNCVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDGMJWHEZTQNRYGE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
What happens when you build the installed extension and the ws package
isn’t installed?
…On Thu, Sep 19, 2024 at 5:08 PM snwy ***@***.***> wrote:
yes; build fails otherwise
On Thu, Sep 19, 2024 at 5:07 PM Jarred Sumner ***@***.***>
wrote:
> ***@***.**** commented on this pull request.
> ------------------------------
>
> In packages/bun-vscode/scripts/build.mjs
> <#14048 (comment)>:
>
> > @@ -9,7 +9,7 @@ buildSync({
> entryPoints: ["src/extension.ts", "src/web-extension.ts"],
> outdir: "dist",
> bundle: true,
> - external: ["vscode"],
> + external: ["vscode", "ws"],
>
> Is this intentional?
>
> —
> Reply to this email directly, view it on GitHub
> <#14048 (review)>,
> or unsubscribe
> <
https://github.com/notifications/unsubscribe-auth/AGC3MRFXZGREDAC32PERZDLZXNRLFAVCNFSM6AAAAABOQZ3VNCVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDGMJWHEZTQNRYGE>
> .
> You are receiving this because you were mentioned.Message ID:
> ***@***.***>
>
—
Reply to this email directly, view it on GitHub
<#14048 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAFNGS5BPUU3W6UTO4MHTELZXNRRFAVCNFSM6AAAAABOQZ3VNCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNRSGQ2DSMBYGA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
errors w/ the bundler unable to resolve ws |
did you run |
src/js/internal/debugger.ts
Outdated
@@ -73,7 +83,7 @@ class Debugger { | |||
#listen(): void { | |||
const { protocol, hostname, port, pathname } = this.#url; | |||
|
|||
if (protocol === "ws:" || protocol === "ws+tcp:") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're allowing wss, where is the TLS configuration specified?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not mergeable until:
- the
listen()
callback is addressed (it will be randomly flaky, in it's current version even if it appears to work sometimes when you run it locally) - The
"ws"
module should not be external. We bundle the VSCode extension instead of expecting a node_modules folder to be present (it won't be, except for development)
Separately, the "wss"
validation is a little confusing unless the idea is you have a reverse proxy between Bun.serve() and the websocket connection? This is uncommon, as people usually don't proxy websockets but not impossible I suppose.
src/js/internal/debugger.ts
Outdated
@@ -321,6 +331,18 @@ function reset(): string { | |||
return ""; | |||
} | |||
|
|||
function notifyWebSocket(url: string): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, it's a whole websocket server for this? We can just make a TCP connection.
6920246
to
aea25a4
Compare
I want to get the Bun changes into the release, so going to merge that separately from this PR since the extension can be updated separately after |
will remove wss validation then; yeah not sure why i put it |
yes |
@@ -2149,10 +2207,10 @@ function titleize(name: string): string { | |||
} | |||
|
|||
function sourcePresentationHint(url?: string): DAP.Source["presentationHint"] { | |||
if (!url || !url.startsWith("/")) { | |||
if (!url || path.isAbsolute(url)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
!path.isAbsolute
|
||
const query = stopOnEntry ? "break=1" : "wait=1"; | ||
processEnv["BUN_INSPECT"] = `${url}?${query}`; | ||
processEnv["BUN_INSPECT_NOTIFY"] = `tcp://127.0.0.1:${signal.port}`; // 127.0.0.1 so it resolves correctly on windows |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
processEnv["BUN_INSPECT_NOTIFY"] = `tcp://127.0.0.1:${signal.port}`; // 127.0.0.1 so it resolves correctly on windows | |
processEnv["BUN_INSPECT_NOTIFY"] = signal.url |
I see this pr changed unix domain socket to websocket through network ipc. It just like bun inspect cli debugging doing. I tested some simple demos of unix domain socket on windows and it works. How about to fix existing unix domain socket for windows, it's more high performance in my opinion. It's just my own thought. 😄 |
@liudonghua123 you're welcome to try getting unix domain sockets working when used in VSCode on Windows |
What does this PR do?
this fixes #8851, which pertains to the bun debugger not working on windows.
for windows platform, we now use websockets to communicate to the debugger and inspector. on unix platforms, we keep the existing unix sockets implementation.
How did you verify your code works?
tested it by debugging programs under vscode in windows