-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Undertow - Only load resources that are known #43694
Conversation
@stuartwdouglas in case you have one minute to check if what I did is right or completely wrong, that would be appreciated. It looks like an oversight but you might have had very good reasons to not do that. Interesting context is here: #43676 (comment) . |
OK, well, it doesn't look very good:
I will have a second look after Devoxx. |
This comment has been minimized.
This comment has been minimized.
I pushed an additional commit (to be dropped) to get more information about the Windows CI failure. |
I had a closer look and we were actually collecting incorrect paths on Windows since forever but the previous code was actually fine with it. Now that we are stricter, we need to make sure the paths are correct. |
79c7818
to
ebb961b
Compare
This comment has been minimized.
This comment has been minimized.
This should be ready now. We were doing shady things on Windows. I cleaned up things by making sure the paths are normalized from the start, instead of doing it on an ad hoc basis. |
If we try to load every resource, we end up creating cache entries in the resourceCache CHM of the AppClassLoader, which is definitely not what we want in this case, given we are supposed to serve only known resources. Fixes quarkusio#43676
ebb961b
to
8d5680a
Compare
Status for workflow
|
@gsmet Just for our reference, in which release version of quarkus, we should expect this fix would be available. |
@prateeksharma2988 TBH the patch is a lot more involved than I thought it would be so I'm still unsure if we should backport it. It might get backported to 3.15 but I don't think it will hit 3.8. Also we will need some bake time once 3.16 is released before we even think about backporting it. |
if (!files.contains(path)) { | ||
return 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.
The fix is actually here. The rest is to make paths consistent so that we don't end up comparing Unix-styled paths and Windows-style paths.
@geoand @gastaldi I would appreciate another look at this one to make sure it makes sense. The rationale of the patch is that in prod mode, we know which files are around and we have a fixed list of them and so we shouldn't try to resolve them from the class loader as we will end up caching all the negative hits, which might cause the CL to become huge if you have a lot of invalid requests. I think that it was the original intent and that it somehow got lost. |
I will take a look tomorrow |
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.
LGTM
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.
Indeed looks like a legit omission :)
Can one of you kick off this build: #33018 I just rebased and want to see if it fixes that test case. |
If we try to load every resource, we end up creating cache entries in the resourceCache CHM of the AppClassLoader, which is definitely not what we want in this case, given we are supposed to serve only known resources.
Now I must admit the fix looks a bit too simple to be true :).
Fixes #43676