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

@ViewScoped unload may fail when client side state saving is used #375

Closed
BalusC opened this Issue May 3, 2017 · 1 comment

Comments

Projects
None yet
1 participant
@BalusC
Member

BalusC commented May 3, 2017

The sendBeacon basically appends view state param as GET parameter and when this exceeds ~8k, then @ViewScoped unload may fail on some browsers and/or servers.

@BalusC

This comment has been minimized.

Show comment
Hide comment
@BalusC

BalusC May 3, 2017

Member

Reproducer with javax.faces.STATE_SAVING_METHOD=client:

package com.example;

import java.io.Serializable;
import java.util.Random;

import javax.annotation.PostConstruct;
import javax.inject.Named;

import org.omnifaces.cdi.ViewScoped;
import org.omnifaces.util.Faces;

@Named
@ViewScoped
public class Bean implements Serializable {

	private static final long serialVersionUID = 1L;

	@PostConstruct
	public void init() {
		byte[] bytes = new byte[10000];
		new Random().nextBytes(bytes);
		Faces.getMetadataAttributes().put("test", bytes);
	}

}
<h:form>#{bean}</h:form>

When unloading such page, Tomcat 8.5.x fails with:

INFO: Error parsing HTTP request header
 Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level.
java.lang.IllegalArgumentException: Request header is too large
	at org.apache.coyote.http11.Http11InputBuffer.fill(Http11InputBuffer.java:735)
	at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:497)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:994)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:785)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1425)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:745)

Member

BalusC commented May 3, 2017

Reproducer with javax.faces.STATE_SAVING_METHOD=client:

package com.example;

import java.io.Serializable;
import java.util.Random;

import javax.annotation.PostConstruct;
import javax.inject.Named;

import org.omnifaces.cdi.ViewScoped;
import org.omnifaces.util.Faces;

@Named
@ViewScoped
public class Bean implements Serializable {

	private static final long serialVersionUID = 1L;

	@PostConstruct
	public void init() {
		byte[] bytes = new byte[10000];
		new Random().nextBytes(bytes);
		Faces.getMetadataAttributes().put("test", bytes);
	}

}
<h:form>#{bean}</h:form>

When unloading such page, Tomcat 8.5.x fails with:

INFO: Error parsing HTTP request header
 Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level.
java.lang.IllegalArgumentException: Request header is too large
	at org.apache.coyote.http11.Http11InputBuffer.fill(Http11InputBuffer.java:735)
	at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:497)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:994)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:785)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1425)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:745)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment