DO NOT REPLY [Bug 48105] New: Transfering PNG using getResponse()

View: New views
10 Messages — Rating Filter:   Alert me  

DO NOT REPLY [Bug 48105] New: Transfering PNG using getResponse()

by Bugzilla from bugzilla@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

https://issues.apache.org/bugzilla/show_bug.cgi?id=48105

           Summary: Transfering PNG using getResponse()
           Product: Tomcat 5
           Version: 5.5.28
          Platform: PC
        OS/Version: Windows Server 2003
            Status: NEW
          Severity: critical
          Priority: P2
         Component: Catalina
        AssignedTo: dev@...
        ReportedBy: stefan.schumacher@...


Hello,

within my action code I try to transfer my png files to browser using
getResponse().getOutputStream()).

protected ActionForward executeInternal() throws Exception {

        FileInputStream in = null;
        ServletOutputStream out = null;
        try {
            String sFileName = getRequest().getParameter("img");
            long length = new File(sFileName).length();
            getResponse().setContentType("image/png");
            getResponse().setContentLength((int) length);

            in = new FileInputStream(sFileName);
            out = getResponse().getOutputStream();

            if (length > Integer.MAX_VALUE) {
                ABPLogger.getErrorLogger().severe("**File is too large");
                byte[] buf = new byte[4096];
                int len;
                while( (len = in.read(buf)) > 0 ) {
                    out.write(buf, 0, len);
                }
            }
            else {
                //Read/Write out in one block!!!!
                byte[] bytes = new byte[(int) length];
                in.read(bytes);
                out.write(bytes);
            }
        } catch (Exception ex) {
           getErrorLogger().severe("**TomCat streaming problem!!!!!");
           ex.printStackTrace();
        } finally {
            ABPResourceHelper.close(in);
        }
        return null;
    }


But very often following excpetion occurs.

jIT_121c9dc019d_SEVERE 2009-06-10T14:09:47,293 java.lang.System.arraycopy
Version 7.1.0.${p4.changelist}
Struts Action.execute() returns no ActionForward.
Query:
/modelgraphic.do?IDSConversationID=ID_5&img=NSN%20approvedffffffffd623bca8409/c967fee0-46be-11de-27ff-001e0b6f107a_100.png

java.lang.ArrayIndexOutOfBoundsException
        at java.lang.System.arraycopy(Native Method)
    at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:346)
    at
org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:381)
    at org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:370)
    at
org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:89)

Within a second try it works well. What can I do to prevent this effect?

Thanks
Stefan

--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


DO NOT REPLY [Bug 48105] Transfering PNG using getResponse().getOutputStream()

by Bugzilla from bugzilla@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

https://issues.apache.org/bugzilla/show_bug.cgi?id=48105

Stefan Schumacher <stefan.schumacher@...> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Transfering PNG using       |Transfering PNG using
                   |getResponse()               |getResponse().getOutputStre
                   |                            |am()

--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


DO NOT REPLY [Bug 48105] Transfering PNG using getResponse().getOutputStream()

by Bugzilla from bugzilla@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

https://issues.apache.org/bugzilla/show_bug.cgi?id=48105

--- Comment #1 from Pid <bugzilla@...> 2009-11-02 10:45:50 UTC ---
You seem to be having a problem with your code - I don't think you're reporting
an actual bug with Tomcat.

The Tomcat Users mailing list is the proper place to get help, please ask
there.

--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


DO NOT REPLY [Bug 48105] Transfering PNG using getResponse().getOutputStream()

by Bugzilla from bugzilla@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

https://issues.apache.org/bugzilla/show_bug.cgi?id=48105

Konstantin Kolinko <knst.kolinko@...> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID
           Severity|critical                    |normal

--- Comment #2 from Konstantin Kolinko <knst.kolinko@...> 2009-11-02 17:06:06 UTC ---
(In reply to comment #0)
> java.lang.ArrayIndexOutOfBoundsException
>         at java.lang.System.arraycopy(Native Method)
>     at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:346)
>     at
> org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:381)
>     at org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:370)
>     at
> org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:89)
>

What Tomcat version are you using?
The line numbers in your stack trace do not match Tomcat 5.5.28 sources.

I think that TC version that you are using is 5.5.20 or earlier. There were a
lot of changes since then.

--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


DO NOT REPLY [Bug 48105] Transfering PNG using getResponse().getOutputStream()

by Bugzilla from bugzilla@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

https://issues.apache.org/bugzilla/show_bug.cgi?id=48105

--- Comment #3 from Stefan Schumacher <stefan.schumacher@...> 2009-11-02 22:26:37 UTC ---
Thanks you very much for your reply. Similar effect is also reproducable with
TomCat 6.0.18 (20). But I will check this.

Thanks
Stefan

--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


DO NOT REPLY [Bug 48105] Transfering PNG using getResponse().getOutputStream()

by Bugzilla from bugzilla@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

https://issues.apache.org/bugzilla/show_bug.cgi?id=48105

Stefan Schumacher <stefan.schumacher@...> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |

--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


DO NOT REPLY [Bug 48105] Transfering PNG using getResponse().getOutputStream()

by Bugzilla from bugzilla@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

https://issues.apache.org/bugzilla/show_bug.cgi?id=48105

--- Comment #4 from Stefan Schumacher <stefan.schumacher@...> 2009-11-03 22:53:43 UTC ---
Can it be that the effect has something to do with mod_jk?

Thanks
Stefan

--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


DO NOT REPLY [Bug 48105] Transfering PNG using getResponse().getOutputStream()

by Bugzilla from bugzilla@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

https://issues.apache.org/bugzilla/show_bug.cgi?id=48105

Konstantin Kolinko <knst.kolinko@...> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |NEEDINFO

--- Comment #5 from Konstantin Kolinko <knst.kolinko@...> 2009-11-03 23:55:26 UTC ---
> Can it be that the effect has something to do with mod_jk?

Do not know. At least, I know that the following exists in the code:
in o.a.catalina.connector.Response#setConnector() of tc5.5.z:

133:        if ("AJP/1.3".equals(connector.getProtocol())) {
134:            // default size to size of one ajp-packet
135:            // Reduce HSIZE and Command = 6 Bytes
136:            outputBuffer = new OutputBuffer(8184);
137:        } else {
138:            outputBuffer = new OutputBuffer();
139:        }

The default limit on size of OutputBuffer is 8*1024 = 8192 bytes. With AJP it
is 8184 bytes.

Still, I would like to see a stacktrace from a more recent version of Tomcat
5.5 or 6.0.

Knowing the size of that c967fee0-46be-11de-27ff-001e0b6f107a_100.png or other
files that fail might also be a hint.

--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


DO NOT REPLY [Bug 48105] Transfering PNG using getResponse().getOutputStream()

by Bugzilla from bugzilla@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

https://issues.apache.org/bugzilla/show_bug.cgi?id=48105

--- Comment #6 from Stefan Schumacher <stefan.schumacher@...> 2009-11-04 00:26:51 UTC ---
Enclosed a call stack using mod_jk...additional stacktrace using Tomcat 6.*
will be delivered today.

T_1223033e029_SEVERE 2009-06-30T11:07:01,929 java.lang.System.arraycopy
  Version 7.1.0.${p4.changelist}
Additional information:
ServletOutputStream.write

  Exception class: class java.lang.ArrayIndexOutOfBoundsException
  HttpServletResponse getBufferSize: 8184
  HttpServletResponse getCharacterEncoding: UTF-8
  HttpServletResponse getContentType: image/png;charset=UTF-8
  HttpServletResponse getLocale: en_US
  FileInputStream class: class java.io.FileInputStream
  FileInputStream toString: java.io.FileInputStream@1bf446e
  FileInputStream available: 21302
  ServletOutputStream class: class
org.apache.catalina.connector.CoyoteOutputStream
  ServletOutputStream toString:
org.apache.catalina.connector.CoyoteOutputStream@25a311
  len: 4096
Query:
/businesspublisher/modelgraphic.do?IDSConversationID=ID_1&img=NSN%20approvedffffffffe82360d3409/dd0cecf1-2fed-11de-27ff-001e0b6f107a_100.png
java.lang.ArrayIndexOutOfBoundsException
    at java.lang.System.arraycopy(Native Method)
    at org.apache.jk.common.MsgAjp.cpBytes(MsgAjp.java:199)
    at org.apache.jk.common.MsgAjp.appendBytes(MsgAjp.java:187)
    at org.apache.jk.common.JkInputStream.doWrite(JkInputStream.java:154)
    at org.apache.coyote.Response.doWrite(Response.java:560)
    at
org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:353)
    at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:434)
    at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:349)
    at
org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:381)
    at org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:370)
    at
org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:89)
    at
com.idsscheer.aris.businesspublisher.actions.AClusterModelGraphicAction.executeInternal(AClusterModelGraphicAction.java:44)
    at
com.idsscheer.aris.businesspublisher.actions.ABPLayoutBaseAction.executeImpl(ABPLayoutBaseAction.java:36)
    at
com.idsscheer.aris.businesspublisher.actions.BaseAction.execute(BaseAction.java:273)
    at
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
    at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
    at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)


thanks
Stefan

--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


DO NOT REPLY [Bug 48105] Transfering PNG using getResponse().getOutputStream()

by Bugzilla from bugzilla@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

https://issues.apache.org/bugzilla/show_bug.cgi?id=48105

--- Comment #7 from Pid <bugzilla@...> 2009-11-24 15:33:53 UTC ---
com.idsscheer.aris.businesspublisher.actions.AClusterModelGraphicAction.executeInternal(AClusterModelGraphicAction.java:44)

What is at line 44 in your code?

--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...