Start connectors after deployment of all webapps have been completed

2011-05-15 Thread Afkham Azeez
Hi folks,
We are using Embedded Tomcat 7.0.14. We create connectors in the normal way,
add the webapps to Tomcat, and then call start on Tomcat. However, we
noticed that the connectors get started before the completion of the webapp
deployment. Is there a way to delay the starting of the connectors (opening
of the sockets) until after the webapps have been deployed?

Thanks
Azeez

-- 
*Afkham Azeez*
*Member; Apache Software Foundation;
**http://www.apache.org/*http://www.apache.org/


Re: Start connectors after deployment of all webapps have been completed

2011-05-15 Thread Sylvain Laurent
have a look at the bindOnInit parameter on the connector 
http://tomcat.apache.org/tomcat-7.0-doc/config/http.html

On 15 mai 2011, at 12:31, Afkham Azeez wrote:

 Hi folks,
 We are using Embedded Tomcat 7.0.14. We create connectors in the normal way,
 add the webapps to Tomcat, and then call start on Tomcat. However, we
 noticed that the connectors get started before the completion of the webapp
 deployment. Is there a way to delay the starting of the connectors (opening
 of the sockets) until after the webapps have been deployed?
 
 Thanks
 Azeez
 
 -- 
 *Afkham Azeez*
 *Member; Apache Software Foundation;
 **http://www.apache.org/*http://www.apache.org/


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Start connectors after deployment of all webapps have been completed

2011-05-15 Thread Afkham Azeez
Thanks Sylvain. That worked.

On Sun, May 15, 2011 at 8:21 PM, Sylvain Laurent sylvain.laur...@m4x.orgwrote:

 have a look at the bindOnInit parameter on the connector
 http://tomcat.apache.org/tomcat-7.0-doc/config/http.html

 On 15 mai 2011, at 12:31, Afkham Azeez wrote:

  Hi folks,
  We are using Embedded Tomcat 7.0.14. We create connectors in the normal
 way,
  add the webapps to Tomcat, and then call start on Tomcat. However, we
  noticed that the connectors get started before the completion of the
 webapp
  deployment. Is there a way to delay the starting of the connectors
 (opening
  of the sockets) until after the webapps have been deployed?
 
  Thanks
  Azeez
 
  --
  *Afkham Azeez*
  *Member; Apache Software Foundation;
  **http://www.apache.org/*http://www.apache.org/


 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org




-- 
*Afkham Azeez*
Director of Architecture; WSO2, Inc.; http://wso2.com,
*Member; Apache Software Foundation;
**http://www.apache.org/*http://www.apache.org/
*
*
*email: **az...@wso2.com* az...@wso2.com* cell: +94 77 3320919
blog: **http://blog.afkham.org* http://blog.afkham.org*
twitter: **http://twitter.com/afkham_azeez*http://twitter.com/afkham_azeez
*
linked-in: **http://lk.linkedin.com/in/afkhamazeez*
*
*
*Lean . Enterprise . Middleware*
*
*


Re: Start connectors after deployment of all webapps have been completed

2011-05-15 Thread Dan Checkoway
I wanted to express my thanks for the heads-up on bindOnInit as well.  I had
overlooked that in the connector config doc.

Just curious...is there any down side to setting bindOnInit=false?

To be honest, tomcat's default behavior of accepting a connection before
being able to serve it (i.e. while webapps are still initializing) has
always been something I found questionable, since the connected client just
sits and waits.  So I'm glad you turned me onto this workaround, but I just
want to be aware of any penalties if there are any...?

Thanks,
Dan

On Sun, May 15, 2011 at 11:56 AM, Afkham Azeez afk...@gmail.com wrote:

 Thanks Sylvain. That worked.

 On Sun, May 15, 2011 at 8:21 PM, Sylvain Laurent sylvain.laur...@m4x.org
 wrote:

  have a look at the bindOnInit parameter on the connector
  http://tomcat.apache.org/tomcat-7.0-doc/config/http.html
 
  On 15 mai 2011, at 12:31, Afkham Azeez wrote:
 
   Hi folks,
   We are using Embedded Tomcat 7.0.14. We create connectors in the normal
  way,
   add the webapps to Tomcat, and then call start on Tomcat. However, we
   noticed that the connectors get started before the completion of the
  webapp
   deployment. Is there a way to delay the starting of the connectors
  (opening
   of the sockets) until after the webapps have been deployed?
  
   Thanks
   Azeez
  
   --
   *Afkham Azeez*
   *Member; Apache Software Foundation;
   **http://www.apache.org/*http://www.apache.org/
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
  For additional commands, e-mail: users-h...@tomcat.apache.org
 
 


 --
 *Afkham Azeez*
 Director of Architecture; WSO2, Inc.; http://wso2.com,
 *Member; Apache Software Foundation;
 **http://www.apache.org/*http://www.apache.org/
 *
 *
 *email: **az...@wso2.com* az...@wso2.com* cell: +94 77 3320919
 blog: **http://blog.afkham.org* http://blog.afkham.org*
 twitter: **http://twitter.com/afkham_azeez*
 http://twitter.com/afkham_azeez
 *
 linked-in: **http://lk.linkedin.com/in/afkhamazeez*
 *
 *
 *Lean . Enterprise . Middleware*
 *
 *



Re: Start connectors after deployment of all webapps have been completed

2011-05-15 Thread Konstantin Kolinko
2011/5/16 Dan Checkoway dchecko...@gmail.com:
 I wanted to express my thanks for the heads-up on bindOnInit as well.  I had
 overlooked that in the connector config doc.

 Just curious...is there any down side to setting bindOnInit=false?

 To be honest, tomcat's default behavior of accepting a connection before
 being able to serve it (i.e. while webapps are still initializing) has
 always been something I found questionable, since the connected client just
 sits and waits.  So I'm glad you turned me onto this workaround, but I just
 want to be aware of any penalties if there are any...?

1) If you start Tomcat with jsvc it can init the connectors and bind
to ports (e.g. port 80) and drop privileges after that. That is the
primary reason why bindOnInit=true option is there.

2) If you open a port earlier the OS starts accepting connections
earlier. The connector will serve them after it actually starts. If
the port is not open a connection attempt will be refused immediately.


Best regards,
Konstantin Kolinko

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Canceling Download on IIS7 with ISAPI Redirector 1.2.31 causes 100% CPU usage

2011-05-15 Thread Tim Whittington
This sounds like https://issues.apache.org/bugzilla/show_bug.cgi?id=50839

If you can capture a TRACE level log form the Tomcat Connector
(configure in isapi_redirect.properties) and attach it to the bug,
I'll take a look.

cheers
tim

On Sun, May 15, 2011 at 1:20 AM, eurotrans-Verlag
verlag.preis...@t-online.de wrote:
 Hello everybody,

 I stumbled upon a strange problem with the ISAPI Redirector 1.2.31 on
 Windows Server 2008 SP2 (32 bit) with IIS 7.0. The problem is, that when a
 Servlet is generating lots of data (e.g. 200 MB) and a user downloads it
 over the Isapi Redirector/IIS7, and cancels the download, the IIS Worker
 process (w3wp.exe) will have 100% CPU usage for about 30 seconds. However if
 the download is completed normally (not canceled), everything is fine and
 the CPU usage will not go up that far.

 The exact Components used are:
 Windows Server 2008 SP2 (32 bit) with IIS 7.0,
 Sun JDK 1.6.0_25,
 Tomcat 7.0.14,
 ISAPI Redirector 1.2.31.

 I could reproduce the problem with a clean install of these components.

 To reproduce:
 1. Install Tomcat and the ISAPI Redirector on a Windows Server 2008 SP2 IIS
 7.0 system, as described in the Tomcat Connectors Documentation
 (The problem occurs with both settings of enable_chunked_encoding, true
 and false).

 2. Create a Servlet or JSP that produces some huge amount of random data,
 for example:

 @WebServlet(/DownloadServlet)
 public class DownloadServlet extends HttpServlet {
        protected void doGet(HttpServletRequest request, HttpServletResponse
 response) throws ServletException, IOException {
                response.setContentType(application/x-msdownload);
                OutputStream out = response.getOutputStream();
                Random r = new Random();
                byte[] content = new byte[1024];
                for (int i = 0; i  content.length; i++)
                        content[i] = (byte) (r.nextFloat() * 256);
                for (int i = 0; i  20; i++)
                        out.write(content);
                out.close();
        }
 }

 3. Request the Servlet or JSP through the IIS port with a browser. After
 some seconds, cancel the download.

 4. One thread of the IIS Worker Process (w3wp.exe) will have 100% CPU usage
 for some time (about 30 seconds), before it normalizes to 0%.
 Note that is does not happen every time. Sometimes you will have to repeat
 starting and canceling the download until the problem occurs.

 5. In the ISAPI log, following lines are logged (log_level=info):
 [Sat May 14 14:48:55.654 2011] [3508:3560] [error]
 isapi_write_client::jk_isapi_plugin.c (1210): WriteClient failed with 995
 (0x03e3)
 [Sat May 14 14:48:55.654 2011] [3508:3560] [info]
 ajp_process_callback::jk_ajp_common.c (1885): Writing to client aborted or
 client network problems
 [Sat May 14 14:48:55.654 2011] [3508:3560] [info]
 ajp_service::jk_ajp_common.c (2543): (worker1) sending request to tomcat
 failed (unrecoverable), because of client write error (attempt=1)
 [Sat May 14 14:48:55.669 2011] [3508:3560] [info]
 HttpExtensionProc::jk_isapi_plugin.c (2217): service() failed because client
 aborted connection

 These lines are logged immediately after the client cancels the connection
 (not after the CPU usage of w3wp.exe goes down).

 The worker process continues normally after the CPU usage went down.

 However, if one would do this repeatedly, it could enable DoS attacks,
 couldn't it?
 What would cause these excessive CPU usages of the IIS worker process when
 the user cancels the download?


 Thanks for your help.

 Konstantin Preißer


 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Tomcat startup error!

2011-05-15 Thread Konstantin Kolinko
2011/5/14 red phoenix rodphoe...@gmail.com:
 I use tomcat 7.0.12 with hibernate 3,when I startup first,it can work well
 and no errors.then I shutdown tomcat,and startup again,it raise following
 warning information:
 Warn: Failed to scan JAR [jndi:/localhost/examples/WEB-INF/lib/standard.jar]
 from WEB-INF/lib
 java.io.FileNotFoundException:
 c:\apache-tomcat-7.0.12\temp\jar_cache1803949900871975219.tmp (Another
 program is using this file, process can't visit)

Those jar_cache files look like the feature that was fixed in r1095367
http://markmail.org/thread/e75lywynlxgaakqr

I don't know what holds the file and whether its filename is actually
random or not.

Anyway, 7.0.14 is released and you may upgrade.

Best regards,
Konstantin Kolinko

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Canceling Download on IIS7 with ISAPI Redirector 1.2.31 causes 100% CPU usage

2011-05-15 Thread verlag.preis...@t-online.de
Hi Tim,

 This sounds like
 https://issues.apache.org/bugzilla/show_bug.cgi?id=50839 
 If you can capture a TRACE level log form the Tomcat Connector
 (configure in isapi_redirect.properties) and attach it to the bug,
 I'll take a look.
 
 cheers
 tim

Thanks! I will attach a Trace level log from the Redirector there.



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org