Re: Tomcat 8.0.32: Response already committed

2016-04-07 Thread Martin Holz (for Usenet)

A upgrade to Tomcat 8.0.33 did solve the issue.

Martin

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



Tomcat 8.0.32: Response already committed

2016-04-07 Thread Martin Holz (for Usenet)

Hello,
with Tomcat 8.0.32 (and 8.0.28) sometimes the response object is already 
committed, before the servlet or JSP page is doing anything.
I am moving a large legacy application from Tomcat 6 to Tomcat 8 and 
found, that JSP pages were sometimes returned to the browser without

any HTTP header or HTTP status line.
So I wrote a servlet filter for debugging:

public class JSPDebugFilter implements Filter {

public void doFilter(ServletRequest req, ServletResponse resp, 
FilterChain chain) throws IOException, ServletException {

HttpServletRequest httpReq = (HttpServletRequest) req;
HttpServletResponse httpResp = (HttpServletResponse) resp;
System.err.println("JSP Debug filter committed " + 
resp.isCommitted() + " " + httpReq.getRequestURI());


if (resp.isCommitted()) {
System.err.println(httpResp);
(new Throwable("")).printStackTrace();
}
chain.doFilter(req, resp);
}
  ...
}

It shows, that the response is already committed, when this error happens:

JSP Debug filter committed true /myapp/rsetup.jsp
org.apache.catalina.connector.ResponseFacade@a7c4e6b
java.lang.Throwable:
at 
simbiosys.chemplanner.servlet.JSPDebugFilter.doFilter(JSPDebugFilter.java:30)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)


The problem happens with both HTTP connector and AJP connector.  But if 
I switched from

Connector protocol="HTTP/1.1" to org.apache.coyote.http11.Http11Protocol  ,
it looked like the error was gone. Same for AJP.

But when we did a load test (unfortunately without the filter), 
something similar happened in rare cases (about 1 out of 1000):


06-Apr-2016 06:28:00.386 SEVERE [ajp-bio-9019-exec-68] 
org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() 
for servlet [suppliers] in context with path [/myapp] threw exception
 java.lang.IllegalStateException: Cannot create a session after the 
response has been committed
at 
org.apache.catalina.connector.Request.doGetSession(Request.java:2928)


The session is started at the beginning  of the method, before anything 
else is done.


Could the bug be caused by my application or is this a Tomcat bug? Where 
could I start debugging?


Thanks
Martin








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



Re: Response already committed

2006-10-05 Thread Greg Ward
On 03 October 2006, Dan Adams said:
 Hmm, I don't think that is the culprit. I think all of our stuff is
 thread safe. We're using a framework (Tapestry) which shields us from
 threading issues like that and prevents us from storing request stuff in
 the session. Also, if that were the case would that cause problems when
 loading static files? I don't think so.

We have occasionally seen response not committed errors with our
Tapestry-based app.  I suspect it's a subtle bug in our code that we
haven't tracked down yet.  You might ask on the Tapestry list for
advice.

 Also, we are using a filter which when it tries to do a redirect will
 throw an error complaining about this so this happens way before our app
 ever gets to do anything:

I don't understand that paragraph, but you might try disabling that
filter and seeing if the problem goes away (assuming you can reproduce
in non-production environment).

Greg

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Response already committed

2006-10-05 Thread David Smith
Another thought to consider:  a redirect does not stop processing on the 
current request.  If you call a redirect in a filter and don't return 
immediately, this condition can occur.


--David

Greg Ward wrote:


On 03 October 2006, Dan Adams said:
 


Hmm, I don't think that is the culprit. I think all of our stuff is
thread safe. We're using a framework (Tapestry) which shields us from
threading issues like that and prevents us from storing request stuff in
the session. Also, if that were the case would that cause problems when
loading static files? I don't think so.
   



We have occasionally seen response not committed errors with our
Tapestry-based app.  I suspect it's a subtle bug in our code that we
haven't tracked down yet.  You might ask on the Tapestry list for
advice.

 


Also, we are using a filter which when it tries to do a redirect will
throw an error complaining about this so this happens way before our app
ever gets to do anything:
   



I don't understand that paragraph, but you might try disabling that
filter and seeing if the problem goes away (assuming you can reproduce
in non-production environment).

   Greg

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

 




-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Response already committed

2006-10-03 Thread Dan Adams
I'm getting a problem that appears to occur randomly. If I request the
same page in my webapp over and over most of the time it will come up
fine but sometimes tomcat won't return anything and I'll get a blank
page and this error in the log:

Oct 3, 2006 4:20:22 PM org.apache.jk.core.MsgContext action
INFO: Response already committed

It also happens for static files like stylesheets so sometimes you will
request a page and then the styles won't get loaded. Anyone have any
clues as to what this could be? I'm googling around and looking through
my tomcat book but haven't found an answer yet. I'm using tomcat 5.5
with the mod_jk connector and apache 2. Here is my server.xml:

Server port=8005 shutdown=SHUTDOWN
  GlobalNamingResources
Environment name=simpleValue type=java.lang.Integer
value=30/
Resource name=UserDatabase auth=Container
  type=org.apache.catalina.UserDatabase
   description=User database that can be updated and saved
   factory=org.apache.catalina.users.MemoryUserDatabaseFactory
  pathname=conf/tomcat-users.xml /
  /GlobalNamingResources
  Service name=Catalina
Connector port=8080 /

!-- Define an AJP 1.3 Connector on port 8029 --
Connector port=8029
   enableLookups=false redirectPort=8443
protocol=AJP/1.3 /

!-- Define the top level container in our container hierarchy --
Engine name=Catalina defaultHost=localhost
  Realm className=org.apache.catalina.realm.UserDatabaseRealm
 resourceName=UserDatabase/
  Realm className=org.apache.catalina.realm.MemoryRealm /
  Host name=localhost appBase=webapps unpackWARs=true
autoDeploy=true /

  !-- Define the default virtual host
   Note: XML Schema validation will not work with Xerces 2.2.
   --

  Host name=domain.company.com appBase=hosts/domain debug=0
unpackWARs=true autoDeploy=false
Context path= docBase=. /
  /Host

/Engine

  /Service

/Server


-- 
Dan Adams
Senior Software Engineer
Interactive Factory
617.235.5857


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Response already committed

2006-10-03 Thread Caldarale, Charles R
 From: Dan Adams [mailto:[EMAIL PROTECTED] 
 Subject: Response already committed
 
 I'm getting a problem that appears to occur randomly. If I request the
 same page in my webapp over and over most of the time it will come up
 fine but sometimes tomcat won't return anything and I'll get a blank
 page and this error in the log:
 
 Oct 3, 2006 4:20:22 PM org.apache.jk.core.MsgContext action
 INFO: Response already committed

Any chance that the logic in your servlet is not thread-safe?
Repeatedly submitting requests could get more than one going at the same
time, causing improperly scoped variables to be overwritten.  For
example, is request-specific data being stored in the session?

 - 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 start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Response already committed

2006-10-03 Thread Dan Adams
Hmm, I don't think that is the culprit. I think all of our stuff is
thread safe. We're using a framework (Tapestry) which shields us from
threading issues like that and prevents us from storing request stuff in
the session. Also, if that were the case would that cause problems when
loading static files? I don't think so.

Also, we are using a filter which when it tries to do a redirect will
throw an error complaining about this so this happens way before our app
ever gets to do anything:

ERROR: response is comitted cannot forward (this is a very strange
problem!, check you haven't done anything to the response (ie, written
to it) before here


On Tue, 2006-10-03 at 15:39 -0500, Caldarale, Charles R wrote:
  From: Dan Adams [mailto:[EMAIL PROTECTED] 
  Subject: Response already committed
  
  I'm getting a problem that appears to occur randomly. If I request the
  same page in my webapp over and over most of the time it will come up
  fine but sometimes tomcat won't return anything and I'll get a blank
  page and this error in the log:
  
  Oct 3, 2006 4:20:22 PM org.apache.jk.core.MsgContext action
  INFO: Response already committed
 
 Any chance that the logic in your servlet is not thread-safe?
 Repeatedly submitting requests could get more than one going at the same
 time, causing improperly scoped variables to be overwritten.  For
 example, is request-specific data being stored in the session?
 
  - 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 start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
-- 
Dan Adams
Senior Software Engineer
Interactive Factory
617.235.5857


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Response already committed when redirecting from error page?

2006-03-02 Thread David C. Schweisguth

Hi all,

I'm using Apache 2.something, mod_jk and Tomcat 5.5.15. mod_jk sends all 
requests to Tomcat, so Tomcat needs to handle requests for nonexistent paths. 
Our application handles requests to more than one hostname, and the error 
response depends on the host to which the request was sent. OK, just one more 
wrinkle: one of the error responses should be a redirect.


That is, http://somehost.com/nosuchpath should return an error page served by 
Tomcat, but http://otherhost.com/nosuchpath should redirect to 
http://elsewhere.com/404.


Right now this is implemented thus:
- error-page in web.xml goes to /errorpage
- /errorpage is mapped to a servlet
- the servlet inspects the server name; if the server is somehost.com the 
servlet forwards to somehosterror.jsp; if the server is otherhost.com the 
servlet forwards to otherhosterror.jsp.

- The somehosterror.jsp part works fine, so enough about that.
- Right now otherhosterror.jsp does a jsp:import of http://elsewhere.com/404. 
This works, but (since it's not a redirect) the user still sees nosuchpath in 
their browser. I'd prefer to do a redirect in the servlet. But if I do that, 
although the redirect works, I get


Mar 2, 2006 2:15:47 PM org.apache.jk.core.MsgContext action
INFO: Response already committed

Same deal if otherhosterror.jsp does a c:redirect.

As far as I can tell nothing here should be writing much output, much less 
committing it. So, why does this happen, and is it a problem? I hate to deploy 
something that spews mysterious log messages, especially if they mean the 
something might not always work or there's a resource leak or whatever.


Thanks,

--
David C. Schweisguth, Senior Software Engineer
Healthline Networks, Inc., 660 Third Street, San Francisco, CA 94107
phone 415-281-3121 / fax 415-281-3199 / www.healthline.com

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



Re: Response already committed when redirecting from error page?

2006-03-02 Thread Bill Barker

David C. Schweisguth [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Hi all,

 I'm using Apache 2.something, mod_jk and Tomcat 5.5.15. mod_jk sends all 
 requests to Tomcat, so Tomcat needs to handle requests for nonexistent 
 paths. Our application handles requests to more than one hostname, and the 
 error response depends on the host to which the request was sent. OK, just 
 one more wrinkle: one of the error responses should be a redirect.

 That is, http://somehost.com/nosuchpath should return an error page served 
 by Tomcat, but http://otherhost.com/nosuchpath should redirect to 
 http://elsewhere.com/404.

 Right now this is implemented thus:
 - error-page in web.xml goes to /errorpage
 - /errorpage is mapped to a servlet
 - the servlet inspects the server name; if the server is somehost.com the 
 servlet forwards to somehosterror.jsp; if the server is otherhost.com the 
 servlet forwards to otherhosterror.jsp.
 - The somehosterror.jsp part works fine, so enough about that.
 - Right now otherhosterror.jsp does a jsp:import of 
 http://elsewhere.com/404. This works, but (since it's not a redirect) the 
 user still sees nosuchpath in their browser. I'd prefer to do a redirect 
 in the servlet. But if I do that, although the redirect works, I get

 Mar 2, 2006 2:15:47 PM org.apache.jk.core.MsgContext action
 INFO: Response already committed


That message really should be dropped to DEBUG level.  It's pretty much 
harmless.  For some reason, Tomcat thinks it should send the Headers twice, 
but it's smart enough to not actually do it.

 Same deal if otherhosterror.jsp does a c:redirect.

 As far as I can tell nothing here should be writing much output, much less 
 committing it. So, why does this happen, and is it a problem? I hate to 
 deploy something that spews mysterious log messages, especially if they 
 mean the something might not always work or there's a resource leak or 
 whatever.

 Thanks,

 -- 
 David C. Schweisguth, Senior Software Engineer
 Healthline Networks, Inc., 660 Third Street, San Francisco, CA 94107
 phone 415-281-3121 / fax 415-281-3199 / www.healthline.com 




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