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

fix: unable to hit most inflight breakpoints while debugging #6217

Merged
merged 8 commits into from
Apr 14, 2024

Conversation

MarkMcCulloh
Copy link
Contributor

@MarkMcCulloh MarkMcCulloh commented Apr 11, 2024

Fixes #5988
Fixes #2546
Fixes #6036
Fixes #5986

#5988 was a symptom of a deeper issue. In wing it or any other command, breakpoints would only work sometimes and depended on the order of inflights in a file and how many there were. The underlying issue is that the sourcemaps are too slow and may not finish loading in time to help the debugger attach breakpoints. At first I made a change in this PR to fix a problem with how esbuild bundles our sourcemaps. On it's own this change made many scenarios work that previously didn't.

That wasn't enough though, so I went through many other options. As part of this, I actually added debugger settings to vscode.

In the end I needed to add a hack where we simply have a small sleep before running inflight code.

TODO:

  • Check Windows sourcemaps aren't borked
  • Ensure minimal benchmark regression (might skip this process if debugger is not needed)
  • A few tests for the remapping logic
  • Test locally with a winglib
  • Try to figure out better options than a sleep

By submitting this pull request, I confirm that my contribution is made under the terms of the Wing Cloud Contribution License.

Copy link

Thanks for opening this pull request! 🎉
Please consult the contributing guidelines for details on how to contribute to this project.
If you need any assistence, don't hesitate to ping the relevant owner over Slack.

Topic Owner
Wing SDK and utility APIs @chriscbr
Wing Console @ainvoner, @skyrpex, @polamoros
JSON, structs, primitives and collections @hasanaburayyan
Platforms and plugins @hasanaburayyan
Frontend resources (website, react, etc) @tsuf239
Language design @chriscbr
VSCode extension and language server @markmcculloh
Compiler architecture, inflights, lifting @yoav-steinberg
Wing Testing Framework @tsuf239
Wing CLI @markmcculloh
Build system, dev environment, releases @markmcculloh
Library Ecosystem @chriscbr
Documentation @hasanaburayyan
SDK test suite @tsuf239
Examples @hasanaburayyan
Wing Playground @eladcon

@MarkMcCulloh MarkMcCulloh changed the title fix: sourcemaps are mostly broken for debugging fix: unable to hit most inflight breakpoints while debugging Apr 11, 2024
@monadabot
Copy link
Contributor

monadabot commented Apr 11, 2024

Console preview environment is available at https://wing-console-pr-6217.fly.dev 🚀

Last Updated (UTC) 2024-04-14 21:10

@monadabot
Copy link
Contributor

monadabot commented Apr 11, 2024

Benchmarks

Comparison to Baseline 🟥⬜🟥⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜
Benchmark Before After Change
version 57ms±0.38 60ms±0.42 +2ms (+4.37%)🟥
functions_1.test.w -t sim 386ms±5.02 399ms±6.03 +12ms (+3.22%)⬜
functions_1.test.w -t tf-aws 808ms±3.1 820ms±5.62 +12ms (+1.5%)🟥
hello_world.test.w -t sim 388ms±3.94 398ms±5.33 +10ms (+2.7%)⬜
hello_world.test.w -t tf-aws 1498ms±9.88 1510ms±9.92 +12ms (+0.8%)⬜
jsii_big.test.w -t sim 2780ms±20.54 2786ms±11.95 +5ms (+0.19%)⬜
jsii_big.test.w -t tf-aws 3005ms±15.39 2998ms±7.51 -7ms (-0.24%)⬜
functions_10.test.w -t sim 490ms±10.38 481ms±11.34 -9ms (-1.76%)⬜
functions_10.test.w -t tf-aws 1996ms±15.8 2014ms±16.88 +18ms (+0.88%)⬜
jsii_small.test.w -t sim 360ms±5.13 363ms±3.97 +3ms (+0.71%)⬜
jsii_small.test.w -t tf-aws 594ms±3.54 601ms±3.91 +7ms (+1.2%)⬜
empty.test.w -t sim 357ms±5.5 362ms±3.84 +5ms (+1.47%)⬜
empty.test.w -t tf-aws 586ms±3.35 600ms±6.54 +13ms (+2.22%)⬜

⬜ Within 1.5 standard deviations
🟩 Faster, Above 1.5 standard deviations
🟥 Slower, Above 1.5 standard deviations

Benchmarks may vary outside of normal expectations, especially when running in GitHub Actions CI.

Results
name mean min max moe sd
version 60ms 59ms 60ms 0ms 1ms
functions_1.test.w -t sim 399ms 382ms 413ms 6ms 8ms
functions_1.test.w -t tf-aws 820ms 804ms 831ms 6ms 8ms
hello_world.test.w -t sim 398ms 384ms 411ms 5ms 7ms
hello_world.test.w -t tf-aws 1510ms 1486ms 1533ms 10ms 14ms
jsii_big.test.w -t sim 2786ms 2760ms 2809ms 12ms 17ms
jsii_big.test.w -t tf-aws 2998ms 2976ms 3013ms 8ms 11ms
functions_10.test.w -t sim 481ms 455ms 499ms 11ms 16ms
functions_10.test.w -t tf-aws 2014ms 1981ms 2051ms 17ms 24ms
jsii_small.test.w -t sim 363ms 353ms 368ms 4ms 6ms
jsii_small.test.w -t tf-aws 601ms 593ms 611ms 4ms 5ms
empty.test.w -t sim 362ms 355ms 375ms 4ms 5ms
empty.test.w -t tf-aws 600ms 585ms 610ms 7ms 9ms
Last Updated (UTC) 2024-04-14 21:16

libs/wingsdk/src/shared/bundling.ts Outdated Show resolved Hide resolved
libs/wingsdk/src/shared/sandbox.ts Show resolved Hide resolved
@MarkMcCulloh MarkMcCulloh marked this pull request as ready for review April 14, 2024 21:05
@MarkMcCulloh MarkMcCulloh requested a review from a team as a code owner April 14, 2024 21:05
Copy link
Contributor

mergify bot commented Apr 14, 2024

Thanks for contributing, @MarkMcCulloh! This PR will now be added to the merge queue, or immediately merged if mark/fix-source-maps is up-to-date with main and the queue is empty.

@mergify mergify bot merged commit ba06ad3 into main Apr 14, 2024
26 checks passed
@mergify mergify bot deleted the mark/fix-source-maps branch April 14, 2024 21:46
@monadabot
Copy link
Contributor

Congrats! 🚀 This was released in Wing 0.70.11.

mergify bot pushed a commit that referenced this pull request Apr 15, 2024
Missed this change in #6217

Now vscode will automatically use the builtin debugger when you have a wing file open instead of asking you to pick one

*By submitting this pull request, I confirm that my contribution is made under the terms of the [Wing Cloud Contribution License](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants