Details
Description
When PersistentFacesState.redirectTo() is invoked in a push application (such as when added to auctionMonitor with a Thread.sleep() added to one of the getters), the application can fail with a NullPointerException in various places, such as:
javax.faces.FacesException: java.lang.NullPointerException
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:128)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
at com.icesoft.faces.webapp.xmlhttp.PersistentFacesState.render(PersistentFacesState.java:176)
at com.icesoft.faces.webapp.xmlhttp.PersistentFacesState.executeAndRender(PersistentFacesState.java:312)
at com.icesoft.faces.async.render.RunnableRender.run(RunnableRender.java:143)
at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
at java.lang.Thread.run(Thread.java:637)
Caused by: java.lang.NullPointerException
at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:329)
at com.icesoft.faces.application.D2DViewHandler.renderView(D2DViewHandler.java:159)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
... 7 more
This appears to be caused by the locking implementation in redirectTo():
public void redirectTo(String uri) {
warnIfSynchronous();
try {
view.acquireLifecycleLock();
view.installThreadLocals();
view.getFacesContext().getExternalContext().redirect(uri);
} catch (Exception e) {
throw new RuntimeException(e);
} finally {
release();
view.releaseLifecycleLock();
}
}
view.releaseLifecycleLock() releases all locks held by the current thread. Unfortunately, the current thread may be in the midst of processing a JSF lifecycle, making it vulnerable to corruption from other (push) threads acting on the same view.
Activity
Ted Goddard
created issue -
Ted Goddard
made changes -
Field | Original Value | New Value |
---|---|---|
Salesforce Case | [] | |
Fix Version/s | 1.8.2 [ 10190 ] | |
Assignee | Ted Goddard [ ted.goddard ] |
Repository | Revision | Date | User | Message |
ICEsoft Public SVN Repository | #19234 | Wed Sep 09 08:20:48 MDT 2009 | ted.goddard | running redirectTo via ExecutorService ( |
Files Changed | ||||
MODIFY
/icefaces/trunk/icefaces/core/src/com/icesoft/faces/webapp/xmlhttp/PersistentFacesState.java
|
Ted Goddard
made changes -
Status | Open [ 1 ] | Resolved [ 5 ] |
Resolution | Fixed [ 1 ] |
Arran Mccullough
made changes -
Salesforce Case | [5007000000A6CuH] |
Ken Fyten
made changes -
Fix Version/s | 1.8.2-RC1 [ 10210 ] |
Ken Fyten
made changes -
Status | Resolved [ 5 ] | Closed [ 6 ] |
— src/com/icesoft/faces/webapp/xmlhttp/PersistentFacesState.java (revision 19230)
+++ src/com/icesoft/faces/webapp/xmlhttp/PersistentFacesState.java (working copy)
@@ -331,18 +331,23 @@
*
*/
+ public void redirectTo(final String uri) {
warnIfSynchronous();
catch (Exception e)
{ - throw new RuntimeException(e); - }finally
{ - release(); - view.releaseLifecycleLock(); - }+ executorService.execute(new Runnable() {
+ public void run()
+ });
}
/**