You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by "Woonsan Ko (JIRA)" <je...@portals.apache.org> on 2013/07/16 18:36:50 UTC

[jira] [Commented] (JS2-1283) ServletRequestCleanupService throws RuntimeException when a portlet is rendered asynchronously in parallel mode

    [ https://issues.apache.org/jira/browse/JS2-1283?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13709903#comment-13709903 ] 

Woonsan Ko commented on JS2-1283:
---------------------------------

Fixed:

Applied Ate's initial patch to avoid the problem with some additions:
(1) Moved the code retrieving AccessControlContext/Subject from Worker impl class to RenderingJob impl class because a worker thread implementation can be provided by the container (e.g, commonj worker monitor)
  By the way, JSSubject.doAsPrivileged() may involve JSSubject.setSubject() which also needs ServletRequestCleanupService. Therefore, the code calling JSSubject.doAsPrivileged() must be moved to the job implementation class as well.
(2) ServletRequestCleanupService now has #executeNestedRenderJob() method to provide proper thread context initialization/clean up like its #doFilter() method. (Thanks to Ate!)
(3) Contract extraction to be shared with worker monitor implementations (RenderingJob.ACCESS_CONTROL_CONTEXT_WORKER_ATTR)

With the fix, I don't see the error logs any more in my local load tests.
                
> ServletRequestCleanupService throws RuntimeException when a portlet is rendered asynchronously in parallel mode
> ---------------------------------------------------------------------------------------------------------------
>
>                 Key: JS2-1283
>                 URL: https://issues.apache.org/jira/browse/JS2-1283
>             Project: Jetspeed 2
>          Issue Type: Bug
>            Reporter: Woonsan Ko
>            Assignee: Woonsan Ko
>             Fix For: 2.2.3
>
>
> In a load testing, I found the following error logs in jetspeed.log:
> --------------------------------------------------------------------------------------------
> 16:41:23 ERROR WORKER_11 [org.apache.jetspeed.util.ServletRequestCleanupService.addCleanupCallback():61] Registring cleanup callback before ServletRequestCleanupService invoked from filter chain.
> java.lang.RuntimeException
> at org.apache.jetspeed.util.ServletRequestCleanupService.addCleanupCallback(ServletRequestCleanupService.java:56)
> at org.apache.jetspeed.util.ServletRequestThreadLocalCleanupCallback.<init>(ServletRequestThreadLocalCleanupCallback.java:33)
> at org.apache.jetspeed.security.JSSubject.setSubject(JSSubject.java:50)
> at org.apache.jetspeed.security.JSSubject.doAsPrivileged(JSSubject.java:185)
> at org.apache.jetspeed.aggregator.impl.WorkerImpl.run(WorkerImpl.java:172)
> 16:43:49 ERROR WORKER_10 [org.apache.jetspeed.util.ServletRequestCleanupService.addCleanupCallback():61] Registring cleanup callback before ServletRequestCleanupService invoked from filter chain.
> java.lang.RuntimeException
> at org.apache.jetspeed.util.ServletRequestCleanupService.addCleanupCallback(ServletRequestCleanupService.java:56)
> at org.apache.jetspeed.util.ServletRequestThreadLocalCleanupCallback.<init>(ServletRequestThreadLocalCleanupCallback.java:33)
> at org.apache.jetspeed.security.JSSubject.setSubject(JSSubject.java:50)
> at org.apache.jetspeed.security.JSSubject.doAsPrivileged(JSSubject.java:185)
> at org.apache.jetspeed.aggregator.impl.WorkerImpl.run(WorkerImpl.java:172)
> --------------------------------------------------------------------------------------------
> Apparently the async worker thread is not provided with the callbacks thread local list by the filter (ServletRequestCleanupFilter).
> So, to avoid the error, each job execution should be able to initialize and clear every time somehow.
> Also, JSSubject.doAsPrivileged(...) call is made in WorkerImpl currently. The problem is this can call ServletRequestCleanupService.addCleanupCallback() in its #setSubject(..) method. However, it is not recommendable to improve the WorkerImpl to initialize/clean up using ServletRequestCleanupService because a worker class might be provided by the container (e.g, commonj worker monitor) and WorkerImpl is just a default worker thread implementation.
> Therefore, the JSSubject.doAsProviledged(...) call should be moved to the job implementation class as well.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org