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

Commited response and PartialResponseWriter #5189

Closed
unkle-jb opened this issue Dec 15, 2022 · 5 comments
Closed

Commited response and PartialResponseWriter #5189

unkle-jb opened this issue Dec 15, 2022 · 5 comments
Labels
Milestone

Comments

@unkle-jb
Copy link

Describe the bug

During the rendering of a (large) page, an error is thrown and a ExceptionHandler is triggered (Primefaces).
Unfortunately, the response buffer is already comitted.
Hence, no redirection towards the error page (through js scripts) can be done.
It was workign with Mojarra 2.2.X but not with Mojarra 4.0 which we just migrated to.

Our understanding of the current situation is that the BufferSize is set in the DelayedInitPartialResponseWriter initalisation (it is a lazy getter) triggering an IllegalStateException from the Underlying Response (Tomcat in our case, Jetty would behave similarly).

Is there a reason not to check the extCtx.isComitted() before setting the ReponseBufferSize ?

Expected behavior

Getting a PartialResponseWriter evevn if response is in the comitted state (which was doable in Mojarra 2.2.X, and working as far as we can tell).

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Java 17
Mojarra 4.0
Primefaces 12
Tomcat 10

Commit (unfortunately, no more Jira...)
javaee/mojarra@a030c06

@BalusC
Copy link
Contributor

BalusC commented Dec 17, 2022

I tried reproducing this but I was unable to find the proper configuration triggering this misbehavior. Can you perhaps provide a reproducer?

cc: @melloware

@melloware
Copy link
Contributor

@unkle-jb you can use this little test project to create a simple reproducer: https://github.com/primefaces/primefaces-test/tree/jakarta

We have a 4.0 Jakarta branch all set and ready.

@unkle-jb
Copy link
Author

@BalusC, @melloware Thanks !
Will try to get you a reproducer soon.

@unkle-jb
Copy link
Author

That went easier than expected.
Here is a short test project, which can be run with mojarra40 (mvn clean jetty:run -Pmojarra40):
primefaces-test.zip

Try it with value 50 or 5000 for nbSentences in TestView.

Behaviour is different, and for (I'd say) bad reason.
For info we managed to extend the PrimePartialViewContext in order to redefine the DelayedInitPartialResponseWriter.
It is a bit Frankenstein-ish since we handle pure Mojarra issue with Primefaces overloading mechanism, but right now it "works" as before (ie Mojarra 2.2.X).

@BalusC
Copy link
Contributor

BalusC commented May 20, 2023

Ok, reproduced and improved.

BalusC added a commit that referenced this issue Jul 2, 2023
BalusC added a commit that referenced this issue Jul 2, 2023
@BalusC BalusC closed this as completed in 9426764 Jul 2, 2023
BalusC added a commit that referenced this issue Jul 2, 2023
@BalusC BalusC added this to the 2.3.20 milestone Jul 22, 2023
@BalusC BalusC added the 2.3 label Jul 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants