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

FISH-6072 Add null check to FilterRegistration #2

Merged
merged 4 commits into from
Jul 20, 2022

Conversation

kalinchan
Copy link
Member

@kalinchan kalinchan requested a review from Pandrex247 April 25, 2022 14:16
Copy link
Member

@Pandrex247 Pandrex247 left a comment

Choose a reason for hiding this comment

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

Can you include a couple of commits which bumps the version number to .payara-p2 and .payara-p3-SNAPSHOT please?

Also I'm not sure this is the correct fix...
The reason we're getting a failure is because this initializer is being hit twice.
It gets initialized by the FacesInitializer AND by itself as a ServletContainerInitializer in its own right.
So leaving the null check where it is we get:

  • The TyrusServletContainer of the second initializer as the javax.websocket.server.ServerContainer attribute of the ServletContext
  • Two TyrusServletFilters as HttpSessionListeners (one from each initializer run)
  • The TyrusServletFilter of the first initializer run registered as the Filter

Copy link
Member

@Pandrex247 Pandrex247 left a comment

Choose a reason for hiding this comment

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

I still don't think this is the way to fix it - I think we've actually got a race condition here, and this is just a band-aid over the top of it.
FacesInitializer and TyrusServletContainerInitializer both still attempt to initialize a filter, with only FacesInitializer checking if the filter is already present. The order that these happen in is undefined, it's just whatever order the initializers are found in (this order only changes on server restart, not on application redeploy).

So if FacesInitializer attempts to start first then we're in the same boat as before with Tyrus starting and registering everything twice (now just with different names), and in fact we get an error from this with one of the filters failing to start:

Exception starting filter 3fdc48ef-b66a-4fd4-a99d-71770c97656e
java.lang.InstantiationException
...
Caused by: javax.websocket.DeploymentException: Found equivalent paths. Added path: '/JSF23WebSocket-1.0/javax.faces.push/{channel}' is equivalent with '/JSF23WebSocket-1.0/javax.faces.push/{channel}'

I think we should have a proper sit down to look through this together to make sure we iron it out properly, though I suspect it may simply be a case of adding a similar null check to the Tyrus onStartup similar to Faces (either that or ensuring Tyrus always starts before Faces, though that's probably just another bandaid).

Side note, as you can tell from the log message, just using a UUID as the name of the filter makes the log a bit unhelpful from a user POV :P

@kalinchan kalinchan merged commit 45fc9d2 into payara:1.17.payara-maintenance Jul 20, 2022
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.

2 participants