SSLReadFilter - bad_record_mac error under load?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

SSLReadFilter - bad_record_mac error under load?

D. J. Hagberg (Sun)
Just wondering if anyone else has seen an error like this when sending
lots of little messages or one big (50k) message over the SSL NIO
support in Grizzly.  (Note: my client on the other end of my
Grizzly-based server uses the old-style SSLSocket blocking IO, not that
that should make any difference).

I'll try to work up a test for this to make sure I can reproduce it
outside my application...  But I seem to remember having seen something
about this MAC error in the Glassfish bugfix release notes.

                        -=- D. J.

Jun 30, 2007 3:11:16 PM com.sun.grizzly.util.SSLUtils unwrapAll
FINE: unwrap
javax.net.ssl.SSLException: Received fatal alert: bad_record_mac
         at
com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:166)
         at
com.sun.net.ssl.internal.ssl.SSLEngineImpl.fatal(SSLEngineImpl.java:1352)
         at
com.sun.net.ssl.internal.ssl.SSLEngineImpl.fatal(SSLEngineImpl.java:1320)
         at
com.sun.net.ssl.internal.ssl.SSLEngineImpl.recvAlert(SSLEngineImpl.java:1482)
         at
com.sun.net.ssl.internal.ssl.SSLEngineImpl.readRecord(SSLEngineImpl.java:957)
         at
com.sun.net.ssl.internal.ssl.SSLEngineImpl.readNetRecord(SSLEngineImpl.java:782)
         at
com.sun.net.ssl.internal.ssl.SSLEngineImpl.unwrap(SSLEngineImpl.java:674)
         at javax.net.ssl.SSLEngine.unwrap(SSLEngine.java:566)
         at com.sun.grizzly.util.SSLUtils.unwrap(SSLUtils.java:231)
         at com.sun.grizzly.util.SSLUtils.unwrapAll(SSLUtils.java:183)
         at
com.sun.grizzly.filter.SSLReadFilter.doRead(SSLReadFilter.java:300)
         at
com.sun.grizzly.filter.SSLReadFilter.execute(SSLReadFilter.java:146)
         at
com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:77)
         at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:56)
         at com.sun.grizzly.Context.call(Context.java:250)
         at
com.sun.grizzly.util.WorkerThreadImpl.run(WorkerThreadImpl.java:138)
Jun 30, 2007 3:11:16 PM com.sun.srs.tunneling.server.nio.MsgWorkerThread run
SEVERE: MsgWorkerThread unexpected exception:
java.io.IOException: Broken pipe
         at sun.nio.ch.FileDispatcher.write0(Native Method)
         at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:29)
         at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:104)
         at sun.nio.ch.IOUtil.write(IOUtil.java:75)
         at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:302)
         at
com.sun.grizzly.util.OutputWriter.flushChannel(OutputWriter.java:88)
         at
com.sun.grizzly.util.OutputWriter.flushChannel(OutputWriter.java:57)
         at
com.sun.grizzly.util.SSLOutputWriter.flushChannel(SSLOutputWriter.java:98)
         at
com.sun.grizzly.util.SSLOutputWriter.flushChannel(SSLOutputWriter.java:67)
         at
com.sun.srs.tunneling.server.handlers.MsgTask.writeMessage(MsgTask.java:134)
         at
com.sun.srs.tunneling.server.handlers.MsgWriteTask.call(MsgWriteTask.java:30)
         at
com.sun.srs.tunneling.server.nio.MsgWorkerThread.run(MsgWorkerThread.java:58)

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: SSLReadFilter - bad_record_mac error under load?

D. J. Hagberg (Sun)
I think I may have just had my Homer Simpson moment -- D'oh!!!

What I think is happening is that I have multiple WorkerThread's all
calling SSLOutputWriter.flushChannel on the *same* SelectorKey at the
same time.

This should have been obvious to me earlier, but....  that's bad, right?

;-)

                        -=- D. J.

D. J. Hagberg (Sun) wrote:

> Just wondering if anyone else has seen an error like this when sending
> lots of little messages or one big (50k) message over the SSL NIO
> support in Grizzly.  (Note: my client on the other end of my
> Grizzly-based server uses the old-style SSLSocket blocking IO, not that
> that should make any difference).
>
> I'll try to work up a test for this to make sure I can reproduce it
> outside my application...  But I seem to remember having seen something
> about this MAC error in the Glassfish bugfix release notes.
>
>             -=- D. J.
>
> Jun 30, 2007 3:11:16 PM com.sun.grizzly.util.SSLUtils unwrapAll
> FINE: unwrap
> javax.net.ssl.SSLException: Received fatal alert: bad_record_mac
>         at
> com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:166)
>         at
> com.sun.net.ssl.internal.ssl.SSLEngineImpl.fatal(SSLEngineImpl.java:1352)
>         at
> com.sun.net.ssl.internal.ssl.SSLEngineImpl.fatal(SSLEngineImpl.java:1320)
>         at
> com.sun.net.ssl.internal.ssl.SSLEngineImpl.recvAlert(SSLEngineImpl.java:1482)
>
>         at
> com.sun.net.ssl.internal.ssl.SSLEngineImpl.readRecord(SSLEngineImpl.java:957)
>
>         at
> com.sun.net.ssl.internal.ssl.SSLEngineImpl.readNetRecord(SSLEngineImpl.java:782)
>
>         at
> com.sun.net.ssl.internal.ssl.SSLEngineImpl.unwrap(SSLEngineImpl.java:674)
>         at javax.net.ssl.SSLEngine.unwrap(SSLEngine.java:566)
>         at com.sun.grizzly.util.SSLUtils.unwrap(SSLUtils.java:231)
>         at com.sun.grizzly.util.SSLUtils.unwrapAll(SSLUtils.java:183)
>         at
> com.sun.grizzly.filter.SSLReadFilter.doRead(SSLReadFilter.java:300)
>         at
> com.sun.grizzly.filter.SSLReadFilter.execute(SSLReadFilter.java:146)
>         at
> com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:77)
>
>         at
> com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:56)
>         at com.sun.grizzly.Context.call(Context.java:250)
>         at
> com.sun.grizzly.util.WorkerThreadImpl.run(WorkerThreadImpl.java:138)
> Jun 30, 2007 3:11:16 PM com.sun.srs.tunneling.server.nio.MsgWorkerThread
> run
> SEVERE: MsgWorkerThread unexpected exception:
> java.io.IOException: Broken pipe
>         at sun.nio.ch.FileDispatcher.write0(Native Method)
>         at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:29)
>         at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:104)
>         at sun.nio.ch.IOUtil.write(IOUtil.java:75)
>         at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:302)
>         at
> com.sun.grizzly.util.OutputWriter.flushChannel(OutputWriter.java:88)
>         at
> com.sun.grizzly.util.OutputWriter.flushChannel(OutputWriter.java:57)
>         at
> com.sun.grizzly.util.SSLOutputWriter.flushChannel(SSLOutputWriter.java:98)
>         at
> com.sun.grizzly.util.SSLOutputWriter.flushChannel(SSLOutputWriter.java:67)
>         at
> com.sun.srs.tunneling.server.handlers.MsgTask.writeMessage(MsgTask.java:134)
>
>         at
> com.sun.srs.tunneling.server.handlers.MsgWriteTask.call(MsgWriteTask.java:30)
>
>         at
> com.sun.srs.tunneling.server.nio.MsgWorkerThread.run(MsgWorkerThread.java:58)
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: SSLReadFilter - bad_record_mac error under load?

Jeanfrancois Arcand-2

Hi,
D. J. Hagberg (Sun) wrote:
> I think I may have just had my Homer Simpson moment -- D'oh!!!
>
> What I think is happening is that I have multiple WorkerThread's all
> calling SSLOutputWriter.flushChannel on the *same* SelectorKey at the
> same time.
>
> This should have been obvious to me earlier, but....  that's bad, right?
>

Yes I suspect this is a problem :-) But from your stack trace, it seems
there is a problem with the read, not the write. The latest excetions is
useless as the connection was probably closed before the server as a
chance to write.

-- Jeanfrancois

> ;-)
>
>             -=- D. J.
>
> D. J. Hagberg (Sun) wrote:
>> Just wondering if anyone else has seen an error like this when sending
>> lots of little messages or one big (50k) message over the SSL NIO
>> support in Grizzly.  (Note: my client on the other end of my
>> Grizzly-based server uses the old-style SSLSocket blocking IO, not
>> that that should make any difference).
>>
>> I'll try to work up a test for this to make sure I can reproduce it
>> outside my application...  But I seem to remember having seen
>> something about this MAC error in the Glassfish bugfix release notes.
>>
>>             -=- D. J.
>>
>> Jun 30, 2007 3:11:16 PM com.sun.grizzly.util.SSLUtils unwrapAll
>> FINE: unwrap
>> javax.net.ssl.SSLException: Received fatal alert: bad_record_mac
>>         at
>> com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:166)
>>         at
>> com.sun.net.ssl.internal.ssl.SSLEngineImpl.fatal(SSLEngineImpl.java:1352)
>>         at
>> com.sun.net.ssl.internal.ssl.SSLEngineImpl.fatal(SSLEngineImpl.java:1320)
>>         at
>> com.sun.net.ssl.internal.ssl.SSLEngineImpl.recvAlert(SSLEngineImpl.java:1482)
>>
>>         at
>> com.sun.net.ssl.internal.ssl.SSLEngineImpl.readRecord(SSLEngineImpl.java:957)
>>
>>         at
>> com.sun.net.ssl.internal.ssl.SSLEngineImpl.readNetRecord(SSLEngineImpl.java:782)
>>
>>         at
>> com.sun.net.ssl.internal.ssl.SSLEngineImpl.unwrap(SSLEngineImpl.java:674)
>>         at javax.net.ssl.SSLEngine.unwrap(SSLEngine.java:566)
>>         at com.sun.grizzly.util.SSLUtils.unwrap(SSLUtils.java:231)
>>         at com.sun.grizzly.util.SSLUtils.unwrapAll(SSLUtils.java:183)
>>         at
>> com.sun.grizzly.filter.SSLReadFilter.doRead(SSLReadFilter.java:300)
>>         at
>> com.sun.grizzly.filter.SSLReadFilter.execute(SSLReadFilter.java:146)
>>         at
>> com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:77)
>>
>>         at
>> com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:56)
>>
>>         at com.sun.grizzly.Context.call(Context.java:250)
>>         at
>> com.sun.grizzly.util.WorkerThreadImpl.run(WorkerThreadImpl.java:138)
>> Jun 30, 2007 3:11:16 PM
>> com.sun.srs.tunneling.server.nio.MsgWorkerThread run
>> SEVERE: MsgWorkerThread unexpected exception:
>> java.io.IOException: Broken pipe
>>         at sun.nio.ch.FileDispatcher.write0(Native Method)
>>         at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:29)
>>         at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:104)
>>         at sun.nio.ch.IOUtil.write(IOUtil.java:75)
>>         at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:302)
>>         at
>> com.sun.grizzly.util.OutputWriter.flushChannel(OutputWriter.java:88)
>>         at
>> com.sun.grizzly.util.OutputWriter.flushChannel(OutputWriter.java:57)
>>         at
>> com.sun.grizzly.util.SSLOutputWriter.flushChannel(SSLOutputWriter.java:98)
>>
>>         at
>> com.sun.grizzly.util.SSLOutputWriter.flushChannel(SSLOutputWriter.java:67)
>>
>>         at
>> com.sun.srs.tunneling.server.handlers.MsgTask.writeMessage(MsgTask.java:134)
>>
>>         at
>> com.sun.srs.tunneling.server.handlers.MsgWriteTask.call(MsgWriteTask.java:30)
>>
>>         at
>> com.sun.srs.tunneling.server.nio.MsgWorkerThread.run(MsgWorkerThread.java:58)
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]