|
Hello, I upgraded to Tomcat 7.0.6 and noticed another problem that did not exist in Tomcat 6: event CometEvent.EventType.END is not fired when client connection is closed. It is very easy to duplicate. The server and client code is below. You would need to open html page in a browser and press "TEST". This should print "Begin Event" in the server. If you close the browser (close connection), the "End Event" is not printed. It is printed with Tomcat 6. It is similar to bug https://issues.apache.org/bugzilla/show_bug.cgi?id=50207, that marked as fixed. Not sure if it is related or not. SERVER: package test; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import org.apache.catalina.comet.CometEvent; import org.apache.catalina.comet.CometProcessor; public class TomcatBug extends HttpServlet implements CometProcessor { public void event(CometEvent event) throws IOException, ServletException { if (event.getEventType() == CometEvent.EventType.BEGIN) { System.out.println("Begin Event"); } else if (event.getEventType() == CometEvent.EventType.ERROR) { System.out.println("Error Event"); event.close(); } else if (event.getEventType() == CometEvent.EventType.END) { System.out.println("End Event"); event.close(); } } } CLIENT (html): <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd"> <html> <head> <title>test</title> </head> <body> <input type="button" value="TEST" onclick="test(); return false;" /> <script type="text/javascript"> function test() { var api = new XMLHttpRequest; api.onreadystatechange = onreadystatechange; api.open("GET", "http://localhost/Test/Controller", true); api.send(""); } function onreadystatechange() { } </script> </body> </html> |
|
On 20/01/2011 22:40, ilya goberman wrote:
> > Hello, > I upgraded to Tomcat 7.0.6 and noticed another problem that did not exist in Tomcat 6: event CometEvent.EventType.END is not fired when client connection is closed. > It is very easy to duplicate. The server and client code is below. You would need to open html page in a browser and press "TEST". This should print "Begin Event" in the server. If you close the browser (close connection), the "End Event" is not printed. It is printed with Tomcat 6. Please create a bugzilla entry for this so it can be tracked. Cheers, Mark > > It is similar to bug https://issues.apache.org/bugzilla/show_bug.cgi?id=50207, that marked as fixed. Not sure if it is related or not. > > SERVER: > package test; > > import java.io.IOException; > > import javax.servlet.ServletException; > import javax.servlet.http.HttpServlet; > > import org.apache.catalina.comet.CometEvent; > import org.apache.catalina.comet.CometProcessor; > > public class TomcatBug extends HttpServlet implements CometProcessor { > > public void event(CometEvent event) throws IOException, ServletException { > if (event.getEventType() == CometEvent.EventType.BEGIN) { > System.out.println("Begin Event"); > } > else if (event.getEventType() == CometEvent.EventType.ERROR) { > System.out.println("Error Event"); > event.close(); > } > else if (event.getEventType() == CometEvent.EventType.END) { > System.out.println("End Event"); > event.close(); > } > } > } > > CLIENT (html): > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd"> > <html> > <head> > <title>test</title> > </head> > <body> > <input type="button" value="TEST" onclick="test(); return false;" /> > > <script type="text/javascript"> > function test() { > var api = new XMLHttpRequest; > api.onreadystatechange = onreadystatechange; > > api.open("GET", "http://localhost/Test/Controller", true); > > api.send(""); > } > > function onreadystatechange() { > } > > </script> > > </body> > </html> > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] |
|
done: https://issues.apache.org/bugzilla/show_bug.cgi?id=50627 > Date: Thu, 20 Jan 2011 22:42:35 +0000 > From: [hidden email] > To: [hidden email] > Subject: Re: Bug in Tomcat Comet. Event CometEvent.EventType.END is not fied when connection closed. > > On 20/01/2011 22:40, ilya goberman wrote: > > > > Hello, > > I upgraded to Tomcat 7.0.6 and noticed another problem that did not exist in Tomcat 6: event CometEvent.EventType.END is not fired when client connection is closed. > > It is very easy to duplicate. The server and client code is below. You would need to open html page in a browser and press "TEST". This should print "Begin Event" in the server. If you close the browser (close connection), the "End Event" is not printed. It is printed with Tomcat 6. > > Please create a bugzilla entry for this so it can be tracked. > > Cheers, > > Mark > > > > > It is similar to bug https://issues.apache.org/bugzilla/show_bug.cgi?id=50207, that marked as fixed. Not sure if it is related or not. > > > > SERVER: > > package test; > > > > import java.io.IOException; > > > > import javax.servlet.ServletException; > > import javax.servlet.http.HttpServlet; > > > > import org.apache.catalina.comet.CometEvent; > > import org.apache.catalina.comet.CometProcessor; > > > > public class TomcatBug extends HttpServlet implements CometProcessor { > > > > public void event(CometEvent event) throws IOException, ServletException { > > if (event.getEventType() == CometEvent.EventType.BEGIN) { > > System.out.println("Begin Event"); > > } > > else if (event.getEventType() == CometEvent.EventType.ERROR) { > > System.out.println("Error Event"); > > event.close(); > > } > > else if (event.getEventType() == CometEvent.EventType.END) { > > System.out.println("End Event"); > > event.close(); > > } > > } > > } > > > > CLIENT (html): > > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd"> > > <html> > > <head> > > <title>test</title> > > </head> > > <body> > > <input type="button" value="TEST" onclick="test(); return false;" /> > > > > <script type="text/javascript"> > > function test() { > > var api = new XMLHttpRequest; > > api.onreadystatechange = onreadystatechange; > > > > api.open("GET", "http://localhost/Test/Controller", true); > > > > api.send(""); > > } > > > > function onreadystatechange() { > > } > > > > </script> > > > > </body> > > </html> > > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [hidden email] > For additional commands, e-mail: [hidden email] > |
| Powered by Nabble | Edit this page |
