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

Reporting findings #3

Open
dreis2211 opened this issue Nov 1, 2022 · 3 comments
Open

Reporting findings #3

dreis2211 opened this issue Nov 1, 2022 · 3 comments

Comments

@dreis2211
Copy link

dreis2211 commented Nov 1, 2022

Hi,

in the Quarkus insight episode you said "contact us" because you're collecting cases to make it more prominent and to maybe have an easier argument to have this fixed inside the JDK. In the absence of a better contact address, I'll share it here: I've been playing with this agent in the last couple of days and it's literally everywhere. E.g. a simple Spring-Boot app with Undertow shows the following when I do some simple benchmarks against it for just a few seconds(!) - e.g. via ab -n X -c Y "http://url/"

--------------------------
Type Pollution Statistics:
--------------------------
1:      org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
Count:  58366
Types:
        org.springframework.http.converter.HttpMessageConverter
        org.springframework.http.converter.GenericHttpMessageConverter
Traces:
        org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.getProducibleMediaTypes(AbstractMessageConverterMethodProcessor.java:385)
                class: org.springframework.http.converter.HttpMessageConverter
                count: 29208
        org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.getProducibleMediaTypes(AbstractMessageConverterMethodProcessor.java:386)
                class: org.springframework.http.converter.GenericHttpMessageConverter
                count: 29115
        org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.getProducible
MediaTypes(AbstractMessageConverterMethodProcessor.java:387)
                class: org.springframework.http.converter.GenericHttpMessageConverter
                count: 43
--------------------------
                count: 29115
        org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.getProducible
MediaTypes(AbstractMessageConverterMethodProcessor.java:387)
                class: org.springframework.http.converter.GenericHttpMessageConverter
                count: 43
--------------------------
2:      org.springframework.http.converter.ResourceRegionHttpMessageConverter
Count:  29229
Types:
        org.springframework.http.converter.HttpMessageConverter
        org.springframework.http.converter.GenericHttpMessageConverter
Traces:
        org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.getProducible
MediaTypes(AbstractMessageConverterMethodProcessor.java:385)
                class: org.springframework.http.converter.HttpMessageConverter
                count: 14618
        org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.getProducible
MediaTypes(AbstractMessageConverterMethodProcessor.java:386)
                class: org.springframework.http.converter.GenericHttpMessageConverter
                count: 14603
        org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.getProducible
MediaTypes(AbstractMessageConverterMethodProcessor.java:387)
                class: org.springframework.http.converter.GenericHttpMessageConverter
                count: 8
--------------------------
3:      org.xnio.conduits.ConduitStreamSourceChannel
Count:  24870
Types:
        org.xnio.channels.CloseListenerSettable
        org.xnio.channels.ReadListenerSettable
Traces:
        org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.terminated(ReadReadyHandler.java:71)
                class: org.xnio.channels.CloseListenerSettable
                count: 12439
        org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:62)
                class: org.xnio.channels.ReadListenerSettable
                count: 12431
...

Hope this helps you. Let me know if there is a better place for you to report this (apart from the individual project issue trackers)

Cheers,
Christoph

@franz1981
Copy link
Contributor

Here is perfect, thanks @dreis2211 !
The ideal would be kind of idiomatic and unfixable cases for the most: as Quarkus perf eng we have plenty of non-idiomatic cases (if not on middleware-like code), but not that much with idiomatic ones; and they will likely be the ones the JDK devs are more interested :)

@dreis2211
Copy link
Author

dreis2211 commented Nov 2, 2022

Idiomatic as in the JDK itself?

Because the one in ReadReadyHandler is very idiomatic if you ask me:

        public void readReady() {
            final ChannelListener<? super C> readListener = channel.getReadListener();
            if (readListener == null) {
                channel.suspendReads();
            } else {
                ChannelListeners.invokeChannelListener(channel, readListener);
            }
        }

        public void terminated() {
            ChannelListeners.invokeChannelListener(channel, channel.getCloseListener());
        }

And the one from Spring as well:

		for (HttpMessageConverter<?> converter : this.messageConverters) {
			if (converter instanceof GenericHttpMessageConverter && targetType != null) {
				if (((GenericHttpMessageConverter<?>) converter).canWrite(targetType, valueClass, null)) {
					result.addAll(converter.getSupportedMediaTypes(valueClass));
				}
			}
			else if (converter.canWrite(valueClass, null)) {
				result.addAll(converter.getSupportedMediaTypes(valueClass));
			}
		}

The latter is fixable by some sort of cache, but is a very common/idiomatic pattern as well.

@franz1981
Copy link
Contributor

Difficult to say 🙂
With idiomatic I mean something that doesn't contain explicit cast/instanceof but still is reported (and possibly has no way to be fixed :() and/or patterns that still use casting but are unavoidable and/or need the devs to perform weird other changes in order to be fixed.

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

No branches or pull requests

2 participants