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

refactor(ext/http): use scopeguard defer to handle async drop #20652

Merged
merged 1 commit into from
Sep 26, 2023

Conversation

lrowe
Copy link
Contributor

@lrowe lrowe commented Sep 23, 2023

Use the scopeguard defer macro to run cleanup code for new_slab_future.
This means it can be a single async function, avoiding the need to create a struct and implement PinnedDrop

Async cleanup in Rust is awkward because async functions may be cancelled at any await point when their Future is dropped.
The scopeguard approach comes from the following articles:

@lrowe lrowe force-pushed the lrowe-scopeguard branch 2 times, most recently from cc0fb9f to 79fa64f Compare September 24, 2023 02:14
@lrowe
Copy link
Contributor Author

lrowe commented Sep 24, 2023

I assume the earlier windows test failure were spurious since it passed when running in my fork here: https://github.com/lrowe/deno/actions/runs/6287030911

@lrowe
Copy link
Contributor Author

lrowe commented Sep 24, 2023

This failure is also spurious: error: Import 'https://deno.land/x/[email protected]/mod.ts' failed: 502 Bad Gateway

Copy link
Contributor

@mmastrac mmastrac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lrowe
Copy link
Contributor Author

lrowe commented Sep 24, 2023

Benchmark results seem to show no change in performance.

This branch. ./deno-b129b8950 run --allow-all multi.ts minimal

% third_party/prebuilt/mac/wrk http:https://localhost:8080/
Running 10s test @ http:https://localhost:8080/
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    77.17us   22.10us 634.00us   73.23%
    Req/Sec    57.49k     1.58k   59.19k    92.57%
  1155607 requests in 10.10s, 165.31MB read
Requests/sec: 114417.97
Transfer/sec:     16.37MB

Main. ./deno-cb9ab9c3a run --allow-all multi.ts minimal

% third_party/prebuilt/mac/wrk http:https://localhost:8080/
Running 10s test @ http:https://localhost:8080/
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    77.25us   22.15us 676.00us   72.89%
    Req/Sec    57.39k     1.35k   59.16k    90.10%
  1153767 requests in 10.10s, 165.05MB read
Requests/sec: 114235.08
Transfer/sec:     16.34MB

@lrowe
Copy link
Contributor Author

lrowe commented Sep 24, 2023

Given that the windows tests seem to consistently fail the same tests on this branch when using the xl windows runner I'm going to try to get GitHub actions to run just the failing tests to see and add logging to see what's going on.

[serve_test 020.85] httpServerTcpCancellation_file ... FAILED (107ms)
[serve_test 020.90] httpServerTcpCancellation_stream ... FAILED (44ms)

EDIT: The failing Test debug (fast) step does not use the xl runner, so I don't know what the difference is between the test running on my fork vs here.

@mmastrac
Copy link
Contributor

@lrowe I think Luca may have fixed the flaky tests in #20672

@lrowe
Copy link
Contributor Author

lrowe commented Sep 25, 2023

Great! I've added that commit to this PR for now and will update after it is merged.

@mmastrac mmastrac merged commit 8fcea59 into denoland:main Sep 26, 2023
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants