Hi Sergey,
this issue is similar to [1] and [2] fixed in Grizzly 1.9.x.
You can try to apply the same changes in Grizzly 1.0.x, specifically
implement swapEncryptInBuffer(...), swapEncryptOutBuffer(...) logic
taken from the 1.9.x patch and apply it to
com.sun.enterprise.web.connector.grizzly.ssl.SSLAsyncReadTask from
Grizzly 1.0.x.
Grizzly 1.0.x could be checked out using git:
$ git clone
https://github.com/GrizzlyNIO/grizzly-mirror.git
$ git checkout 1.0.x
If you have more questions - pls. ask.
Fixes and contributions are always welcome.
Thanks.
WBR,
Alexey.
[1]
issue:
https://java.net/jira/browse/GRIZZLY-1376
diff:
https://github.com/GrizzlyNIO/grizzly-mirror/commit/3d23152ae1b54a4499c499c584ace1b03627aae4
[2]
issue:
https://java.net/jira/browse/GRIZZLY-1403
diff:
https://github.com/GrizzlyNIO/grizzly-mirror/commit/fd7c8dd47e449c01cc65b03f7bb7f3b8aa5db736
On 02.07.13 11:57, Sergey Armishev wrote:
> We have an Exception that from time to time thrown when our code flushes the data to the output stream. How can I configure this capacity parameter? Our Grizzly environment
> Grizzly 1.0.40 running on Linux-3.5.0-34-generic under JDK version: 1.6.0_27-Sun Microsystems Inc
>
> Code that generates Exception
>
> protected void writeMessage(String msg, HttpServletResponse response) throws IOException {
> if( response == null) {
> log.info("response is null");
> return;
> }
>
> if( msg == null) {
> log.info("GOT EMPTY MESSAGE ");
> msg = "";
> }
> response.setContentLength(msg.getBytes().length);
> response.setStatus(HttpServletResponse.SC_OK);
> PrintWriter writer = response.getWriter();
> writer.write(msg);
> writer.flush();// that line that generates Exception at com.fourhomemedia.portal.messagequeue.PortalQueue.writeMessage(PortalQueue.java:268)
> }
>
> An Exception stack trace
> [#|2013-07-01T12:31:04.238-0700|WARNING|sun-appserver2.1|javax.enterprise.system.stream.err|_ThreadID=35;_ThreadName=httpSSLWorkerThread-8443-18;_RequestID=bff5d22c-bef6-4f67-95ce-7e7d939e98a6;|
> java.lang.IllegalArgumentException
> at java.nio.Buffer.limit(Buffer.java:266)
> at sun.security.ssl.EngineOutputRecord.addMAC(EngineOutputRecord.java:132)
> at sun.security.ssl.EngineOutputRecord.write(EngineOutputRecord.java:301)
> at sun.security.ssl.EngineOutputRecord.write(EngineOutputRecord.java:268)
> at sun.security.ssl.EngineWriter.writeRecord(EngineWriter.java:185)
> at sun.security.ssl.SSLEngineImpl.writeRecord(SSLEngineImpl.java:1202)
> at sun.security.ssl.SSLEngineImpl.writeAppRecord(SSLEngineImpl.java:1172)
> at sun.security.ssl.SSLEngineImpl.wrap(SSLEngineImpl.java:1087)
> at javax.net.ssl.SSLEngine.wrap(SSLEngine.java:469)
> at com.sun.enterprise.web.connector.grizzly.ssl.SSLUtils.wrap(SSLUtils.java:265)
> at com.sun.enterprise.web.connector.grizzly.ssl.SSLOutputWriter.flushChannel(SSLOutputWriter.java:75)
> at com.sun.enterprise.web.connector.grizzly.ssl.SSLAsyncOutputBuffer.flushChannel(SSLAsyncOutputBuffer.java:83)
> at com.sun.enterprise.web.connector.grizzly.SocketChannelOutputBuffer.flushBuffer(SocketChannelOutputBuffer.java:205)
> at com.sun.enterprise.web.connector.grizzly.SocketChannelOutputBuffer.flush(SocketChannelOutputBuffer.java:183)
> at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.action(DefaultProcessorTask.java:1100)
> at com.sun.enterprise.web.connector.grizzly.ssl.SSLProcessorTask.action(SSLProcessorTask.java:151)
> at org.apache.coyote.Response.action(Response.java:237)
> at org.apache.coyote.tomcat5.OutputBuffer.doFlush(OutputBuffer.java:381)
> at org.apache.coyote.tomcat5.OutputBuffer.flush(OutputBuffer.java:351)
> at org.apache.coyote.tomcat5.CoyoteWriter.flush(CoyoteWriter.java:151)
> at com.fourhomemedia.portal.messagequeue.PortalQueue.writeMessage(PortalQueue.java:268)
>
> Java Buffer.java code that throws an exception
> public final Buffer limit(int newLimit) {
> if ((newLimit > capacity) || (newLimit < 0))
> throw new IllegalArgumentException(); // that is line 266 from Exception at java.nio.Buffer.limit(Buffer.java:266)
> limit = newLimit;
> if (position > limit) position = limit;
> if (mark > limit) mark = -1;
> return this;
> }
>
> Thanks,
> Sergey Armishev
>
>
> This e-mail, including attachments, may include confidential
> and/or proprietary information, and may be used only by the
> person or entity to which it is addressed.
> If the reader of this e-mail is not the intended recipient or his or
> her authorized agent, the reader is hereby notified that any
> dissemination, distribution or copying of this e-mail is prohibited.
> If you have received this e-mail in error, please notify the sender
> by replying to this message and delete this e-mail immediately