Received: (qmail 26323 invoked by uid 2012); 20 Dec 1999 19:20:05 -0000 Message-Id: <19991220192005.26322.qmail@hyperreal.org> Date: 20 Dec 1999 19:20:05 -0000 From: Jon Smirl Reply-To: jonsmirl@mediaone.net To: apbugs@hyperreal.org Subject: Pages being returned are empty X-Send-Pr-Version: 3.2 >Number: 5498 >Category: mod_jserv >Synopsis: Pages being returned are empty >Confidential: no >Severity: serious >Priority: medium >Responsible: jserv >State: open >Class: sw-bug >Submitter-Id: apache >Arrival-Date: Mon Dec 20 11:30:01 PST 1999 >Last-Modified: Mon Dec 20 13:50:01 PST 1999 >Originator: jonsmirl@mediaone.net >Organization: apache >Release: 1.3.9 1.1b3 >Environment: Win95, MS JVM >Description: I can watch my servlet write data into the output stream, but this data is not being flushed form JServ to Apache. Should out.close() in JServConnection.java be servlet_out.close() instead? Switch this fixes my problem. > From JServConnection.java... if (servlet_writer != null) { servlet_writer.close(); } out.close; change to: if (servlet_writer != null) { servlet_writer.close(); } else servlet_out.close(); Why is this loop needed in the JServOutputStream close function? public void close() throws IOException { int l; do { l = in.available(); in.skip(l); } while (l > 0); sendHttpHeaders(); out.close(); The page that is giving me trouble has data available on it. Jon Smirl jonsmirl@mediaone.net >How-To-Repeat: >Fix: > From JServConnection.java... if (servlet_writer != null) { servlet_writer.close(); } out.close; change to: if (servlet_writer != null) { servlet_writer.close(); } else servlet_out.close(); >Audit-Trail: From: jon * To: Cc: Subject: mod_jserv/5498: Pages being returned are empty Date: Mon, 20 Dec 1999 13:48:06 -0800 ---------- From: Michal Mosiewicz Reply-To: "Java Apache" Date: Mon, 20 Dec 1999 22:36:46 +0100 To: Java Apache Subject: Re: FW: mod_jserv/5498: Pages being returned are empty jon * wrote: +1 on the patch. However the real reason that pages was empty was that the servlet author didn't close the output. So this patch actually closes the output for him, and corrects his mistake. > [...] > Why is this loop needed in the JServOutputStream close function? > > public void close() throws IOException { > int l; > do { > l = in.available(); > in.skip(l); > } while (l > 0); > > sendHttpHeaders(); > out.close(); It's a "linger on close" feature. The loop is to protect that your data will be received by the browser even if you haven't received all the input stream. In case you have unread data waiting for being received in the socket, and you close the socket, depending on the operating system your output data that are buffered in the socket may get lost. Many OS'es assume "no SO_LINGER" as a default policy, setting socket options sometimes has no effect in JVM's. So this is safe way to go around this problem. AFAIK Costin suggested that calling available() is enough, but this seem to be safer. -- Mike -- ---------------------------------------------------------- To subscribe: java-apache-on@list.working-dogs.com To unsubscribe: java-apache-off@list.working-dogs.com Archives and Other: Problems?: jon@working-dogs.com From: jon * To: Cc: Subject: mod_jserv/5498: Pages being returned are empty Date: Mon, 20 Dec 1999 13:48:26 -0800 ---------- From: Jon Smirl Reply-To: jonsmirl@mediaone.net Date: 20 Dec 1999 19:20:05 -0000 To: apbugs@hyperreal.org Subject: mod_jserv/5498: Pages being returned are empty >Number: 5498 >Category: mod_jserv >Synopsis: Pages being returned are empty >Confidential: no >Severity: serious >Priority: medium >Responsible: jserv >State: open >Class: sw-bug >Submitter-Id: apache >Arrival-Date: Mon Dec 20 11:30:01 PST 1999 >Last-Modified: >Originator: jonsmirl@mediaone.net >Organization: apache >Release: 1.3.9 1.1b3 >Environment: Win95, MS JVM >Description: I can watch my servlet write data into the output stream, but this data is not being flushed form JServ to Apache. Should out.close() in JServConnection.java be servlet_out.close() instead? Switch this fixes my problem. > From JServConnection.java... if (servlet_writer != null) { servlet_writer.close(); } out.close; change to: if (servlet_writer != null) { servlet_writer.close(); } else servlet_out.close(); Why is this loop needed in the JServOutputStream close function? public void close() throws IOException { int l; do { l = in.available(); in.skip(l); } while (l > 0); sendHttpHeaders(); out.close(); The page that is giving me trouble has data available on it. Jon Smirl jonsmirl@mediaone.net >How-To-Repeat: >Fix: > From JServConnection.java... if (servlet_writer != null) { servlet_writer.close(); } out.close; change to: if (servlet_writer != null) { servlet_writer.close(); } else servlet_out.close(); >Audit-Trail: >Unformatted: [In order for any reply to be added to the PR database, you need] [to include in the Cc line and make sure the] [subject line starts with the report component and number, with ] [or without any 'Re:' prefixes (such as "general/1098:" or ] ["Re: general/1098:"). If the subject doesn't match this ] [pattern, your message will be misfiled and ignored. The ] ["apbugs" address is not added to the Cc line of messages from ] [the database automatically because of the potential for mail ] [loops. If you do not include this Cc, your reply may be ig- ] [nored unless you are responding to an explicit request from a ] [developer. Reply only with text; DO NOT SEND ATTACHMENTS! ] >Unformatted: [In order for any reply to be added to the PR database, you need] [to include in the Cc line and make sure the] [subject line starts with the report component and number, with ] [or without any 'Re:' prefixes (such as "general/1098:" or ] ["Re: general/1098:"). If the subject doesn't match this ] [pattern, your message will be misfiled and ignored. The ] ["apbugs" address is not added to the Cc line of messages from ] [the database automatically because of the potential for mail ] [loops. If you do not include this Cc, your reply may be ig- ] [nored unless you are responding to an explicit request from a ] [developer. Reply only with text; DO NOT SEND ATTACHMENTS! ]