You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Adrian Sandor <ad...@yahoo.com> on 2007/07/13 13:53:24 UTC

Re: SSLFilter thread safe?

Trustin Lee writes:
> SSLFilter should be thread safe.  If not, it's a bug.
> 
> Which version of MINA are you using? Could you please provide us how
> you were able to reproduce the problem?

I think I'm experiencing the same problem, using MINA 1.1.0
Please download the test code from http://aditsu.net/ssltest.zip
Run the Server, then the Client; almost every time, the client will die after
10-20 seconds with a stack trace like this:

Exception in thread "main" javax.net.ssl.SSLException: bad record MAC
	at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:166)
	at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1477)
	at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1438)
	at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:781)
	at
com.sun.net.ssl.internal.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:677)
	at com.sun.net.ssl.internal.ssl.AppInputStream.read(AppInputStream.java:75)
	at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:411)
	at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453)
	at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183)
	at java.io.InputStreamReader.read(InputStreamReader.java:167)
	at java.io.BufferedReader.fill(BufferedReader.java:136)
	at java.io.BufferedReader.readLine(BufferedReader.java:299)
	at java.io.BufferedReader.readLine(BufferedReader.java:362)
	at ssl.Client.main(Client.java:22)

Indeed, synchronizing session.write seems to work.
I'd appreciate if this bug could be fixed, and I'll provide any further
information you may need.

Regards,
Adrian


Re: SSLFilter thread safe?

Posted by Trustin Lee <tr...@gmail.com>.
Oops.  Thanks for the code!

On 7/16/07, Adrian Sandor <ad...@yahoo.com> wrote:
> Trustin Lee <tr...@...> writes:
>
> >
> > Please let us know how we can reproduce your problem.
> >
>
> I already did. Copying it again here for your convenience:
>
> "Please download the test code from http://aditsu.net/ssltest.zip
> Run the Server, then the Client; almost every time, the client will die after
> 10-20 seconds with a stack trace like this:
>
> Exception in thread "main" javax.net.ssl.SSLException: bad record MAC
> [...]"
>
> Adrian
>
>


-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6

Re: SSLFilter thread safe?

Posted by Adrian Sandor <ad...@yahoo.com>.
Trustin Lee wrote:

> I was able to reproduce the problem.  Thanks for the pointer!
> 
> Please try the following JAR and let me know if the problem goes away
> or not.  Once you confirm that it's fixed, I will start the release
> process.

Hi Trustin,
I've tried the updated jar, both with the test code and with our
production code (briefly) and the problem seems to be fixed. Thanks a
lot! You have my +1 for the new release :)

Adrian


Re: SSLFilter thread safe?

Posted by Trustin Lee <tr...@gmail.com>.
On 7/16/07, Adrian Sandor <ad...@yahoo.com> wrote:
> Trustin Lee wrote:
> >
> > I can't reproduce the problem unfortunately.  I ran your code with the
> > latest JDK (1.6.0 update 2) and MINA 1.1.1-SNAPSHOT, and it works
> > flawlessly for more than 30 minutes.
> >
> > Trustin
>
> Hm.. well I used JDK 1.5.0, updates 11 and 12, in Gentoo Linux.
> 99% of the time I can reproduce the problem in less than 30 seconds.
> I tried it now with 1.6.0 update 1, and it seems to work. I think it
> still happened with 1.6 in our production code, but I'm not really sure.
> But the test code consistently reproduces the problem on 1.5

I was able to reproduce the problem.  Thanks for the pointer!

Please try the following JAR and let me know if the problem goes away
or not.  Once you confirm that it's fixed, I will start the release
process.

http://people.apache.org/repo/m2-snapshot-repository/org/apache/mina/mina-filter-ssl/1.1.1-SNAPSHOT/mina-filter-ssl-1.1.1-20070718.031338-9.jar

HTH,
Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6

Re: SSLFilter thread safe?

Posted by Adrian Sandor <ad...@yahoo.com>.
Trustin Lee wrote:
> 
> I can't reproduce the problem unfortunately.  I ran your code with the
> latest JDK (1.6.0 update 2) and MINA 1.1.1-SNAPSHOT, and it works
> flawlessly for more than 30 minutes.
> 
> Trustin

Hm.. well I used JDK 1.5.0, updates 11 and 12, in Gentoo Linux.
99% of the time I can reproduce the problem in less than 30 seconds.
I tried it now with 1.6.0 update 1, and it seems to work. I think it
still happened with 1.6 in our production code, but I'm not really sure.
But the test code consistently reproduces the problem on 1.5

Adrian


Re: SSLFilter thread safe?

Posted by Trustin Lee <tr...@gmail.com>.
On 7/16/07, Adrian Sandor <ad...@yahoo.com> wrote:
> Trustin Lee <tr...@...> writes:
>
> >
> > Please let us know how we can reproduce your problem.
> >
>
> I already did. Copying it again here for your convenience:
>
> "Please download the test code from http://aditsu.net/ssltest.zip
> Run the Server, then the Client; almost every time, the client will die after
> 10-20 seconds with a stack trace like this:
>
> Exception in thread "main" javax.net.ssl.SSLException: bad record MAC
> [...]"

I can't reproduce the problem unfortunately.  I ran your code with the
latest JDK (1.6.0 update 2) and MINA 1.1.1-SNAPSHOT, and it works
flawlessly for more than 30 minutes.

Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6

Re: SSLFilter thread safe?

Posted by Adrian Sandor <ad...@yahoo.com>.
Trustin Lee <tr...@...> writes:

> 
> Please let us know how we can reproduce your problem.
> 

I already did. Copying it again here for your convenience:

"Please download the test code from http://aditsu.net/ssltest.zip
Run the Server, then the Client; almost every time, the client will die after
10-20 seconds with a stack trace like this:

Exception in thread "main" javax.net.ssl.SSLException: bad record MAC
[...]"

Adrian


Re: SSLFilter thread safe?

Posted by Trustin Lee <tr...@gmail.com>.
Please let us know how we can reproduce your problem.

On 7/16/07, Adrian Sandor <ad...@yahoo.com> wrote:
> Trustin Lee <tr...@...> writes:
>
> >
> > Please try the latest snapshot for 1.1.1:
> >
> > http://people.apache.org/~trustin/snapshot/
> >
> > HTH,
> > Trustin
>
> I still got the same problem with the 1.1.1 snapshot
>
> Adrian
>
>


-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6

Re: SSLFilter thread safe?

Posted by Adrian Sandor <ad...@yahoo.com>.
Trustin Lee <tr...@...> writes:

> 
> Please try the latest snapshot for 1.1.1:
> 
> http://people.apache.org/~trustin/snapshot/
> 
> HTH,
> Trustin

I still got the same problem with the 1.1.1 snapshot

Adrian


Re: SSLFilter thread safe?

Posted by Trustin Lee <tr...@gmail.com>.
Please try the latest snapshot for 1.1.1:

http://people.apache.org/~trustin/snapshot/

HTH,
Trustin

On 7/13/07, Adrian Sandor <ad...@yahoo.com> wrote:
> Trustin Lee writes:
> > SSLFilter should be thread safe.  If not, it's a bug.
> >
> > Which version of MINA are you using? Could you please provide us how
> > you were able to reproduce the problem?
>
> I think I'm experiencing the same problem, using MINA 1.1.0
> Please download the test code from http://aditsu.net/ssltest.zip
> Run the Server, then the Client; almost every time, the client will die after
> 10-20 seconds with a stack trace like this:
>
> Exception in thread "main" javax.net.ssl.SSLException: bad record MAC
>         at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:166)
>         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1477)
>         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1438)
>         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:781)
>         at
> com.sun.net.ssl.internal.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:677)
>         at com.sun.net.ssl.internal.ssl.AppInputStream.read(AppInputStream.java:75)
>         at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:411)
>         at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453)
>         at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183)
>         at java.io.InputStreamReader.read(InputStreamReader.java:167)
>         at java.io.BufferedReader.fill(BufferedReader.java:136)
>         at java.io.BufferedReader.readLine(BufferedReader.java:299)
>         at java.io.BufferedReader.readLine(BufferedReader.java:362)
>         at ssl.Client.main(Client.java:22)
>
> Indeed, synchronizing session.write seems to work.
> I'd appreciate if this bug could be fixed, and I'll provide any further
> information you may need.
>
> Regards,
> Adrian
>
>


-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6