You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Sunny Copony <su...@inovit.de> on 2002/06/12 10:11:05 UTC

File loading not complete, but no exceptions thrown!

Hi,

have a big problem with file loading, please, maybe some of you have an
idea!!

When a series of 20 - 120 files (jpg icons) is loaded, the client hangs
(single-thread) or 2 - 5 files are not loaded (multiple-threads), not
allways the same.
NO exception is thrown and the complete server method for loading is
done (inserted a counter to the while statement for read-write).

I tested with single-thread-client and a multiple-threads-client which
starts every http connect in an own thread. 

Single-thread:
the client hangs at icon x, the servlet did the complete method for icon
x. It seams that the response is not real and the client is still
waiting for it.

Multiple-threads:
2 - 5 files are not loaded, but in the servlet log everything seams ok.

I think that the servlet response is not ok, but have no idea how to
correct it!!

In server.xml the http connection parameters are:
<!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
    <Connector
className="org.apache.catalina.connector.http.HttpConnector"
               port="8090" minProcessors="5" maxProcessors="1000"
               enableLookups="true" redirectPort="8443"
               acceptCount="30" debug="99" connectionTimeout="300000"/>

For the multiple-thread-client I tryed to synchronize the servlet method
or parts of it - it didn't help.


Would be very happy to get your help, I'm completely stuck and have to
get it ready.....

Love,
Sunny



logs 
----------------------------------
servlet
...
2002-06-12 8:30:11 S HttpProcessor[8090][217]:
B2C14100530335D471943820A3F4F413 - GetImageServlet.doPost()
2002-06-12 8:30:11 I HttpProcessor[8090][217]: GetImagesServlet.Cmd:
getIcon
2002-06-12 8:30:11 D HttpProcessor[8090][217]: GetImagesServlet:
deserialized obj.toString:
1.2.840.113619.2.1.1.2702585278.286.781967413.52
2002-06-12 8:30:11 D HttpProcessor[8090][217]:
GetImagesServlet.getIcon(), call converter:
/usr/lib/tomcat/webapps/inowebvw/WEB-INF/dicom2jpg/WebMain/mainWeb_g.ora
cle i 1.2.840.113619.2.1.1.2702585278.286.781967413.52
/usr/lib/tomcat/webapps/inowebvw/WEB-INF/dicom2jpg/WebMain/convert.conf
2002-06-12 8:30:11 D HttpProcessor[8090][217]:
GetImagesServlet.getIcon(), converter returns:
/home/inovit/images/inopacs/jpg_icons/CT00008F/D0000229.jpg
2002-06-12 8:30:11 D HttpProcessor[8090][217]:
GetImagesServlet.getIcon()... after setContType
2002-06-12 8:30:11 D HttpProcessor[8090][217]:
GetImagesServlet.getIcon()... after setHeader
2002-06-12 8:30:11 D HttpProcessor[8090][217]:
GetImagesServlet.getIcon() ... after new FileInoutStream(), imgpath =
/home/inovit/images/inopacs/jpg_icons/CT00008F/D0000229.jpg
2002-06-12 8:30:11 D HttpProcessor[8090][217]:
GetImagesServlet.getIcon() ... after new BuffOutpStr
2002-06-12 8:30:11 D HttpProcessor[8090][217]:
GetImagesServlet.getIcon() ... 1x while
2002-06-12 8:30:11 D HttpProcessor[8090][217]:
GetImagesServlet.getIcon() ... whilecounter = 24
2002-06-12 8:30:11 D HttpProcessor[8090][217]:
GetImagesServlet.getIcon() ... after flush()
----------------------------------
client
...
  --  loading ok --
15 loading535 143 1.2.840.113619.2.1.1.2702585278.286.781967413.51 16
1
getIcon 1.2.840.113619.2.1.1.2702585278.286.781967413.51
a
con:
sun.net.www.protocol.http.HttpURLConnection:http://192.9.200.15:8090/ino
webvw/GetImagesServlet?cmd=getIcon&sid=B2C14100530335D471943820A3F4F413
c
2
15 getIconSource returned
15 loading done 535 143 1.2.840.113619.2.1.1.2702585278.286.781967413.51
16

  --  loading not ok --
16 loading536 143 1.2.840.113619.2.1.1.2702585278.286.781967413.52 17
1
getIcon 1.2.840.113619.2.1.1.2702585278.286.781967413.52
a
con:
sun.net.www.protocol.http.HttpURLConnection:http://192.9.200.15:8090/ino
webvw/GetImagesServlet?cmd=getIcon&sid=B2C14100530335D471943820A3F4F413
----------------------------------



I'm attaching here some code parts, maybe it helps to find the reason.
----------------------------------
servlet
...
        String executecom = dicom2jpgBin + " i " + siuid + " " +
dicom2jpgConf;
        Log.println (Log.DIAG_DEBUG, "GetImagesServlet.getIcon(), call
converter: " + executecom);
        Runtime runtime=Runtime.getRuntime();
        Process process=null;
 
        try{
            //call converter
            process=runtime.exec(executecom);
             // returns Path to converted Image
            String line = "";
            String imgpath = "";
            BufferedReader in = new BufferedReader(new
InputStreamReader(process.getInputStream()));
            while ((line = in.readLine()) != null) {
                imgpath = imgpath + line;
            }
            Log.println (Log.DIAG_DEBUG, "GetImagesServlet.getIcon(),
converter returns: " + imgpath);
 
            // FileInputStream zu dem Pfad öffnen, dann mit
HttpOutputStream schreiben
            res.setContentType("application/octet-stream");
                  Log.println (Log.DIAG_DEBUG,
"GetImagesServlet.getIcon()... after setContType");
            res.setHeader("Cache-Control", "no-cache");
                  Log.println (Log.DIAG_DEBUG,
"GetImagesServlet.getIcon()... after setHeader");
            FileInputStream fis ;
            try {
                fis = new FileInputStream(imgpath) ;
                      Log.println (Log.DIAG_DEBUG,
"GetImagesServlet.getIcon()  ... after new FileInoutStream(), imgpath =
" + imgpath);
                BufferedOutputStream out = new BufferedOutputStream
(res.getOutputStream ());
                      Log.println (Log.DIAG_DEBUG,
"GetImagesServlet.getIcon() ... after new BuffOutpStr");
                byte buff[] = new byte[80] ;
                int len ;
                int nur1x = 0;

                while( (len = fis.read(buff,0,80)) != -1 ){
                    if (nur1x < 1) { Log.println (Log.DIAG_DEBUG,
"GetImagesServlet.getIcon() ... 1x while"); } 
                    nur1x++ ;
                    out.write(buff,0,len);
                }
                Log.println (Log.DIAG_DEBUG, "GetImagesServlet.getIcon()
... whilecounter = " + nur1x);
                
                out.flush();
                      Log.println (Log.DIAG_DEBUG,
"GetImagesServlet.getIcon() ... after flush()");
                fis.close();
                out.close();
            }
            catch (Exception e ){Log.println (Log.DIAG_ERROR, "EN: 0207
-- GetImagesServlet.getIcon(): " + e);}
         }
        catch (Exception e){Log.println (Log.DIAG_ERROR, "EN: 0208 --
GetImagesServlet.getIcon(): " + e);}
    }
----------------------------------
client
...
Log.println(Log.DIAG_VERBOSE, "con: " + con.toString());
// get the result input stream 
response = con.getInputStream();
Log.println(Log.DIAG_VERBOSE, "c");

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>