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

Type pollution test #10918

Merged
merged 22 commits into from
Jul 19, 2024
Merged

Type pollution test #10918

merged 22 commits into from
Jul 19, 2024

Conversation

yawkat
Copy link
Member

@yawkat yawkat commented Jun 18, 2024

Add a test to the benchmarks module that runs certain JMH benchmarks with the redhat type pollution agent ( https://github.com/RedHatPerf/type-pollution-agent ) and triggers a test failure if there is excessive type pollution.

This works by adding a new test task which includes the agent, and then using JFRUnit to access the JFR events emitted by the agents. If there are too many thrash events for a single concrete type, details are logged and the test fails.

Additionally:

  • Add a JMH benchmark that mimics the TechEmpower benchmark
  • Fix various type pollution issues that were found using the FullHttpStackBenchmark

This PR is still pending the upstream PR to introduce JFR events to the agent ( RedHatPerf/type-pollution-agent#19 ), and actual publishing of the type pollution agent. We will either wait for RH to publish the agent to maven central, or we will publish it ourselves if they don't want to do it (reply pending).

renovate bot and others added 5 commits June 14, 2024 10:38
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…10904)

* Fixes #10665 Ensuring the deserialization has access to the ServerRequestContext

* Adding a test to ensure that large request payloads still have access to the ServerRequestContext on deserialization.
Add a test to the benchmarks module that runs certain JMH benchmarks with the redhat type pollution agent ( https://github.com/RedHatPerf/type-pollution-agent ) and triggers a test failure if there is excessive type pollution.

This works by adding a new test task which includes the agent, and then using JFRUnit to access the JFR events emitted by the agents. If there are too many thrash events for a single concrete type, details are logged and the test fails.

Additionally:
- Add a JMH benchmark that mimics the TechEmpower benchmark
- Fix various type pollution issues that were found using the FullHttpStackBenchmark

This PR is still pending the upstream PR to introduce JFR events to the agent ( RedHatPerf/type-pollution-agent#19 ), and actual publishing of the type pollution agent. We will either wait for RH to publish the agent to maven central, or we will publish it ourselves if they don't want to do it (reply pending).
@graemerocher graemerocher added the type: improvement A minor improvement to an existing feature label Jun 18, 2024
dstepanov and others added 17 commits June 26, 2024 16:13
The test is reproducing Jackson's default behaviour with primitives and a way to change it

micronaut-projects/micronaut-serialization#880
….1 (#10770)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…174 (#8882)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…in to v0.4.3 (#10885)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…-dataformat-yaml to v2.17.2 (#10954)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
# Conflicts:
#	http-server-netty/src/main/java/io/micronaut/http/server/netty/binders/NettyBodyAnnotationBinder.java
@yawkat yawkat added this to the 4.6.0 milestone Jul 17, 2024
@yawkat yawkat changed the base branch from 4.5.x to 4.6.x July 17, 2024 15:14
@yawkat yawkat marked this pull request as ready for review July 17, 2024 15:15
Copy link

sonarcloud bot commented Jul 17, 2024

}
List<GenericHttpFilter> httpFilters = new ArrayList<>(alwaysMatchesFilterRoutes.size());
ArrayList<GenericHttpFilter> httpFilters = new ArrayList<>(alwaysMatchesFilterRoutes.size());
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you just use var?

if (alwaysMatchesFilterRoutes.isEmpty()) {
return Collections.emptyList();
return new ArrayList<>(0);
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a comment why this cannot be emptyList or List.of

Copy link
Member Author

Choose a reason for hiding this comment

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

I changed the field to be ArrayList to avoid an interface cast, so this lambda has to return ArrayList as well

@graemerocher graemerocher merged commit bb68d7c into 4.6.x Jul 19, 2024
17 checks passed
@graemerocher graemerocher deleted the thrash-test branch July 19, 2024 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: improvement A minor improvement to an existing feature
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

8 participants