[ 
https://issues.apache.org/jira/browse/JS2-1283?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Woonsan Ko updated JS2-1283:
----------------------------

    Description: 
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)
--------------------------------------------------------------------------------------------

ServletRequestCleanupService seems to generate a RuntimeException to warn it as 
invalid state when invoked on #addCleanupCallback() because it assumes that 
every request processing was passed through the ServletRequestCleanupFilter.

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.

  was:
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.

    
> 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)
> --------------------------------------------------------------------------------------------
> ServletRequestCleanupService seems to generate a RuntimeException to warn it 
> as invalid state when invoked on #addCleanupCallback() because it assumes 
> that every request processing was passed through the 
> ServletRequestCleanupFilter.
> 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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to