vasanth
I'm new here

BufferReader hang in FS while virus scanning

Dear All,

Currently I am working in virus scanning in FS Service. So I am sending image file as well as the text files for the scanning. But the code works fine in the local  but after deploying it to FS it hangs only for the Image file in the line ( while ( (tmp = responseReader.readLine()) != null && responseReader.ready())) please find the code below

socket = new Socket(VscanConstant.VIRUS_SCANNER_HOST, VscanConstant.VIRUS_SCANNER_PORT);

            // send ICAP header

            BufferedReader responseReader = new BufferedReader(new InputStreamReader(socket.getInputStream()));

           

            PrintWriter output = new PrintWriter(socket.getOutputStream(), true);

            // Socket time out

            socket.setSoTimeout(1000 * 60 * 2);

            output.println("RESPMOD icap://XXXXX.com:1344/interscan ICAP/1.0");

            output.println("Host:XXXXX.com:1344");

            output.println("Allow: 204");

            output.println("Encapsulated: req-hdr=0, res-hdr=10", res-body=70"));

            output.println("");

            output.print"GET http://demo HTTP/1.1\n\n");

            output.print("HTTP/1.1 200 OK\nTransfer-Encoding: chunked\n\n");

            output.println(Long.toString(bytes.length, 16));

            int c;

            fileIn = new ByteArrayInputStream(bytes);

            Logging.logInfo("before sending the files to the server", LOGGER);

            int count = 0;

            while ((c = fileIn.read()) != -1)

            {

                count++;

                output.write(c);

            }

            Logging.logInfo("count====>" + count, LOGGER);

            fileIn.close();

            output.println("");

            output.println("0");

            output.println("");

            output.flush();

          if (responseReader != null )

            {

                while ( (tmp = responseReader.readLine()) != null && responseReader.ready())

                {

                    resultBuffer.append(tmp);

                    resultBuffer.append("\n");

                }

            }

Do you have any idea why its hanging in the BufferedReader ??

0 Kudos
6 Replies
andre
I'm new here

this is a FirstSpirit-Modul-Serivce...am i right?

...did you get any exceptions? security exception (try giving the module "all rights") in the modul configuration GUI

... Another thought: can this be related to UNIX/WINDOWS line endings (i.e. LF vs. CRLF)?

maybe make a ThreadDump to trace down the caller stack in detail

0 Kudos

Hello Andre,

There is no exception in the server log and I have FS server in my local so there is no way for the UNIX/WINDOWS line endings issue.

Even i have given all the permission to the module. still it hangs on the same line for the image file (binary file) Smiley Sad. I have attached the log of the wireshark in the attachment..

Thank You,

Vasanth

0 Kudos

yes it is a FirstSpirit-Modul-Serivce.

0 Kudos

im meant a java ThreadDump (jstack) to trace down the caller stack in detail not network-traffic.log

0 Kudos

Hello Andre,

I found the root cause of the issue.. the UTF format (-Dfile.encoding=UTF-8) is mapped in the fs-wrapper.conf, so i have removed from the file and its working fine i.e with out hanging in the line.

I know this is not the solution for the problem now i know the root cause of my problem. Do you know how to de-activate the UTF format in the code ??

Thank You,

Vasanth

0 Kudos

hello Vasanth,

> Do you know how to de-activate the UTF format in the code ??

i think you shoud not use readLine instead use read(...) instead which is not CR/LF based

0 Kudos