DO NOT REPLY [Bug 46366] New: Misleading text in RUNNING.txt

2008-12-09 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=46366

   Summary: Misleading text in RUNNING.txt
   Product: Tomcat 6
   Version: 6.0.18
  Platform: PC
OS/Version: Linux
Status: NEW
  Severity: minor
  Priority: P4
 Component: Documentation
AssignedTo: dev@tomcat.apache.org
ReportedBy: [EMAIL PROTECTED]


The text in RUNNING.txt on multiple instances suggests that one can supply an
option "-Dcatalina.base" with the startup command.

This is not the case for "startup.sh" nor for "catalina.sh".
CATALINA_BASE needs to be defined in $CATALINA_HOME/bin/setenv.sh in order for
this to work.

Please modify the text in RUNNING.txt accordingly or modify "catalina.sh" to
also accept this "-D..." -option.

Thanks in advance,
Tom.

NB: Also noted the same issue in 5.5


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



DO NOT REPLY [Bug 42693] JSP-Generation error with recursive tagfile structure

2008-12-09 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=42693


Jens Askengren <[EMAIL PROTECTED]> changed:

   What|Removed |Added

 CC||[EMAIL PROTECTED]




-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



DO NOT REPLY [Bug 46352] Apache 1.3 crashes inside mod_jk.so with selfsigned SSL cert

2008-12-09 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=46352


Rainer Jung <[EMAIL PROTECTED]> changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|WORKSFORME  |




--- Comment #8 from Rainer Jung <[EMAIL PROTECTED]>  2008-12-09 04:30:53 PST ---
Aha, progress!
In jk_translate there are two lines, where we use

ap_set_module_config(r->request_config, &jk_module, ...)

Those are the lines were we set the rule_extension_t. So if you could output
the value of the last argument (as a pointer, not the structure it points to)
there and of e after

e = (rule_extension_t *)ap_get_module_config(r->request_config, &jk_module);

we can see, whether the request_config changes (e changes), or if not it's
actually the contents of e that change.

You should also output the address of r in the three lines, so we can check
whether actually the request changes between seeting the structure and
retrieving it. That would be something we don't expect, but maybe there are sub
requests or something similar involved.

I'll try to reproduce later today, now that we are closer to the root cause.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



DO NOT REPLY [Bug 46352] Apache 1.3 crashes inside mod_jk.so with selfsigned SSL cert

2008-12-09 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=46352





--- Comment #7 from Patrick Middleton <[EMAIL PROTECTED]>  2008-12-09 04:01:05 
PST ---
Created an attachment (id=23004)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=23004)
sample of debugging code, output, and httpd.conf files

Having dug in some more ... 

I wondered if I ought to try blaming mod_gzip/1.3.26.1a, but removing it made
no difference.

I didn't keep my original problematic httpd.conf file.  It took me some time to
put some changes back in to show the problem.  When looking at the files I have
included in the attachment (the httpd.conf files have been removed of most of
the things my Corporate Security Officer would not want disclosed) you might
notice a SetHandler jakarta-servlet directive somewhere in the bad one; I was
getting random Access Forbidden and Resource Not Available responses for
requests that should have been handled by my servlet.



My original stacktrace was generated on PPC, a RISC architecture where
out-of-order execution is rampant, and showed references to things like
memcpy() which didn't make sense for the reported line number of the source
code.  Having added some debugging code, the point at which the bug is reported
has moved; it is now more consistently this line:
's->extension.fail_on_status = ap_palloc(r->pool,
e->fail_on_status_size * sizeof(int));'

and the debugging output I have included that for requests with the 'good'
configuration, the rule_extension structure is sensible (the timeout is -1,
every other field is 0 or null) but for requests with the 'bad' configuration,
that structure contains random rubbish which causes the dysfunctional call to
memcpy().

So ... why are the contents of 'rule_extension_t *e' bad?  Are we getting a
pointer to something that's been overwritten, or being given a pointer to
something that was never initialized?


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



DO NOT REPLY [Bug 46284] Add flag to DeltaManager that blocks processing cluster messages until local applicaiton initialization is completed

2008-12-09 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=46284


Jason A. Lunn <[EMAIL PROTECTED]> changed:

   What|Removed |Added

  Attachment #22928|0   |1
is obsolete||




--- Comment #2 from Jason A. Lunn <[EMAIL PROTECTED]>  2008-12-09 06:49:48 PST 
---
Created an attachment (id=23005)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=23005)
A multi-file patch that includes changes that allow DeltaManager to block
processing of cluster messages until local application initialization is
complete

Revised per Filip's feedback:

1. added volatile keyword to declaration of variable 'gate'
2. synchronized the null check and assignment of 'gate'
3. -- Nothing done here yet, the intention of the current design is to block
all incoming session replication messages from being processed until all local
applications have been initialized.
4. removed tabs


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



DO NOT REPLY [Bug 46352] Apache 1.3 crashes inside mod_jk.so with selfsigned SSL cert

2008-12-09 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=46352





--- Comment #9 from Patrick Middleton <[EMAIL PROTECTED]>  2008-12-09 09:33:20 
PST ---
What I found was that in jk_translate, in the 'good' configuration, e (or, *ext
... the rule_extension_t) remained null after the first call to
ap_set_module_config().  There is a second call to ap_set_module_config().  My
logging shows that the rule_extension_t has been set before this, and also
before the call to map_uri_to_worker_ext() a few lines earlier.

In the 'bad' configuration, a crash was occurring before getting as far as
three logging calls I added around map_uri_to_worker_ext() and
ap_set_module_config().

I noticed that in the 'bad' configuration, there were no JkMount directives at
all, so I added some.  This did not prevent crashing.  Later, the 'good'
configuration was crashing too.  Right now neither are crashing.  Intermittent
problems of /services/ , /services/index.jsp and /services.html producing
server 404 pages or Tomcat resource-unavailable pages continues.  Using
 to add a 'SetHandler jakarta-servlet' directive continues to move in
and out of the configuration.  I am guessing wildly here, but from the symptoms
it looks to me like some memory is being allocated for a control structure like
a rule_extension_t, and then not initialised by code because it appears to have
been initialised already.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



DO NOT REPLY [Bug 46370] New: NullPointerException in AccessLogValve

2008-12-09 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=46370

   Summary: NullPointerException in AccessLogValve
   Product: Tomcat 6
   Version: 6.0.18
  Platform: All
OS/Version: Linux
Status: NEW
  Severity: normal
  Priority: P2
 Component: Catalina
AssignedTo: dev@tomcat.apache.org
ReportedBy: [EMAIL PROTECTED]


I get a NullPointerException (stacktrace follows) when I call
getNext().invoke(...) in my Valve, when in the valve chain exists the
AccessLogValve.

My valve creates a 'wrapper' for the Response using a class like this:

public class CountingResponse extends ResponseDecorator {
final private transient AtomicInteger counter;
private CountingResponseWrapper wrapper;

public CountingResponse(final Response target) {
super(target);
wrapper = null;
counter = new AtomicInteger(0);
}

@Override
public synchronized HttpServletResponse getResponse() {
if (wrapper == null) {
final HttpServletResponse supResponse =
super.getResponse();
if (supResponse == null) {
return null;
}
wrapper = new CountingResponseWrapper(supResponse,
counter);
}
return wrapper;
}

@Override
public ServletOutputStream getOutputStream() throws IOException {
final ServletOutputStream stream = super.getOutputStream();
if (stream instanceof CountingOutputStream) {
return stream;
}
return new CountingOutputStream(stream, counter);
}

@Override
public PrintWriter getWriter() throws IOException {
final PrintWriter writer = super.getWriter();
if (writer instanceof CountingWriter) {
return writer;
}
return new CountingWriter(writer, counter);
}

public int getCounter() {
return counter.get();
}
}

The ResponseDecorator is a a class that extends
org.apache.catalina.connector.Response, its constructor takes Response (target)
as argument and all public and protected calls are redirected to target (a
simple decorator).

The stacktrace:

java.lang.NullPointerException
at
org.apache.catalina.connector.Response.getContentCountLong(Response.java:313)
at
org.apache.catalina.valves.AccessLogValve$ByteSentElement.addElement(AccessLogValve.java:1102)
at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:582)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.ha.session.JvmRouteBinderValve.invoke(JvmRouteBinderValve.java:209)
at
org.apache.catalina.ha.tcp.ReplicationValve.invoke(ReplicationValve.java:347)
at pl.avantis.tomcat.valves.RemoteCLValve.invoke(RemoteCLValve.java:77)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



DO NOT REPLY [Bug 45931] trimSpaces incorrectly modifies output

2008-12-09 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=45931





--- Comment #5 from Meetesh Karia <[EMAIL PROTECTED]>  2008-12-09 11:04:21 PST 
---
Hi all, I was just wondering if there was a timeline for review/inclusion of
this patch.  Thanks!


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r724849 - in /tomcat/trunk/java/org/apache: coyote/http11/Http11NioProcessor.java coyote/http11/Http11NioProtocol.java coyote/http11/InternalNioInputBuffer.java tomcat/util/net/NioEndpoint

2008-12-09 Thread fhanik
Author: fhanik
Date: Tue Dec  9 11:38:44 2008
New Revision: 724849

URL: http://svn.apache.org/viewvc?rev=724849&view=rev
Log:
Implement keep alive timeout, and while doing this, I realized that keepalive 
is either on or off, but there is no counter

Modified:
tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java
tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java
tomcat/trunk/java/org/apache/coyote/http11/InternalNioInputBuffer.java
tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java

Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java?rev=724849&r1=724848&r2=724849&view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java Tue Dec  
9 11:38:44 2008
@@ -208,8 +208,7 @@
  * Maximum number of Keep-Alive requests to honor.
  */
 protected int maxKeepAliveRequests = -1;
-
-
+
 /**
  * SSL enabled ?
  */
@@ -726,13 +725,15 @@
 public SocketState event(SocketStatus status)
 throws IOException {
 
-RequestInfo rp = request.getRequestProcessor();
+long soTimeout = endpoint.getSoTimeout();
+int keepAliveTimeout = endpoint.getKeepAliveTimeout();
 
+RequestInfo rp = request.getRequestProcessor();
+final NioEndpoint.KeyAttachment attach = 
(NioEndpoint.KeyAttachment)socket.getAttachment(false);
 try {
 rp.setStage(org.apache.coyote.Constants.STAGE_SERVICE);
 error = !adapter.event(request, response, status);
 if ( !error ) {
-NioEndpoint.KeyAttachment attach = 
(NioEndpoint.KeyAttachment)socket.getAttachment(false);
 if (attach != null) {
 attach.setComet(comet);
 if (comet) {
@@ -740,7 +741,11 @@
 if (comettimeout != null) 
attach.setTimeout(comettimeout.longValue());
 } else {
 //reset the timeout
-
attach.setTimeout(endpoint.getSocketProperties().getSoTimeout());
+if (keepAlive && keepAliveTimeout>0) {
+attach.setTimeout(keepAliveTimeout);
+} else {
+attach.setTimeout(soTimeout);
+}
 }
 
 }
@@ -761,7 +766,6 @@
 return SocketState.CLOSED;
 } else if (!comet) {
 recycle();
-//pay attention to the keep alive flag set in process()
 return (keepAlive)?SocketState.OPEN:SocketState.CLOSED;
 } else {
 return SocketState.LONG;
@@ -791,15 +795,17 @@
 keepAlive = true;
 comet = false;
 
-
-int keepAliveLeft = maxKeepAliveRequests;
 long soTimeout = endpoint.getSoTimeout();
+int keepAliveTimeout = endpoint.getKeepAliveTimeout();
 
 boolean keptAlive = false;
 boolean openSocket = false;
 boolean recycle = true;
+final KeyAttachment ka = (KeyAttachment)socket.getAttachment(false);
+
 while (!error && keepAlive && !comet) {
-
+//always default to our soTimeout
+ka.setTimeout(soTimeout);
 // Parsing the request header
 try {
 if( !disableUploadTimeout && keptAlive && soTimeout > 0 ) {
@@ -810,6 +816,10 @@
 //of the request line, we can't recycle the processor
 openSocket = true;
 recycle = false;
+if (inputBuffer.getParsingRequestLinePhase()<2) {
+//keep alive timeout here
+if (keepAliveTimeout>0) 
ka.setTimeout(keepAliveTimeout);
+}
 break;
 }
 keptAlive = true;
@@ -851,8 +861,10 @@
 response.setStatus(400);
 error = true;
 }
-
-if (maxKeepAliveRequests > 0 && --keepAliveLeft == 0)
+
+if (maxKeepAliveRequests == 1 )
+keepAlive = false;
+if (maxKeepAliveRequests > 0 && ka.decrementKeepAlive() <= 0)
 keepAlive = false;
 
 // Process the request in the adapter
@@ -916,7 +928,6 @@
 
 // Do sendfile as needed: add socket to sendfile and end
 if (sendfileData != null && !error) {
-KeyAttachment ka = (KeyAttachment)socket.getAttachment(false);
 ka.setSendfileData(sendfileData);
 sendfileData.keepAlive = keepAlive;
 SelectionKey key = 
socket.getIOChannel().keyFor(socket.getP

Re: Executor - package dependencies

2008-12-09 Thread Filip Hanik - Dev Lists

Remy Maucherat wrote:

On Mon, 2008-12-08 at 09:59 -0700, Filip Hanik - Dev Lists wrote:
  

I'll noodle on it a bit, see if i can think of something to defilipize it



Or keep it Filipized, but you'll need to move it in util.
  
it had to be filipized in order to have a life cycle, however the 
Lifecycle API is in org.apache.catalina, so I can't that easily move it 
to util unless I get rid of the Lifecycle, but that was the point to 
begin with.


however, I can extract the task queue and task thread factory into util, 
and that way, I get rid of all the duplicate code I was worried about 
earlier.


It wont get me all the way, but it gets me pretty far, so I will start 
with that .


Filip

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r724886 - in /tomcat/trunk/java/org/apache: catalina/core/StandardThreadExecutor.java tomcat/util/net/NioEndpoint.java tomcat/util/threads/TaskQueue.java tomcat/util/threads/TaskThreadFact

2008-12-09 Thread fhanik
Author: fhanik
Date: Tue Dec  9 12:56:59 2008
New Revision: 724886

URL: http://svn.apache.org/viewvc?rev=724886&view=rev
Log:
Refactored the thread pooling when using an executor, this gets rid of 
duplicate code in the NIO connector as well as in the 
org.apache.catalina.core.StandardThreadExecutor package.
I provided a ThreadPoolExecutor with a small extension to the 
java.util.concurrent
The connector method setExecutor still take a java.util.concurrent.Executor as 
an argument to provide the most flexibility

Added:
tomcat/trunk/java/org/apache/tomcat/util/threads/TaskQueue.java   (with 
props)
tomcat/trunk/java/org/apache/tomcat/util/threads/TaskThreadFactory.java   
(with props)
tomcat/trunk/java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java   
(with props)
Modified:
tomcat/trunk/java/org/apache/catalina/core/StandardThreadExecutor.java
tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java

Modified: tomcat/trunk/java/org/apache/catalina/core/StandardThreadExecutor.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardThreadExecutor.java?rev=724886&r1=724885&r2=724886&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/core/StandardThreadExecutor.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardThreadExecutor.java Tue 
Dec  9 12:56:59 2008
@@ -17,18 +17,16 @@
 
 package org.apache.catalina.core;
 
-import java.util.Collection;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.RejectedExecutionException;
 import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.catalina.Executor;
 import org.apache.catalina.LifecycleException;
 import org.apache.catalina.LifecycleListener;
 import org.apache.catalina.util.LifecycleSupport;
-import java.util.concurrent.RejectedExecutionException;
+import org.apache.tomcat.util.threads.TaskQueue;
+import org.apache.tomcat.util.threads.TaskThreadFactory;
+import org.apache.tomcat.util.threads.ThreadPoolExecutor;
 
 public class StandardThreadExecutor implements Executor {
 
@@ -90,7 +88,7 @@
 public void start() throws LifecycleException {
 lifecycle.fireLifecycleEvent(BEFORE_START_EVENT, null);
 TaskQueue taskqueue = new TaskQueue(maxQueueSize);
-TaskThreadFactory tf = new TaskThreadFactory(namePrefix);
+TaskThreadFactory tf = new 
TaskThreadFactory(namePrefix,daemon,getThreadPriority());
 lifecycle.fireLifecycleEvent(START_EVENT, null);
 executor = new ThreadPoolExecutor(getMinSpareThreads(), 
getMaxThreads(), maxIdleTime, TimeUnit.MILLISECONDS,taskqueue, tf);
 taskqueue.setParent( (ThreadPoolExecutor) executor);
@@ -107,17 +105,10 @@
 
 public void execute(Runnable command, long timeout, TimeUnit unit) {
 if ( executor != null ) {
-try {
-executor.execute(command);
-} catch (RejectedExecutionException rx) {
-//there could have been contention around the queue
-try {
-if ( !( (TaskQueue) 
executor.getQueue()).force(command,timeout,unit) ) throw new 
RejectedExecutionException("Work queue full.");
-}catch (InterruptedException x) {
-throw new RejectedExecutionException("Interrupted.",x);
-}
-}
-} else throw new IllegalStateException("StandardThreadPool not 
started.");
+executor.execute(command,timeout,unit);
+} else { 
+throw new IllegalStateException("StandardThreadExecutor not 
started.");
+}
 }
 
 
@@ -258,71 +249,4 @@
 public int getQueueSize() {
 return (executor != null) ? executor.getQueue().size() : -1;
 }
-
-// -- TaskQueue Inner Class
-class TaskQueue extends LinkedBlockingQueue {
-ThreadPoolExecutor parent = null;
-
-public TaskQueue() {
-super();
-}
-
-public TaskQueue(int capacity) {
-super(capacity);
-}
-
-public TaskQueue(Collection c) {
-super(c);
-}
-
-public void setParent(ThreadPoolExecutor tp) {
-parent = tp;
-}
-
-public boolean force(Runnable o) {
-if ( parent.isShutdown() ) throw new 
RejectedExecutionException("Executor not running, can't force a command into 
the queue");
-return super.offer(o); //forces the item onto the queue, to be 
used if the task is rejected
-}
-
-public boolean force(Runnable o, long timeout, TimeUnit unit) throws 
InterruptedException {
-if ( parent.isShutdown() ) throw new 
RejectedExecutionException("Executor not running, can't for

svn commit: r724889 - /tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java

2008-12-09 Thread fhanik
Author: fhanik
Date: Tue Dec  9 12:59:36 2008
New Revision: 724889

URL: http://svn.apache.org/viewvc?rev=724889&view=rev
Log:
correct the import statement

Modified:
tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?rev=724889&r1=724888&r2=724889&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Tue Dec  9 
12:59:36 2008
@@ -41,7 +41,6 @@
 import java.util.concurrent.Executor;
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicLong;
@@ -62,6 +61,7 @@
 import org.apache.tomcat.util.res.StringManager;
 import org.apache.tomcat.util.threads.TaskQueue;
 import org.apache.tomcat.util.threads.TaskThreadFactory;
+import org.apache.tomcat.util.threads.ThreadPoolExecutor;
 
 /**
  * NIO tailored thread pool, providing the following services:
@@ -365,8 +365,8 @@
 protected int maxThreads = 200;
 public void setMaxThreads(int maxThreads) {
 this.maxThreads = maxThreads;
-if (running && executor!=null && executor instanceof 
ThreadPoolExecutor) {
-((ThreadPoolExecutor)executor).setMaximumPoolSize(maxThreads);
+if (running && executor!=null && executor instanceof 
java.util.concurrent.ThreadPoolExecutor) {
+
((java.util.concurrent.ThreadPoolExecutor)executor).setMaximumPoolSize(maxThreads);
 }
 }
 public int getMaxThreads() { return maxThreads; }



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r724897 - /tomcat/trunk/java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java

2008-12-09 Thread fhanik
Author: fhanik
Date: Tue Dec  9 13:22:38 2008
New Revision: 724897

URL: http://svn.apache.org/viewvc?rev=724897&view=rev
Log:
Implement an execution that adds the task to the queue if rejected, and allow 
to try to add for a specified time

Modified:
tomcat/trunk/java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java?rev=724897&r1=724896&r2=724897&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java 
Tue Dec  9 13:22:38 2008
@@ -17,6 +17,7 @@
 package org.apache.tomcat.util.threads;
 
 import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.RejectedExecutionException;
 import java.util.concurrent.RejectedExecutionHandler;
 import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.TimeUnit;
@@ -24,6 +25,8 @@
 /**
  * Same as a java.util.concurrent.ThreadPoolExecutor but implements a much 
more efficient
  * getActiveCount method, to be used to properly handle the work queue
+ * If a RejectedExecutionHandler is not specified a default one will be 
configured
+ * and that one will always throw a RejectedExecutionException
  * @author fhanik
  *
  */
@@ -41,11 +44,11 @@
 }
 
 public ThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long 
keepAliveTime, TimeUnit unit, BlockingQueue workQueue, ThreadFactory 
threadFactory) {
-super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, 
threadFactory);
+super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, 
threadFactory, new RejectHandler());
 }
 
 public ThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long 
keepAliveTime, TimeUnit unit, BlockingQueue workQueue) {
-super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue);
+super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, 
new RejectHandler());
 }
 
 @Override
@@ -63,11 +66,54 @@
 return activeCount.get();
 }
 
+/**
+ * [EMAIL PROTECTED]
+ */
+@Override
+public void execute(Runnable command) {
+execute(command,0,TimeUnit.MILLISECONDS);
+}
+
+/**
+ * Executes the given command at some time in the future.  The command
+ * may execute in a new thread, in a pooled thread, or in the calling
+ * thread, at the discretion of the Executor implementation.
+ * If no threads are available, it will be added to the work queue.
+ * If the work queue is full, the system will wait for the specified 
+ * time and it throw a RejectedExecutionException if the queue is still 
full after that.
+ *
+ * @param command the runnable task
+ * @throws RejectedExecutionException if this task cannot be
+ * accepted for execution - the queue is full
+ * @throws NullPointerException if command or unit is null
+ */
 public void execute(Runnable command, long timeout, TimeUnit unit) {
+try {
+super.execute(command);
+} catch (RejectedExecutionException rx) {
+if (super.getQueue() instanceof TaskQueue) {
+TaskQueue queue = (TaskQueue)super.getQueue();
+try {
+if (!queue.force(command, timeout, unit)) {
+throw new RejectedExecutionException("Queue capacity 
is full.");
+}
+} catch (InterruptedException x) {
+Thread.currentThread().interrupted();
+throw new RejectedExecutionException(x);
+}
+} else {
+throw rx;
+}
+
+}
+}
+
+static class RejectHandler implements 
java.util.concurrent.RejectedExecutionHandler {
+public void rejectedExecution(Runnable r, 
java.util.concurrent.ThreadPoolExecutor executor) {
+throw new RejectedExecutionException();
+}
 
 }
-
-
 
 
 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Executor - package dependencies

2008-12-09 Thread Filip Hanik - Dev Lists

Filip Hanik - Dev Lists wrote:

Remy Maucherat wrote:

On Mon, 2008-12-08 at 09:59 -0700, Filip Hanik - Dev Lists wrote:
 
I'll noodle on it a bit, see if i can think of something to 
defilipize it



Or keep it Filipized, but you'll need to move it in util.
  
it had to be filipized in order to have a life cycle, however the 
Lifecycle API is in org.apache.catalina, so I can't that easily move 
it to util unless I get rid of the Lifecycle, but that was the point 
to begin with.


however, I can extract the task queue and task thread factory into 
util, and that way, I get rid of all the duplicate code I was worried 
about earlier.


It wont get me all the way, but it gets me pretty far, so I will start 
with that .

ok, this is what I did, sorry for the multiple commits

http://svn.apache.org/viewvc?rev=724886&view=rev
http://svn.apache.org/viewvc?rev=724889&view=rev
http://svn.apache.org/viewvc?rev=724897&view=rev

And I'm pretty happy with this implementation, it lets me get rid of any 
thread pool in the NIO endpoint and the StandardThreadExecutor


Filip

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r724919 - /tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java

2008-12-09 Thread fhanik
Author: fhanik
Date: Tue Dec  9 14:33:08 2008
New Revision: 724919

URL: http://svn.apache.org/viewvc?rev=724919&view=rev
Log:
cleanup methods not used, and correct methods that used the old thread stats

Modified:
tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?rev=724919&r1=724918&r2=724919&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Tue Dec  9 
14:33:08 2008
@@ -40,6 +40,7 @@
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.Executor;
 import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.RejectedExecutionException;
 import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
@@ -133,24 +134,6 @@
  * Track the initialization state of the endpoint.
  */
 protected boolean initialized = false;
-
-
-/**
- * Current worker threads busy count.
- */
-protected int curThreadsBusy = 0;
-
-
-/**
- * Current worker threads count.
- */
-protected int curThreads = 0;
-
-
-/**
- * Sequence number used to generate thread names.
- */
-protected int sequence = 0;
 
 protected NioSelectorPool selectorPool = new NioSelectorPool();
 
@@ -746,7 +729,13 @@
  * @return the amount of threads that are managed by the pool
  */
 public int getCurrentThreadCount() {
-return curThreads;
+final Executor executor = this.executor;
+if (executor!=null) {
+if (executor instanceof java.util.concurrent.ThreadPoolExecutor) {
+return 
((java.util.concurrent.ThreadPoolExecutor)executor).getPoolSize();
+}
+} 
+return 0;
 }
 
 
@@ -756,7 +745,13 @@
  * @return the amount of threads currently busy
  */
 public int getCurrentThreadsBusy() {
-return curThreadsBusy;
+final Executor executor = this.executor;
+if (executor!=null) {
+if (executor instanceof java.util.concurrent.ThreadPoolExecutor) {
+return 
((java.util.concurrent.ThreadPoolExecutor)executor).getPoolSize();
+}
+} 
+return activeSocketProcessors.get();
 }
 
 
@@ -979,13 +974,6 @@
 // -- Protected Methods
 
 
-/**
- * Get a sequence number used for thread naming.
- */
-protected int getSequence() {
-return sequence++;
-}
-
 public int getWriteBufSize() {
 return socketProperties.getTxBufSize();
 }
@@ -1147,6 +1135,10 @@
 else sc.reset(socket,status);
 if ( dispatch && executor!=null ) executor.execute(sc);
 else sc.run();
+} catch (RejectedExecutionException rx) {
+if (log.isDebugEnabled()) {
+log.debug("Unable to process socket, executor rejected the 
task.",rx);
+}
 } catch (Throwable t) {
 // This means we got an OOM or similar creating a thread, or that
 // the pool and its queue are full



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r724926 - /tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java

2008-12-09 Thread fhanik
Author: fhanik
Date: Tue Dec  9 15:13:26 2008
New Revision: 724926

URL: http://svn.apache.org/viewvc?rev=724926&view=rev
Log:
oops, must return false, or a leak will happen

Modified:
tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?rev=724926&r1=724925&r2=724926&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Tue Dec  9 
15:13:26 2008
@@ -1139,6 +1139,7 @@
 if (log.isDebugEnabled()) {
 log.debug("Unable to process socket, executor rejected the 
task.",rx);
 }
+return false;
 } catch (Throwable t) {
 // This means we got an OOM or similar creating a thread, or that
 // the pool and its queue are full



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



DO NOT REPLY [Bug 39013] Incorrect use of docBase from XML Context file deployment

2008-12-09 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=39013


Kirk True <[EMAIL PROTECTED]> changed:

   What|Removed |Added

 AssignedTo|[EMAIL PROTECTED]   |dev@tomcat.apache.org




--- Comment #3 from Kirk True <[EMAIL PROTECTED]>  2008-12-09 16:33:18 PST ---
I've attached a patch that fixes the immediate issue as per the bug report.
However, there could easily be cases that this doesn't catch. Please review.

Thanks.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tomcat newbie developer tasks?

2008-12-09 Thread Kirk True

Hi Mark,

Mark Thomas wrote:
Take a look at the following bugs. 
  


. . .



https://issues.apache.org/bugzilla/show_bug.cgi?id=38570
https://issues.apache.org/bugzilla/show_bug.cgi?id=38726
https://issues.apache.org/bugzilla/show_bug.cgi?id=39013

  



Bugs 38570 and 38726 do not reproduce for the trunk, 6.0.18, or 5.5.27. 
I noted this in the bug but didn't close them - should I?


However, bug 39013 still occurs on the trunk (as of yesterday). I trace 
through and found a one-liner that solved the reported issue and 
attached the patch to the bug. As noted in the bug comments, I could 
easily have overlooked or broken something inadvertently.


Thanks,
Kirk

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]