Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix StackOverflow in ThrowableProxy #300

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

huguesb
Copy link

@huguesb huguesb commented Jan 26, 2016

It is possible for the cause of a suppressed exception to be the
exception it is attached to. Gracefully handle that case by
unsetting the cause to break and avoid a StackOverflow.

Sample stack trace showing the issue:

javax.net.ssl.SSLException: SSL peer shut down incorrectly
        at sun.security.ssl.InputRecord.readV3Record(InputRecord.java:596)
        at sun.security.ssl.InputRecord.read(InputRecord.java:532)
        at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:961)
        at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:918)
        at sun.security.ssl.AppInputStream.read(AppInputStream.java:105)
        at java.io.BufferedInputStream.read1(BufferedInputStream.java:284)
        at java.io.BufferedInputStream.read(BufferedInputStream.java:345)
        at sun.net.www.MeteredStream.read(MeteredStream.java:134)
        at java.io.FilterInputStream.read(FilterInputStream.java:133)
        at sun.net.www.protocol.http.HttpURLConnection.read(HttpURLConnection.java:3335)
        at sun.net.www.protocol.http.HttpURLConnection.read(HttpURLConnection.java:3328)
        ...
        Suppressed: javax.net.ssl.SSLException: Connection has been shutdown: javax.net.ssl.SSLException: SSL peer shut down incorrectly
                at sun.security.ssl.SSLSocketImpl.checkEOF(SSLSocketImpl.java:1529)
                at sun.security.ssl.AppInputStream.available(AppInputStream.java:60)
                at java.io.BufferedInputStream.available(BufferedInputStream.java:410)
                at sun.net.www.MeteredStream.available(MeteredStream.java:170)
                at sun.net.www.http.KeepAliveStream.close(KeepAliveStream.java:85)
                at java.io.FilterInputStream.close(FilterInputStream.java:181)
                at sun.net.www.protocol.http.HttpURLConnection.close(HttpURLConnection.java:3408)
                ...

It is possible for the cause of a suppressed exception to be the
exception it is attached to. Gracefully handle that case by
unsetting the cause to break and avoid a StackOverflow.

Sample stack trace showing the issue:

javax.net.ssl.SSLException: SSL peer shut down incorrectly
        at sun.security.ssl.InputRecord.readV3Record(InputRecord.java:596)
        at sun.security.ssl.InputRecord.read(InputRecord.java:532)
        at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:961)
        at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:918)
        at sun.security.ssl.AppInputStream.read(AppInputStream.java:105)
        at java.io.BufferedInputStream.read1(BufferedInputStream.java:284)
        at java.io.BufferedInputStream.read(BufferedInputStream.java:345)
        at sun.net.www.MeteredStream.read(MeteredStream.java:134)
        at java.io.FilterInputStream.read(FilterInputStream.java:133)
        at sun.net.www.protocol.http.HttpURLConnection.read(HttpURLConnection.java:3335)
        at sun.net.www.protocol.http.HttpURLConnection.read(HttpURLConnection.java:3328)
        ...
        Suppressed: javax.net.ssl.SSLException: Connection has been shutdown: javax.net.ssl.SSLException: SSL peer shut down incorrectly
                at sun.security.ssl.SSLSocketImpl.checkEOF(SSLSocketImpl.java:1529)
                at sun.security.ssl.AppInputStream.available(AppInputStream.java:60)
                at java.io.BufferedInputStream.available(BufferedInputStream.java:410)
                at sun.net.www.MeteredStream.available(MeteredStream.java:170)
                at sun.net.www.http.KeepAliveStream.close(KeepAliveStream.java:85)
                at java.io.FilterInputStream.close(FilterInputStream.java:181)
                at sun.net.www.protocol.http.HttpURLConnection.close(HttpURLConnection.java:3408)
                ...
public void suppressedCyclic() throws InvocationTargetException, IllegalAccessException
{
assumeTrue(TeztHelper.suppressedSupported()); // only execute on Java 7, would work anyway but doesn't make sense.
Exception ex = null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jms72
Copy link

jms72 commented Jul 5, 2024

See also #830

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants