Re: Async Context not timing out
Hi Mark, Thanks for the reply. As I could understand from this bug https://issues.apache.org/bugzilla/show_bug.cgi?id=53061 , and referring to your comment "Looking at the NIO source code, there is a test that essentially means that timeouts only get processed after one second of inactivity so under high, constant load, timeouts will never be processed. I find it hard to believe it has always been like that so I'll need to go back and research who changed it (probably me), when it changed (probably the refactoring) and why it changed (probably an error on my part). I should be able to get that done pretty quickly. *This has been fixed in trunk and 7.0.x and will be included in 7.0.28 onwards. *", I assumed that the frequency of the timeout check was reduced. But now that you're saying that it is still there, using async timeout won't serve the purpose for me, because the timeouts for me can be anything from 100 millis to 1 millis. I think I should be using a timer thread or a HashWheeledTimer instead! Thank You! -Rahul PS: The async timeout works just fine with higher timeout and sleep values for e.g. (a timeout of 1000 millis and a sleep of 4000 millis always guarantees a timeout. On Tue, May 14, 2013 at 2:16 AM, Mark Thomas wrote: > On 13/05/2013 18:01, Rahul Kumar wrote: > > Hi All, > > > > I need some help with the async context timeout in servlet 3.0 running > > on tomcat 7.0.40. > > > > I have set the asynccontext timeout value, but the timeout behaviour is > > highly inconsistent. Sometimes the timeouts work, but most of the times > > they don't. I am attaching the source code and the output in plain text > > format. > > > > I have tried this on Tomcat 7.0.20, 7.0.37, 7.0.40. Nothing seems to > help. Am i doing something wrong? > > Yes and no. You are making assumptions about how frequently timeouts are > checked. Tomcat only checks them every second for APR/native and BIO. > NIO always checks every second by default and may check more frequently > when under low load. > > Mark > > > > > Please help. Apologize if I am wasting your time! But I need to fix it. > > > > Thanks for your help! > > > > -Rahul > > > > /Meet AdIQuity at:/ > > *Ad:Tech, Singapore *on 13th-14th June 2013 > > > > /The information contained in this communication is intended solely for > > the use of the individual or entity to whom it is addressed and others > > authorized to receive it. This communication may contain confidential or > > legally privileged information. If you are not the intended recipient, > > any disclosure, copying, distribution or action taken relying on the > > contents is prohibited and may be unlawful. If you have received this > > communication in error, or if you or your employer does not consent to > > email messages of this kind, please notify to sender immediately by > > responding to this email and then delete it from your system. No > > liability is accepted for any harm that may be caused to your systems or > > data by this message./ > > > > > > > > - > > 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 > > -- *Meet AdIQuity at:* *Ad:Tech, Singapore *on 13th-14th June 2013 *The information contained in this communication is intended solely for the use of the individual or entity to whom it is addressed and others authorized to receive it. This communication may contain confidential or legally privileged information. If you are not the intended recipient, any disclosure, copying, distribution or action taken relying on the contents is prohibited and may be unlawful. If you have received this communication in error, or if you or your employer does not consent to email messages of this kind, please notify to sender immediately by responding to this email and then delete it from your system. No liability is accepted for any harm that may be caused to your systems or data by this message.*
TomCat Request Processing
I am curious to know how Tomcat's connectors handle the request processing internally, especially between the Http11Protocol which i believe acts as a connector and with every connector there may be a request processor which is the Http11Processor. I think there is a pool of Http11Processor classes created by the connector, was wondering how the interaction between Http11Protocol and Http11Processor flows when a request comes in at the connector. Thank You
Re: Port still busy after removing connector in Embedded Tomcat 7.0.30
> You need to destroy the connector to close the port. Mark, That seems to work. :) Now the port is free. But is it the right approach? Is this something we need to do in Tomcat 7 specifically? Thanks. From: Mark Thomas To: Tomcat Users List Sent: Tuesday, 14 May 2013 2:41 AM Subject: Re: Port still busy after removing connector in Embedded Tomcat 7.0.30 On 13/05/2013 16:34, Chirag Dewan wrote: > Hi, > > I am embedding Apache Tomcat 7.0.30 in my application. I am using the Tomcat > class,and my application requires dynamic addition and removal of > connectors(HTTP). > > Now while removing the connectors,the application gets undeployed but the > port remains occupied and the connector continue to listen on the port. I am > using customized HTTP connector. > > > Here is a snippet from my source code: > > for removing connector: > > if( connector != null ) > { > connector.decUsage(); > if( connector.getUsage() == 0 ) > { > connector.stop(); > this.tomcat.getService().removeConnector( connector ); > } > } > > for adding connector: > > this.tomcat.getService().addConnector( connector ); > > > I know the port is not getting free. Because when I try to deploy to the same > port again,it gives me an address already in use exception. > I have surfed for this issue a lot,but to no avail. Any help would be greatly > appreciated. You need to destroy the connector to close the port. Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Port still busy after removing connector in Embedded Tomcat 7.0.30
> From: Caldarale, Charles R > Subject: RE: Port still busy after removing connector in Embedded Tomcat > 7.0.30 > > How long are you waiting? Can you give us the specifics of your > > connector configuration? I wonder if the connector is remaining open > > for something like a keepalive timeout (I don't know if it *should* > > stay open for a keepalive timeout, but it seems plausible). > It would be interesting to see the actual netstat report here; I wonder > if the socket is in a FIN_WAIT or CLOSE_WAIT state. But that probably shouldn't happen for a ServerSocket. Does forcing a GC "fix" the problem? - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Port still busy after removing connector in Embedded Tomcat 7.0.30
On 13/05/2013 16:34, Chirag Dewan wrote: > Hi, > > I am embedding Apache Tomcat 7.0.30 in my application. I am using the Tomcat > class,and my application requires dynamic addition and removal of > connectors(HTTP). > > Now while removing the connectors,the application gets undeployed but the > port remains occupied and the connector continue to listen on the port. I am > using customized HTTP connector. > > > Here is a snippet from my source code: > > for removing connector: > > if( connector != null ) > { > connector.decUsage(); > if( connector.getUsage() == 0 ) > { > connector.stop(); > this.tomcat.getService().removeConnector( connector ); > } > } > > for adding connector: > > this.tomcat.getService().addConnector( connector ); > > > I know the port is not getting free. Because when I try to deploy to the same > port again,it gives me an address already in use exception. > I have surfed for this issue a lot,but to no avail. Any help would be greatly > appreciated. You need to destroy the connector to close the port. Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Port still busy after removing connector in Embedded Tomcat 7.0.30
> From: Christopher Schultz [mailto:ch...@christopherschultz.net] > Subject: Re: Port still busy after removing connector in Embedded Tomcat > 7.0.30 > > If I am calling the removeConnector, shouldn't it cleanup the > > context and the free the port? > In theory, yes, but ... > How long are you waiting? Can you give us the specifics of your > connector configuration? I wonder if the connector is remaining open > for something like a keepalive timeout (I don't know if it *should* > stay open for a keepalive timeout, but it seems plausible). It would be interesting to see the actual netstat report here; I wonder if the socket is in a FIN_WAIT or CLOSE_WAIT state. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Port still busy after removing connector in Embedded Tomcat 7.0.30
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Chirag, On 5/13/13 1:03 PM, Chirag Dewan wrote: >> If the context was removed, but the Connector was still there, >> should you not get a 404 Not Found, rather than a timeout ? > > > If I am calling the removeConnector, shouldn't it cleanup the > context and the free the port? In theory, yes, but ... How long are you waiting? Can you give us the specifics of your connector configuration? I wonder if the connector is remaining open for something like a keepalive timeout (I don't know if it *should* stay open for a keepalive timeout, but it seems plausible). > I mean is my context blocking the connector even after I removed > it? i should get a 404. Yes. But you aren't getting a 404: you are getting a request timeout which seems a bit odd. Perhaps the connector is partially shut-down, but not completely. How about that stack trace? > Sorry I forget to mention,it worked fine with Tomcat 6 Embedded > version. I am trying to upgrade it to Tomcat 7.0.30 and I am > following the same process as in Tomcat 6. Tomcat 7 is different than Tomcat 6... did you read the embedded documentation to see if anything changed? In general, connector states should be the same, but changing major versions is likely to require you to change your embedded code somewhat. Tomcat's unit tests (available in the source distribution of Tomcat) extensively use embedded techniques and are a good source of information for how to properly use Tomcat in an embedded way. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIcBAEBCAAGBQJRkVPqAAoJEBzwKT+lPKRY8UEQALqicEQax+K9xYGb3XdzvOgE a5emxV6fHog9ZSUqHVDnxtSIaxOQ3uUjHiwmc2gtTAnn5NiTN3IES+3YkHLnI6Vl La0fdpNOshuqhz37DAAY9/nPI4fgWOwAMBuAHCrl53BerbHTGaKHUwF0e42/otIa jWxQlVTXD2V06WyuoF9CJupKbcENGrTS7dsDegqmRzbbrGjLHc1Ot/l+AK8uEdjw cjWcI9Od9BkLKMkD+C0aHfT8s5fdUWr3f62K13T8uBrmNbghvK1NKsntpA84VqSy EUuNUcIbJglgLGz+XOc2UlTKZs01y2tRIwoPZQiv3ap15lf1El5KuB3b+NMzj4UT al9fK2sITcQW/6AAdoafChpttW65OvM6kwl3nTZBhOimkW/hw8Qrf7rFh1uUvpY7 Q7rhiCYiyEtVaBPKxPkY4D3272F4OHviZev1ltYyfHHHgFs1+DricOmEhVDF/hd2 6W6FRaxNpdSbS4U2bW9JziISb+5hKH+GyJkSJRJGHagQOXwfNRm89PhKA2mfE3XP Ihtv7eIRBiw6jCWvCYbeXFW5Fvx75AtU1xMlFs2c5HLsryV1h4PCZRtvf/LXYs5G Nl/osLQius4IpHkEdc88CVByYtRlEB8PereQZe/zKXSZt61ahYGQjDf4rDhAt1qa y2eqzNhJ97OrYMz+KPW/ =feVR -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Async Context not timing out
On 13/05/2013 18:01, Rahul Kumar wrote: > Hi All, > > I need some help with the async context timeout in servlet 3.0 running > on tomcat 7.0.40. > > I have set the asynccontext timeout value, but the timeout behaviour is > highly inconsistent. Sometimes the timeouts work, but most of the times > they don't. I am attaching the source code and the output in plain text > format. > > I have tried this on Tomcat 7.0.20, 7.0.37, 7.0.40. Nothing seems to help. Am > i doing something wrong? Yes and no. You are making assumptions about how frequently timeouts are checked. Tomcat only checks them every second for APR/native and BIO. NIO always checks every second by default and may check more frequently when under low load. Mark > > Please help. Apologize if I am wasting your time! But I need to fix it. > > Thanks for your help! > > -Rahul > > /Meet AdIQuity at:/ > *Ad:Tech, Singapore *on 13th-14th June 2013 > > /The information contained in this communication is intended solely for > the use of the individual or entity to whom it is addressed and others > authorized to receive it. This communication may contain confidential or > legally privileged information. If you are not the intended recipient, > any disclosure, copying, distribution or action taken relying on the > contents is prohibited and may be unlawful. If you have received this > communication in error, or if you or your employer does not consent to > email messages of this kind, please notify to sender immediately by > responding to this email and then delete it from your system. No > liability is accepted for any harm that may be caused to your systems or > data by this message./ > > > > - > 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: Delayed WAR expansion, timeout on context startup?
> From: Stefan Mayr [mailto:ste...@mayr-stefan.de] > Subject: Delayed WAR expansion, timeout on context startup? > Are there any parameters to adjust deployment timeouts for these > contexts with large WAR files? Want to give us a hint about what Tomcat version, JVM level, and platform you're running on? It's rather difficult to answer _any_ question without the basics. In the meantime, look here: http://wiki.apache.org/tomcat/HowTo/FasterStartUp - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Delayed WAR expansion, timeout on context startup?
Hi, we've upgraded our linux systems and experience some serious slowdowns from our antivirus solutions. Expanding large WAR files (e.g. Alfresco) is blocked by the virus scanner for minutes (!). Now we get tomcats failing to deploy contexts on startup. Everything was fine when the deployment/WAR expansion is/was faster (av off or just older linux plattform). Are there any parameters to adjust deployment timeouts for these contexts with large WAR files? I know we need to get the av scanner fixed. But at the moment we just need a temporary workaround for the longer expansions times. Thanks, Stefan - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Port still busy after removing connector in Embedded Tomcat 7.0.30
> If the context was removed, but the Connector was still there, should you not > get a 404 Not Found, rather than a timeout ? If I am calling the removeConnector,shouldn't it cleanup the context and the free the port? I mean is my context blocking the connector even after I removed it? i should get a 404. Yes. Sorry I forget to mention,it worked fine with Tomcat 6 Embedded version. I am trying to upgrade it to Tomcat 7.0.30 and I am following the same process as in Tomcat 6. Thanks From: André Warnier To: Tomcat Users List Sent: Monday, 13 May 2013 10:13 PM Subject: Re: Port still busy after removing connector in Embedded Tomcat 7.0.30 Chirag Dewan wrote: >> How do you observe that the connector is still bound to the port? > > Yes. I used netstat to observe that. Plus when I try to add another context > to the same port,I get "Address already in use" exception. > >> What does it show? > > I can see my java process running on that port. > >> What happens if you make a request? > > As I said,I am sure that the deployed context is removed. I get a timeout on >a request. If the context was removed, but the Connector was still there, should you not get a 404 Not Found, rather than a timeout ? > > When I start my Tomcat Server(tomcat.start()),I understand it adds a default > connector to the service on port 8080,so after adding my connector on port > 1090,i can see my java process listening on port 1090 and 8080. > > I really dont understand what wrong I might be doing. > > > Thanks > > > > > > > > > From: Christopher Schultz > To: Tomcat Users List > Sent: Monday, 13 May 2013 9:47 PM > Subject: Re: Port still busy after removing connector in Embedded Tomcat > 7.0.30 > > > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA256 > > Chirag, > > On 5/13/13 11:34 AM, Chirag Dewan wrote: >> I am embedding Apache Tomcat 7.0.30 in my application. I am using >> the Tomcat class,and my application requires dynamic addition and >> removal of connectors(HTTP). >> >> Now while removing the connectors,the application gets undeployed >> but the port remains occupied and the connector continue to listen >> on the port. I am using customized HTTP connector. >> >> >> Here is a snippet from my source code: >> >> for removing connector: >> >> if( connector != null ) { connector.decUsage(); if( >> connector.getUsage() == 0 ) { connector.stop(); >> this.tomcat.getService().removeConnector( connector ); } } >> >> for adding connector: >> >> this.tomcat.getService().addConnector( connector ); >> >> >> I know the port is not getting free. Because when I try to deploy >> to the same port again,it gives me an address already in use >> exception. I have surfed for this issue a lot,but to no avail. Any >> help would be greatly appreciated. > > Can you take a thread dump and find which code look like it's doing > connection-related things? > > How do you observe that the connector is still bound to the port? > netstat? What does it show? What happens if you make a request? > > - -chris > -BEGIN PGP SIGNATURE- > Version: GnuPG/MacGPG2 v2.0.17 (Darwin) > Comment: GPGTools - http://gpgtools.org > Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ > > iQIcBAEBCAAGBQJRkRIbAAoJEBzwKT+lPKRYH4kP/2WiZK75ifzqSXojAw1ckw6k > iH5NvnWNNFeibFvqtj0tN2Nun+mb3atqs4ySwQahN/FAtz8klhdfGLTlccMxzh4u > x1yvMKLEh1Xr3qTxeot/y98zER/gubdgNsM4lr5MkkFVtaprK7/emz1OCwcuZe0L > XApJRuSNF+GxtH9lSKEw4Tn4kzc5Asv2gMQOQmLAmBi3fKI9MsoRS9V5TPU88dhL > XBk+rkcUdvL2KWKbP9yrt2Geu9NqBzqADCA4FJUESS9sm8A/VECzyUZ+4uW/jqiP > qpn4GSAtpaH9CyHzynZF5qyA8Fx+BllhyIFwZfUl5DMqk+t4gw3LdPay8Rkpfg7G > fdLHXrLez/Pcj2nvOp60OLeC4DD13AJON9KyYXmnUuk29aV/lrOes9nmUbIVDh8k > 2LXh9cYErtD55bCgmTLPT0bLBpC9v1aUGEjFzeLjfJX9hEkvpUrN5OWvKHYg5Vaw > 2qc+bV31qitjrUfZYU58S5UX1txATx6Ig76y/pt49XfiQFc6/GG25Ju5UCJOpat0 > mOV4qTck+Exy+YuGvME7V/IcLAbymm9vGIB4bQD9dLq36Kx0cL5lE/DOYANd2PJD > 0nBO/co4uRvKW54NDnHVzzpAU7IUXBoQ+SmU4IQMv1+TP6auHO8ekwDW7+59ZgCc > Ev3xtRom84ly50SQcxKf > =zDpF > -END PGP SIGNATURE- > > - > 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: Internal Servlet Error
Yeah, it's clear from what's typed below his DB driver is way out of whack with this ancient version of Tomcat. It probably got updated along the way by network sorts while the Tomcat version stayed put. Go to current, and with current Tomcat, also get a current JDK - I imagine the one you have is ancient as well. -Original Message- From: Christopher Schultz [mailto:ch...@christopherschultz.net] Sent: Monday, May 13, 2013 11:16 AM To: Tomcat Users List Subject: Re: Internal Servlet Error -BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Jeny, On 5/13/13 2:52 AM, Jeny V wrote: > I'm having some real issues , running programs in Tomcat on my > machine. > > I just copied a jakarta folder named "jakarta-tomcat-3.3.1a" on to my > D: drive (Path : D:\Program Files\jakarta-tomcat-3.3.1a) . I'm going to go ahead and echo the few responses you're already gotten so far and tell you that you really need to discard that version of Tomcat. I don't care if you have an application that "works" on it (obviously in some other environment) and are afraid to upgrade. That version is so old, we don't even have the documentation online anymore for how many unfixed security vulnerabilities may or may not be present in that version. The Java Servlet Specification is nominally backward-compatible, so you should be able to download the latest version of Tomcat, configure it properly, and run your webapp without too many problems. > I can run simple jsp programs with no database connection. But > whenever I try to execute programs with database connections, > following error encounters: > > Error: 500 > > > Internal Servlet Error: > > javax.servlet.ServletException: [Microsoft][ODBC Driver Manager] The > specified DSN contains an architecture mismatch between the Driver and > Application at [...] The error is obvious from this message, but if you don't recognize the important words ("architecture mismatch") then you could be lost. The problem is that you are using a 32-bit ODBC driver on a 64-bit JVM (or maybe a 64-bit ODBC driver on a 32-bit JVM: you didn't specify what kind of JVM you were using, though I suspect you have a 64-bit JVM and a hideously old driver that you've been lugging-around with your Tomcat 3 install). You need to take one of the following actions: 1. Install a 32-bit JVM and use that. This will solve the architecture mismatch by switching the JVM. This may have an impact on your webapp (mostly a smaller maximum heap size) so you may not want to do this. 2. Install a 32-bit version of your ODBC driver and use that. This will solve the architecture mismatch by switching the driver. You may not be able to find a compatible 64-bit driver so you may not be able to do this. 3. Discard your ODBC driver entirely and use a pure-Java JDBC driver. Pretty much every database has one of these things available one way or another. This avoids the architecture mismatch entirely and it will likely result in better performance and stability of your web application. I highly recommend that you take this course of action. What database are you using? > Please do reply or help me with this problem as I tried so many times > to fix the problem by trying various solutions. In the future, it would be best to let everyone know what solutions you have tried and what the results were (other than just "it didn't work"). - -chris -BEGIN PGP SIGNATURE- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIcBAEBCAAGBQJRkRG6AAoJEBzwKT+lPKRYaaoQAJyFeYHGRmZomqFan7W2jdHv u7TZwFKlLAfkMfJaQQibprnuLZpW4flC5gdM0Rbj14EtfDauEMCSfe++oo6YlvqQ F0Mih9ReRt7wSxVLNG58hUqcM6Hg3evEtwWoq9yd5I9YHYdl8Cz0X035/tdUHOUz 2RKBqQbFKr3A8m1k6Q6IYjsRKvPFDwyu0ekRYMrvSdtFZkiYPvzzwW1FpXdQ0Rwh mHmVPrZzoIjiVXLWzT+kfFfrdrK6yBopieYZvOufEei88ZRvaI6u5LrXEpN6GEhX DNkFoDWjPYXuKdQS+JBdwFX16DIKl7nIqI5nZ2sZthjPVqK64+r26R5tp+WEX5rp ADkKyb6iGnwpAxy6l4LBGdanpDug0hC2beeOUtmcQkujJoychlvvF5L69VGpeEU1 JSQR0bQJGJIF9rP/PyAjBLzAUSI9sqh8IUZ+Bm+JrpAgiAWNSmKzeCW2te5r/GcF Nt5ZpKBqMC2UHPNMRxKjIfuGc0gTApX467tVQ5zaouNbWO/lSOMrhZCgF8SD/OcF fiQGrfeCDirHKIR6sczu3r07fGShTNCA47svAFV3/K31ou5dZT6SM3IvVqo2ZXog whHWIXLxGl9SZrJToAJYcjlR2nRSb/yKygiE9Z2csgt34fUj9vQmWFo93ueph+j1 p8A0RhUfe4Kx6KzJ5lmP =LZlk -END PGP SIGNATURE- - 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
Async Context not timing out
Hi All, I need some help with the async context timeout in servlet 3.0 running on tomcat 7.0.40. I have set the asynccontext timeout value, but the timeout behaviour is highly inconsistent. Sometimes the timeouts work, but most of the times they don't. I am attaching the source code and the output in plain text format. I have tried this on Tomcat 7.0.20, 7.0.37, 7.0.40. Nothing seems to help. Am i doing something wrong? Please help. Apologize if I am wasting your time! But I need to fix it. Thanks for your help! -Rahul -- *Meet AdIQuity at:* *Ad:Tech, Singapore *on 13th-14th June 2013 *The information contained in this communication is intended solely for the use of the individual or entity to whom it is addressed and others authorized to receive it. This communication may contain confidential or legally privileged information. If you are not the intended recipient, any disclosure, copying, distribution or action taken relying on the contents is prohibited and may be unlawful. If you have received this communication in error, or if you or your employer does not consent to email messages of this kind, please notify to sender immediately by responding to this email and then delete it from your system. No liability is accepted for any harm that may be caused to your systems or data by this message.* @WebServlet(name = "TestServlet", urlPatterns = {"/test"},asyncSupported = true) public class TestServlet extends HttpServlet{ private static final long serialVersionUID = 1L; private static PriorityBlockingQueue pq = new PriorityBlockingQueue(1000); private static ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(1,1,10, TimeUnit.SECONDS,pq); public void service(final ServletRequest servletRequest, final ServletResponse response) throws ServletException, IOException { TestListener listener = new TestListener(); final AsyncContext asyncContext = servletRequest.startAsync(servletRequest, response); asyncContext.addListener(listener); asyncContext.setTimeout(100); Handler handler = new Handler(asyncContext); threadPoolExecutor.execute(handler); } } ### Handler class### public class Handler implements Runnable { private AsyncContext asyncContext; public Handler(AsyncContext asyncContext){ this.asyncContext = asyncContext; } public void run(){ try { long currtime = System.currentTimeMillis(); Thread.sleep(500); System.out.println("slept for " + (System.currentTimeMillis() - currtime)); } catch (InterruptedException e) { System.out.println("Error in thread "); } try{ if(asyncContext != null){ System.out.println("Completing async context " + " timeout is " + asyncContext.getTimeout()); asyncContext.complete(); } }catch (Exception e){ System.out.println("Exception in completing async context "); } } } Listener class public class TestListener implements AsyncListener { public void onComplete(AsyncEvent event) throws IOException { System.out.println("Event completed"); } public void onError(AsyncEvent event) throws IOException { event.getAsyncContext().complete(); } public void onStartAsync(AsyncEvent event) throws IOException { // TODO Auto-generated method stub } public void onTimeout(AsyncEvent event){ System.out.println("Timeout "); event.getAsyncContext().complete(); } } Execution [ops@root combinedlogs]$ time curl "http://localhost:9001/mockresponse/test"; real0m0.506s user0m0.001s sys 0m0.003s [ops@root combinedlogs]$ time curl "http://localhost:9001/mockresponse/test"; real0m0.159s user0m0.001s sys 0m0.003s Catalina logs slept for 500 Completing async context timeout is 100 Event completed Timeout Event completed slept for 500 Exception in completing async context - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Port still busy after removing connector in Embedded Tomcat 7.0.30
Chirag Dewan wrote: How do you observe that the connector is still bound to the port? Yes. I used netstat to observe that. Plus when I try to add another context to the same port,I get "Address already in use" exception. What does it show? I can see my java process running on that port. What happens if you make a request? As I said,I am sure that the deployed context is removed. I get a timeout on a request. If the context was removed, but the Connector was still there, should you not get a 404 Not Found, rather than a timeout ? When I start my Tomcat Server(tomcat.start()),I understand it adds a default connector to the service on port 8080,so after adding my connector on port 1090,i can see my java process listening on port 1090 and 8080. I really dont understand what wrong I might be doing. Thanks From: Christopher Schultz To: Tomcat Users List Sent: Monday, 13 May 2013 9:47 PM Subject: Re: Port still busy after removing connector in Embedded Tomcat 7.0.30 -BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Chirag, On 5/13/13 11:34 AM, Chirag Dewan wrote: I am embedding Apache Tomcat 7.0.30 in my application. I am using the Tomcat class,and my application requires dynamic addition and removal of connectors(HTTP). Now while removing the connectors,the application gets undeployed but the port remains occupied and the connector continue to listen on the port. I am using customized HTTP connector. Here is a snippet from my source code: for removing connector: if( connector != null ) { connector.decUsage(); if( connector.getUsage() == 0 ) { connector.stop(); this.tomcat.getService().removeConnector( connector ); } } for adding connector: this.tomcat.getService().addConnector( connector ); I know the port is not getting free. Because when I try to deploy to the same port again,it gives me an address already in use exception. I have surfed for this issue a lot,but to no avail. Any help would be greatly appreciated. Can you take a thread dump and find which code look like it's doing connection-related things? How do you observe that the connector is still bound to the port? netstat? What does it show? What happens if you make a request? - -chris -BEGIN PGP SIGNATURE- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIcBAEBCAAGBQJRkRIbAAoJEBzwKT+lPKRYH4kP/2WiZK75ifzqSXojAw1ckw6k iH5NvnWNNFeibFvqtj0tN2Nun+mb3atqs4ySwQahN/FAtz8klhdfGLTlccMxzh4u x1yvMKLEh1Xr3qTxeot/y98zER/gubdgNsM4lr5MkkFVtaprK7/emz1OCwcuZe0L XApJRuSNF+GxtH9lSKEw4Tn4kzc5Asv2gMQOQmLAmBi3fKI9MsoRS9V5TPU88dhL XBk+rkcUdvL2KWKbP9yrt2Geu9NqBzqADCA4FJUESS9sm8A/VECzyUZ+4uW/jqiP qpn4GSAtpaH9CyHzynZF5qyA8Fx+BllhyIFwZfUl5DMqk+t4gw3LdPay8Rkpfg7G fdLHXrLez/Pcj2nvOp60OLeC4DD13AJON9KyYXmnUuk29aV/lrOes9nmUbIVDh8k 2LXh9cYErtD55bCgmTLPT0bLBpC9v1aUGEjFzeLjfJX9hEkvpUrN5OWvKHYg5Vaw 2qc+bV31qitjrUfZYU58S5UX1txATx6Ig76y/pt49XfiQFc6/GG25Ju5UCJOpat0 mOV4qTck+Exy+YuGvME7V/IcLAbymm9vGIB4bQD9dLq36Kx0cL5lE/DOYANd2PJD 0nBO/co4uRvKW54NDnHVzzpAU7IUXBoQ+SmU4IQMv1+TP6auHO8ekwDW7+59ZgCc Ev3xtRom84ly50SQcxKf =zDpF -END PGP SIGNATURE- - 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: Port still busy after removing connector in Embedded Tomcat 7.0.30
>How do you observe that the connector is still bound to the port? Yes. I used netstat to observe that. Plus when I try to add another context to the same port,I get "Address already in use" exception. > What does it show? I can see my java process running on that port. >What happens if you make a request? As I said,I am sure that the deployed context is removed. I get a timeout on a request. When I start my Tomcat Server(tomcat.start()),I understand it adds a default connector to the service on port 8080,so after adding my connector on port 1090,i can see my java process listening on port 1090 and 8080. I really dont understand what wrong I might be doing. Thanks From: Christopher Schultz To: Tomcat Users List Sent: Monday, 13 May 2013 9:47 PM Subject: Re: Port still busy after removing connector in Embedded Tomcat 7.0.30 -BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Chirag, On 5/13/13 11:34 AM, Chirag Dewan wrote: > I am embedding Apache Tomcat 7.0.30 in my application. I am using > the Tomcat class,and my application requires dynamic addition and > removal of connectors(HTTP). > > Now while removing the connectors,the application gets undeployed > but the port remains occupied and the connector continue to listen > on the port. I am using customized HTTP connector. > > > Here is a snippet from my source code: > > for removing connector: > > if( connector != null ) { connector.decUsage(); if( > connector.getUsage() == 0 ) { connector.stop(); > this.tomcat.getService().removeConnector( connector ); } } > > for adding connector: > > this.tomcat.getService().addConnector( connector ); > > > I know the port is not getting free. Because when I try to deploy > to the same port again,it gives me an address already in use > exception. I have surfed for this issue a lot,but to no avail. Any > help would be greatly appreciated. Can you take a thread dump and find which code look like it's doing connection-related things? How do you observe that the connector is still bound to the port? netstat? What does it show? What happens if you make a request? - -chris -BEGIN PGP SIGNATURE- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIcBAEBCAAGBQJRkRIbAAoJEBzwKT+lPKRYH4kP/2WiZK75ifzqSXojAw1ckw6k iH5NvnWNNFeibFvqtj0tN2Nun+mb3atqs4ySwQahN/FAtz8klhdfGLTlccMxzh4u x1yvMKLEh1Xr3qTxeot/y98zER/gubdgNsM4lr5MkkFVtaprK7/emz1OCwcuZe0L XApJRuSNF+GxtH9lSKEw4Tn4kzc5Asv2gMQOQmLAmBi3fKI9MsoRS9V5TPU88dhL XBk+rkcUdvL2KWKbP9yrt2Geu9NqBzqADCA4FJUESS9sm8A/VECzyUZ+4uW/jqiP qpn4GSAtpaH9CyHzynZF5qyA8Fx+BllhyIFwZfUl5DMqk+t4gw3LdPay8Rkpfg7G fdLHXrLez/Pcj2nvOp60OLeC4DD13AJON9KyYXmnUuk29aV/lrOes9nmUbIVDh8k 2LXh9cYErtD55bCgmTLPT0bLBpC9v1aUGEjFzeLjfJX9hEkvpUrN5OWvKHYg5Vaw 2qc+bV31qitjrUfZYU58S5UX1txATx6Ig76y/pt49XfiQFc6/GG25Ju5UCJOpat0 mOV4qTck+Exy+YuGvME7V/IcLAbymm9vGIB4bQD9dLq36Kx0cL5lE/DOYANd2PJD 0nBO/co4uRvKW54NDnHVzzpAU7IUXBoQ+SmU4IQMv1+TP6auHO8ekwDW7+59ZgCc Ev3xtRom84ly50SQcxKf =zDpF -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Port still busy after removing connector in Embedded Tomcat 7.0.30
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Chirag, On 5/13/13 11:34 AM, Chirag Dewan wrote: > I am embedding Apache Tomcat 7.0.30 in my application. I am using > the Tomcat class,and my application requires dynamic addition and > removal of connectors(HTTP). > > Now while removing the connectors,the application gets undeployed > but the port remains occupied and the connector continue to listen > on the port. I am using customized HTTP connector. > > > Here is a snippet from my source code: > > for removing connector: > > if( connector != null ) { connector.decUsage(); if( > connector.getUsage() == 0 ) { connector.stop(); > this.tomcat.getService().removeConnector( connector ); } } > > for adding connector: > > this.tomcat.getService().addConnector( connector ); > > > I know the port is not getting free. Because when I try to deploy > to the same port again,it gives me an address already in use > exception. I have surfed for this issue a lot,but to no avail. Any > help would be greatly appreciated. Can you take a thread dump and find which code look like it's doing connection-related things? How do you observe that the connector is still bound to the port? netstat? What does it show? What happens if you make a request? - -chris -BEGIN PGP SIGNATURE- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIcBAEBCAAGBQJRkRIbAAoJEBzwKT+lPKRYH4kP/2WiZK75ifzqSXojAw1ckw6k iH5NvnWNNFeibFvqtj0tN2Nun+mb3atqs4ySwQahN/FAtz8klhdfGLTlccMxzh4u x1yvMKLEh1Xr3qTxeot/y98zER/gubdgNsM4lr5MkkFVtaprK7/emz1OCwcuZe0L XApJRuSNF+GxtH9lSKEw4Tn4kzc5Asv2gMQOQmLAmBi3fKI9MsoRS9V5TPU88dhL XBk+rkcUdvL2KWKbP9yrt2Geu9NqBzqADCA4FJUESS9sm8A/VECzyUZ+4uW/jqiP qpn4GSAtpaH9CyHzynZF5qyA8Fx+BllhyIFwZfUl5DMqk+t4gw3LdPay8Rkpfg7G fdLHXrLez/Pcj2nvOp60OLeC4DD13AJON9KyYXmnUuk29aV/lrOes9nmUbIVDh8k 2LXh9cYErtD55bCgmTLPT0bLBpC9v1aUGEjFzeLjfJX9hEkvpUrN5OWvKHYg5Vaw 2qc+bV31qitjrUfZYU58S5UX1txATx6Ig76y/pt49XfiQFc6/GG25Ju5UCJOpat0 mOV4qTck+Exy+YuGvME7V/IcLAbymm9vGIB4bQD9dLq36Kx0cL5lE/DOYANd2PJD 0nBO/co4uRvKW54NDnHVzzpAU7IUXBoQ+SmU4IQMv1+TP6auHO8ekwDW7+59ZgCc Ev3xtRom84ly50SQcxKf =zDpF -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Internal Servlet Error
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Jeny, On 5/13/13 2:52 AM, Jeny V wrote: > I'm having some real issues , running programs in Tomcat on my > machine. > > I just copied a jakarta folder named "jakarta-tomcat-3.3.1a" on to > my D: drive (Path : D:\Program Files\jakarta-tomcat-3.3.1a) . I'm going to go ahead and echo the few responses you're already gotten so far and tell you that you really need to discard that version of Tomcat. I don't care if you have an application that "works" on it (obviously in some other environment) and are afraid to upgrade. That version is so old, we don't even have the documentation online anymore for how many unfixed security vulnerabilities may or may not be present in that version. The Java Servlet Specification is nominally backward-compatible, so you should be able to download the latest version of Tomcat, configure it properly, and run your webapp without too many problems. > I can run simple jsp programs with no database connection. But > whenever I try to execute programs with database connections, > following error encounters: > > Error: 500 > > > Internal Servlet Error: > > javax.servlet.ServletException: [Microsoft][ODBC Driver Manager] > The specified DSN contains an architecture mismatch between the > Driver and Application at [...] The error is obvious from this message, but if you don't recognize the important words ("architecture mismatch") then you could be lost. The problem is that you are using a 32-bit ODBC driver on a 64-bit JVM (or maybe a 64-bit ODBC driver on a 32-bit JVM: you didn't specify what kind of JVM you were using, though I suspect you have a 64-bit JVM and a hideously old driver that you've been lugging-around with your Tomcat 3 install). You need to take one of the following actions: 1. Install a 32-bit JVM and use that. This will solve the architecture mismatch by switching the JVM. This may have an impact on your webapp (mostly a smaller maximum heap size) so you may not want to do this. 2. Install a 32-bit version of your ODBC driver and use that. This will solve the architecture mismatch by switching the driver. You may not be able to find a compatible 64-bit driver so you may not be able to do this. 3. Discard your ODBC driver entirely and use a pure-Java JDBC driver. Pretty much every database has one of these things available one way or another. This avoids the architecture mismatch entirely and it will likely result in better performance and stability of your web application. I highly recommend that you take this course of action. What database are you using? > Please do reply or help me with this problem as I tried so many > times to fix the problem by trying various solutions. In the future, it would be best to let everyone know what solutions you have tried and what the results were (other than just "it didn't work"). - -chris -BEGIN PGP SIGNATURE- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIcBAEBCAAGBQJRkRG6AAoJEBzwKT+lPKRYaaoQAJyFeYHGRmZomqFan7W2jdHv u7TZwFKlLAfkMfJaQQibprnuLZpW4flC5gdM0Rbj14EtfDauEMCSfe++oo6YlvqQ F0Mih9ReRt7wSxVLNG58hUqcM6Hg3evEtwWoq9yd5I9YHYdl8Cz0X035/tdUHOUz 2RKBqQbFKr3A8m1k6Q6IYjsRKvPFDwyu0ekRYMrvSdtFZkiYPvzzwW1FpXdQ0Rwh mHmVPrZzoIjiVXLWzT+kfFfrdrK6yBopieYZvOufEei88ZRvaI6u5LrXEpN6GEhX DNkFoDWjPYXuKdQS+JBdwFX16DIKl7nIqI5nZ2sZthjPVqK64+r26R5tp+WEX5rp ADkKyb6iGnwpAxy6l4LBGdanpDug0hC2beeOUtmcQkujJoychlvvF5L69VGpeEU1 JSQR0bQJGJIF9rP/PyAjBLzAUSI9sqh8IUZ+Bm+JrpAgiAWNSmKzeCW2te5r/GcF Nt5ZpKBqMC2UHPNMRxKjIfuGc0gTApX467tVQ5zaouNbWO/lSOMrhZCgF8SD/OcF fiQGrfeCDirHKIR6sczu3r07fGShTNCA47svAFV3/K31ou5dZT6SM3IvVqo2ZXog whHWIXLxGl9SZrJToAJYcjlR2nRSb/yKygiE9Z2csgt34fUj9vQmWFo93ueph+j1 p8A0RhUfe4Kx6KzJ5lmP =LZlk -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Port still busy after removing connector in Embedded Tomcat 7.0.30
Hi, I am embedding Apache Tomcat 7.0.30 in my application. I am using the Tomcat class,and my application requires dynamic addition and removal of connectors(HTTP). Now while removing the connectors,the application gets undeployed but the port remains occupied and the connector continue to listen on the port. I am using customized HTTP connector. Here is a snippet from my source code: for removing connector: if( connector != null ) { connector.decUsage(); if( connector.getUsage() == 0 ) { connector.stop(); this.tomcat.getService().removeConnector( connector ); } } for adding connector: this.tomcat.getService().addConnector( connector ); I know the port is not getting free. Because when I try to deploy to the same port again,it gives me an address already in use exception. I have surfed for this issue a lot,but to no avail. Any help would be greatly appreciated. Thanks
Re: Internal Servlet Error
Jeny V wrote: Hi , I'm having some real issues , running programs in Tomcat on my machine. I just copied a jakarta folder named "jakarta-tomcat-3.3.1a" on to my D: drive (Path : D:\Program Files\jakarta-tomcat-3.3.1a) . Do you not read the answers you have already been given ? The current version of Tomcat is 7. See http://tomcat.apache.org. You are trying to use a Tomcat version 3, which is more than 10 years old. Nobody can help you with that version. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org