-
Notifications
You must be signed in to change notification settings - Fork 140
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
[ASM] Remove httpcontext from context store at the end of the request #6151
Conversation
Datadog ReportBranch report: ✅ 0 Failed, 361413 Passed, 2090 Skipped, 17h 43m 7.85s Total Time |
Execution-Time Benchmarks Report ⏱️Execution-time results for samples comparing the following branches/commits: Execution-time benchmarks measure the whole time it takes to execute a program. And are intended to measure the one-off costs. Cases where the execution time results for the PR are worse than latest master results are shown in red. The following thresholds were used for comparing the execution times:
Note that these results are based on a single point-in-time result for each branch. For full results, see the dashboard. Graphs show the p99 interval based on the mean and StdDev of the test run, as well as the mean value of the run (shown as a diamond below the graph). gantt
title Execution time (ms) FakeDbCommand (.NET Framework 4.6.2)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6151) - mean (72ms) : 69, 75
. : milestone, 72,
master - mean (70ms) : 68, 72
. : milestone, 70,
section CallTarget+Inlining+NGEN
This PR (6151) - mean (1,138ms) : 1117, 1160
. : milestone, 1138,
master - mean (1,111ms) : 1087, 1135
. : milestone, 1111,
gantt
title Execution time (ms) FakeDbCommand (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6151) - mean (112ms) : 109, 116
. : milestone, 112,
master - mean (109ms) : 106, 111
. : milestone, 109,
section CallTarget+Inlining+NGEN
This PR (6151) - mean (791ms) : 778, 805
. : milestone, 791,
master - mean (772ms) : 756, 789
. : milestone, 772,
gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6151) - mean (95ms) : 92, 97
. : milestone, 95,
master - mean (92ms) : 89, 95
. : milestone, 92,
section CallTarget+Inlining+NGEN
This PR (6151) - mean (742ms) : 727, 757
. : milestone, 742,
master - mean (730ms) : 714, 745
. : milestone, 730,
gantt
title Execution time (ms) HttpMessageHandler (.NET Framework 4.6.2)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6151) - mean (191ms) : 187, 195
. : milestone, 191,
master - mean (189ms) : 186, 192
. : milestone, 189,
section CallTarget+Inlining+NGEN
This PR (6151) - mean (1,198ms) : 1180, 1215
. : milestone, 1198,
master - mean (1,197ms) : 1170, 1224
. : milestone, 1197,
gantt
title Execution time (ms) HttpMessageHandler (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6151) - mean (277ms) : 274, 281
. : milestone, 277,
master - mean (273ms) : 269, 278
. : milestone, 273,
section CallTarget+Inlining+NGEN
This PR (6151) - mean (943ms) : 926, 960
. : milestone, 943,
master - mean (939ms) : 919, 958
. : milestone, 939,
gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6151) - mean (265ms) : 261, 270
. : milestone, 265,
master - mean (263ms) : 259, 266
. : milestone, 263,
section CallTarget+Inlining+NGEN
This PR (6151) - mean (923ms) : 905, 941
. : milestone, 923,
master - mean (926ms) : 906, 947
. : milestone, 926,
|
Benchmarks Report for appsec 🐌Benchmarks for #6151 compared to master:
The following thresholds were used for comparing the benchmark speeds:
Allocation changes below 0.5% are ignored. Benchmark detailsBenchmarks.Trace.Asm.AppSecBodyBenchmark - Faster 🎉 Same allocations ✔️
|
Benchmark | base/diff | Base Median (ns) | Diff Median (ns) | Modality |
---|---|---|---|---|
Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody‑net6.0 | 1.264 | 192.95 | 152.66 |
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | AllCycleSimpleBody |
net6.0 | 72.8μs | 107ns | 414ns | 0.0728 | 0 | 0 | 6 KB |
master | AllCycleSimpleBody |
netcoreapp3.1 | 63.4μs | 127ns | 493ns | 0.094 | 0 | 0 | 6.95 KB |
master | AllCycleSimpleBody |
net472 | 49μs | 27.8ns | 100ns | 1.32 | 0 | 0 | 8.34 KB |
master | AllCycleMoreComplexBody |
net6.0 | 80.1μs | 175ns | 676ns | 0.121 | 0 | 0 | 9.51 KB |
master | AllCycleMoreComplexBody |
netcoreapp3.1 | 71μs | 103ns | 399ns | 0.142 | 0 | 0 | 10.37 KB |
master | AllCycleMoreComplexBody |
net472 | 56.9μs | 88.6ns | 343ns | 1.87 | 0.0284 | 0 | 11.85 KB |
master | ObjectExtractorSimpleBody |
net6.0 | 193ns | 0.129ns | 0.5ns | 0.00395 | 0 | 0 | 280 B |
master | ObjectExtractorSimpleBody |
netcoreapp3.1 | 224ns | 0.156ns | 0.604ns | 0.00371 | 0 | 0 | 272 B |
master | ObjectExtractorSimpleBody |
net472 | 165ns | 0.217ns | 0.839ns | 0.0446 | 0 | 0 | 281 B |
master | ObjectExtractorMoreComplexBody |
net6.0 | 3.12μs | 1.99ns | 7.45ns | 0.0532 | 0 | 0 | 3.78 KB |
master | ObjectExtractorMoreComplexBody |
netcoreapp3.1 | 3.92μs | 2.63ns | 9.83ns | 0.0512 | 0 | 0 | 3.69 KB |
master | ObjectExtractorMoreComplexBody |
net472 | 4μs | 5.72ns | 22.2ns | 0.603 | 0.00597 | 0 | 3.8 KB |
#6151 | AllCycleSimpleBody |
net6.0 | 76.7μs | 105ns | 406ns | 0.0764 | 0 | 0 | 6 KB |
#6151 | AllCycleSimpleBody |
netcoreapp3.1 | 63.4μs | 112ns | 435ns | 0.0953 | 0 | 0 | 6.95 KB |
#6151 | AllCycleSimpleBody |
net472 | 50μs | 23.1ns | 83.4ns | 1.3 | 0 | 0 | 8.34 KB |
#6151 | AllCycleMoreComplexBody |
net6.0 | 81μs | 82.7ns | 320ns | 0.122 | 0 | 0 | 9.51 KB |
#6151 | AllCycleMoreComplexBody |
netcoreapp3.1 | 72.5μs | 112ns | 435ns | 0.108 | 0 | 0 | 10.36 KB |
#6151 | AllCycleMoreComplexBody |
net472 | 56.7μs | 27.6ns | 107ns | 1.87 | 0.0284 | 0 | 11.85 KB |
#6151 | ObjectExtractorSimpleBody |
net6.0 | 153ns | 0.133ns | 0.515ns | 0.00394 | 0 | 0 | 280 B |
#6151 | ObjectExtractorSimpleBody |
netcoreapp3.1 | 213ns | 0.19ns | 0.712ns | 0.00378 | 0 | 0 | 272 B |
#6151 | ObjectExtractorSimpleBody |
net472 | 166ns | 0.194ns | 0.727ns | 0.0446 | 0 | 0 | 281 B |
#6151 | ObjectExtractorMoreComplexBody |
net6.0 | 3.03μs | 3.1ns | 12ns | 0.053 | 0 | 0 | 3.78 KB |
#6151 | ObjectExtractorMoreComplexBody |
netcoreapp3.1 | 4.07μs | 2.14ns | 8.31ns | 0.051 | 0 | 0 | 3.69 KB |
#6151 | ObjectExtractorMoreComplexBody |
net472 | 3.88μs | 3.43ns | 12.8ns | 0.603 | 0.00591 | 0 | 3.8 KB |
Benchmarks.Trace.Asm.AppSecEncoderBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | EncodeArgs |
net6.0 | 37.5μs | 21.8ns | 81.5ns | 0.449 | 0 | 0 | 32.4 KB |
master | EncodeArgs |
netcoreapp3.1 | 54.4μs | 23.4ns | 90.5ns | 0.432 | 0 | 0 | 32.4 KB |
master | EncodeArgs |
net472 | 67.2μs | 45.6ns | 176ns | 5.16 | 0.0671 | 0 | 32.5 KB |
master | EncodeLegacyArgs |
net6.0 | 72.2μs | 13ns | 48.5ns | 0 | 0 | 0 | 2.14 KB |
master | EncodeLegacyArgs |
netcoreapp3.1 | 103μs | 61.4ns | 230ns | 0 | 0 | 0 | 2.14 KB |
master | EncodeLegacyArgs |
net472 | 151μs | 49.9ns | 187ns | 0.306 | 0 | 0 | 2.15 KB |
#6151 | EncodeArgs |
net6.0 | 37.4μs | 26ns | 101ns | 0.447 | 0 | 0 | 32.4 KB |
#6151 | EncodeArgs |
netcoreapp3.1 | 54.9μs | 19.7ns | 76.4ns | 0.436 | 0 | 0 | 32.4 KB |
#6151 | EncodeArgs |
net472 | 66.8μs | 36.2ns | 140ns | 5.14 | 0.0671 | 0 | 32.5 KB |
#6151 | EncodeLegacyArgs |
net6.0 | 71.2μs | 36.6ns | 127ns | 0 | 0 | 0 | 2.14 KB |
#6151 | EncodeLegacyArgs |
netcoreapp3.1 | 105μs | 144ns | 558ns | 0 | 0 | 0 | 2.14 KB |
#6151 | EncodeLegacyArgs |
net472 | 152μs | 98.1ns | 380ns | 0.305 | 0 | 0 | 2.15 KB |
Benchmarks.Trace.Asm.AppSecWafBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | RunWafRealisticBenchmark |
net6.0 | 185μs | 181ns | 701ns | 0 | 0 | 0 | 2.44 KB |
master | RunWafRealisticBenchmark |
netcoreapp3.1 | 195μs | 110ns | 411ns | 0 | 0 | 0 | 2.39 KB |
master | RunWafRealisticBenchmark |
net472 | 209μs | 150ns | 580ns | 0.314 | 0 | 0 | 2.46 KB |
master | RunWafRealisticBenchmarkWithAttack |
net6.0 | 123μs | 52.9ns | 205ns | 0 | 0 | 0 | 1.47 KB |
master | RunWafRealisticBenchmarkWithAttack |
netcoreapp3.1 | 130μs | 123ns | 476ns | 0 | 0 | 0 | 1.46 KB |
master | RunWafRealisticBenchmarkWithAttack |
net472 | 139μs | 25.9ns | 100ns | 0.209 | 0 | 0 | 1.49 KB |
#6151 | RunWafRealisticBenchmark |
net6.0 | 187μs | 150ns | 560ns | 0 | 0 | 0 | 2.44 KB |
#6151 | RunWafRealisticBenchmark |
netcoreapp3.1 | 198μs | 237ns | 919ns | 0 | 0 | 0 | 2.39 KB |
#6151 | RunWafRealisticBenchmark |
net472 | 211μs | 173ns | 669ns | 0.316 | 0 | 0 | 2.46 KB |
#6151 | RunWafRealisticBenchmarkWithAttack |
net6.0 | 125μs | 68.9ns | 267ns | 0 | 0 | 0 | 1.47 KB |
#6151 | RunWafRealisticBenchmarkWithAttack |
netcoreapp3.1 | 132μs | 104ns | 373ns | 0 | 0 | 0 | 1.46 KB |
#6151 | RunWafRealisticBenchmarkWithAttack |
net472 | 141μs | 142ns | 551ns | 0.213 | 0 | 0 | 1.49 KB |
Benchmarks.Trace.Iast.StringAspectsBenchmark - Slower ⚠️ Fewer allocations 🎉
Slower ⚠️ in #6151
Benchmark
diff/base
Base Median (ns)
Diff Median (ns)
Modality
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net6.0
1.129
62,100.00
70,100.00
bimodal
Fewer allocations 🎉 in #6151
Benchmark
Base Allocated
Diff Allocated
Change
Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net6.0
255.23 KB
253.85 KB
-1.38 KB
-0.54%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net472
59.07 KB
57.3 KB
-1.77 KB
-2.99%
Benchmark | diff/base | Base Median (ns) | Diff Median (ns) | Modality |
---|---|---|---|---|
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net6.0 | 1.129 | 62,100.00 | 70,100.00 | bimodal |
Benchmark | Base Allocated | Diff Allocated | Change | Change % |
---|---|---|---|---|
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net6.0 | 255.23 KB | 253.85 KB | -1.38 KB | -0.54% |
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net472 | 59.07 KB | 57.3 KB | -1.77 KB | -2.99% |
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | StringConcatBenchmark |
net6.0 | 61.3μs | 701ns | 6.97μs | 0 | 0 | 0 | 43.44 KB |
master | StringConcatBenchmark |
netcoreapp3.1 | 54.2μs | 283ns | 1.44μs | 0 | 0 | 0 | 42.64 KB |
master | StringConcatBenchmark |
net472 | 37.5μs | 65.2ns | 235ns | 0 | 0 | 0 | 59.07 KB |
master | StringConcatAspectBenchmark |
net6.0 | 314μs | 1.77μs | 12.6μs | 0 | 0 | 0 | 255.23 KB |
master | StringConcatAspectBenchmark |
netcoreapp3.1 | 328μs | 1.8μs | 12.1μs | 0 | 0 | 0 | 252.73 KB |
master | StringConcatAspectBenchmark |
net472 | 272μs | 5.43μs | 51.8μs | 0 | 0 | 0 | 278.53 KB |
#6151 | StringConcatBenchmark |
net6.0 | 72.2μs | 991ns | 9.81μs | 0 | 0 | 0 | 43.44 KB |
#6151 | StringConcatBenchmark |
netcoreapp3.1 | 59.5μs | 789ns | 7.57μs | 0 | 0 | 0 | 42.64 KB |
#6151 | StringConcatBenchmark |
net472 | 38.8μs | 219ns | 1.46μs | 0 | 0 | 0 | 57.3 KB |
#6151 | StringConcatAspectBenchmark |
net6.0 | 331μs | 1.71μs | 11.6μs | 0 | 0 | 0 | 253.85 KB |
#6151 | StringConcatAspectBenchmark |
netcoreapp3.1 | 329μs | 1.85μs | 15.4μs | 0 | 0 | 0 | 252.01 KB |
#6151 | StringConcatAspectBenchmark |
net472 | 301μs | 6.03μs | 58.1μs | 0 | 0 | 0 | 278.53 KB |
Benchmarks Report for tracer 🐌Benchmarks for #6151 compared to master:
The following thresholds were used for comparing the benchmark speeds:
Allocation changes below 0.5% are ignored. Benchmark detailsBenchmarks.Trace.ActivityBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.AgentWriterBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.AspNetCoreBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.DbCommandBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.ElasticsearchBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.GraphQLBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.HttpClientBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.ILoggerBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.Log4netBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.NLogBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.RedisBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.SerilogBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.SpanBenchmark - Slower
|
Benchmark | diff/base | Base Median (ns) | Diff Median (ns) | Modality |
---|---|---|---|---|
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑netcoreapp3.1 | 1.135 | 559.89 | 635.49 |
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | StartFinishSpan |
net6.0 | 401ns | 0.386ns | 1.49ns | 0.00812 | 0 | 0 | 576 B |
master | StartFinishSpan |
netcoreapp3.1 | 560ns | 0.997ns | 3.73ns | 0.00781 | 0 | 0 | 576 B |
master | StartFinishSpan |
net472 | 714ns | 2.96ns | 11.5ns | 0.0915 | 0 | 0 | 578 B |
master | StartFinishScope |
net6.0 | 511ns | 0.965ns | 3.61ns | 0.00996 | 0 | 0 | 696 B |
master | StartFinishScope |
netcoreapp3.1 | 808ns | 0.753ns | 2.82ns | 0.00942 | 0 | 0 | 696 B |
master | StartFinishScope |
net472 | 921ns | 1.45ns | 5.63ns | 0.105 | 0 | 0 | 658 B |
#6151 | StartFinishSpan |
net6.0 | 413ns | 0.263ns | 0.985ns | 0.00803 | 0 | 0 | 576 B |
#6151 | StartFinishSpan |
netcoreapp3.1 | 636ns | 0.437ns | 1.69ns | 0.00789 | 0 | 0 | 576 B |
#6151 | StartFinishSpan |
net472 | 707ns | 1.37ns | 5.31ns | 0.0916 | 0 | 0 | 578 B |
#6151 | StartFinishScope |
net6.0 | 541ns | 0.162ns | 0.607ns | 0.00982 | 0 | 0 | 696 B |
#6151 | StartFinishScope |
netcoreapp3.1 | 750ns | 0.645ns | 2.5ns | 0.00924 | 0 | 0 | 696 B |
#6151 | StartFinishScope |
net472 | 895ns | 0.394ns | 1.42ns | 0.104 | 0 | 0 | 658 B |
Benchmarks.Trace.TraceAnnotationsBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | RunOnMethodBegin |
net6.0 | 600ns | 0.862ns | 3.34ns | 0.00962 | 0 | 0 | 696 B |
master | RunOnMethodBegin |
netcoreapp3.1 | 973ns | 1.12ns | 4.32ns | 0.00959 | 0 | 0 | 696 B |
master | RunOnMethodBegin |
net472 | 1.2μs | 1.53ns | 5.93ns | 0.104 | 0 | 0 | 658 B |
#6151 | RunOnMethodBegin |
net6.0 | 654ns | 0.326ns | 1.26ns | 0.00987 | 0 | 0 | 696 B |
#6151 | RunOnMethodBegin |
netcoreapp3.1 | 1.05μs | 0.401ns | 1.5ns | 0.00944 | 0 | 0 | 696 B |
#6151 | RunOnMethodBegin |
net472 | 1.15μs | 0.793ns | 3.07ns | 0.104 | 0 | 0 | 658 B |
Throughput/Crank Report ⚡Throughput results for AspNetCoreSimpleController comparing the following branches/commits: Cases where throughput results for the PR are worse than latest master (5% drop or greater), results are shown in red. Note that these results are based on a single point-in-time result for each branch. For full results, see one of the many, many dashboards! gantt
title Throughput Linux x64 (Total requests)
dateFormat X
axisFormat %s
section Baseline
This PR (6151) (11.141M) : 0, 11140714
master (11.075M) : 0, 11075136
benchmarks/2.9.0 (11.081M) : 0, 11080577
section Automatic
This PR (6151) (7.441M) : 0, 7441141
master (7.367M) : 0, 7366951
benchmarks/2.9.0 (7.732M) : 0, 7732233
section Trace stats
master (7.787M) : 0, 7786534
section Manual
master (11.035M) : 0, 11035295
section Manual + Automatic
This PR (6151) (6.820M) : 0, 6819581
master (6.868M) : 0, 6867674
section DD_TRACE_ENABLED=0
master (10.287M) : 0, 10286929
gantt
title Throughput Linux arm64 (Total requests)
dateFormat X
axisFormat %s
section Baseline
This PR (6151) (9.639M) : 0, 9639221
master (9.623M) : 0, 9623464
benchmarks/2.9.0 (9.798M) : 0, 9798067
section Automatic
This PR (6151) (6.573M) : 0, 6573007
master (6.552M) : 0, 6552321
section Trace stats
master (6.804M) : 0, 6804137
section Manual
master (9.681M) : 0, 9680841
section Manual + Automatic
This PR (6151) (5.905M) : 0, 5905340
master (6.129M) : 0, 6129325
section DD_TRACE_ENABLED=0
master (8.872M) : 0, 8871923
gantt
title Throughput Windows x64 (Total requests)
dateFormat X
axisFormat %s
section Baseline
This PR (6151) (9.807M) : 0, 9807281
master (9.890M) : 0, 9889878
benchmarks/2.9.0 (10.067M) : 0, 10067315
section Automatic
This PR (6151) (6.722M) : 0, 6722136
master (6.497M) : 0, 6496699
benchmarks/2.9.0 (7.552M) : 0, 7552193
section Trace stats
master (7.060M) : 0, 7060412
section Manual
master (9.783M) : 0, 9783254
section Manual + Automatic
This PR (6151) (6.216M) : 0, 6215931
master (6.100M) : 0, 6099575
section DD_TRACE_ENABLED=0
master (9.233M) : 0, 9233471
|
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.
Thanks!
@@ -689,6 +691,8 @@ private void OnHostingUnhandledException(object arg) | |||
AspNetCoreRequestHandler.HandleAspNetCoreException(tracer, CurrentSecurity, rootSpan, httpContext, unhandledStruct.Exception); | |||
} | |||
|
|||
CoreHttpContextStore.Instance.Remove(); |
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.
I don't know if you want this here? 🤔 I believe OnHostingHttpRequestInStop
is still called after OnHostingUnhandledException
, so you'll end up not having a context earlier than you expect if you remove it here
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.
good point I removed it! 4d5bb45
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.
Double checked, and it's indeed called after OnHostingUnhandledException
@@ -670,6 +670,8 @@ private void OnHostingHttpRequestInStop(object arg) | |||
AspNetCoreRequestHandler.StopAspNetCorePipelineScope(tracer, CurrentSecurity, rootScope, httpContext); | |||
} | |||
|
|||
CoreHttpContextStore.Instance.Remove(); |
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.
I wonder if you should call this in AspNetCoreRequestHandler.StopAspNetCorePipelineScope()
as well 🤔 StopAspNetCorePipelineScope
is called outside of this pipeline too, in Azure Functions for example, so may be safest to add a call there (calling it twice should be safe I think?)
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.
good point!! thanks
4d5bb45
yes it should be safe as its just setting a value to null..
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.
Nice
Summary of changes
Some logs show that we're accessing HttpContext properties when it has already been disposed. Stacktrace shows that it's at the beginning of running the waf, so this might be a simple fix for now
Reason for change
Implementation details
Test coverage
Other details