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

'public static final' exceptions render stack trace useless #352

Closed
miguelnmiranda opened this issue Apr 27, 2015 · 3 comments
Closed

'public static final' exceptions render stack trace useless #352

miguelnmiranda opened this issue Apr 27, 2015 · 3 comments
Milestone

Comments

@miguelnmiranda
Copy link

In ConnectionPoolImpl.java PoolExhaustedException is 'stored' as a static final field.

public static final PoolExhaustedException POOL_EXHAUSTED_EXCEPTION = new PoolExhaustedException("Rx Connection Pool exhausted.");

This means that the stack trace displayed when you throw the exception refers to when ConnectionPoolImpl was first instantiated and not to the actual occurrence of the exception.
Is this a consequence of using Rx? Is there a way of getting more info around the state of the system when the exception occurred?

@miguelnmiranda miguelnmiranda changed the title 'public static final' exceptions render stack trace useless 'public static final' exceptions renders stack trace useless Apr 27, 2015
@miguelnmiranda miguelnmiranda changed the title 'public static final' exceptions renders stack trace useless 'public static final' exceptions render stack trace useless Apr 27, 2015
@NiteshKant
Copy link
Member

@miguelnmiranda It isn't really a consequence of using Rx but the validity/usefulness of stacktrace in an asynchronous application and (possibly premature) optimization of reducing the overhead of creating a stacktrace when it has limited meaning.

Is there a way of getting more info around the state of the system when the exception occurred?

What other information are you looking for?

@miguelnmiranda
Copy link
Author

@NiteshKant You are right, the meaning of a stack trace in an asynchronous application is very limited.
And my question was put out there out of frustration for not having any context of what the system looked like when the exception was 'thrown'.

What information is relevant really depends on the context. On my case it end up being a memory problem, or lack of it. But what bothered me at the time was that although the rest of the application I am working in is asynchronous it is structured in a different way where stack traces still makes some sense, and so when debugging your mindset is.. lets follow that! making us believe POOL_EXHAUSTED_EXCEPTION was an initialisation problem. Only after looking into RxNetty source code we realised that assumption was wrong.

Yours is a tricky question. Having a mechanism that would allow to decide what you want to see when such an exceptional event occurs would be nice. That being said, what is relevant will vary, and throwing exceptions might make sense in cases where you have a considerable amount of logic inside an event manipulator.

@NiteshKant
Copy link
Member

@miguelnmiranda I will change this instance of cached exception to be created on demand. I agree it is misleading, whenever caching exception (when required), the stacktraces should atleast be truncated so that it is not confusing.

@NiteshKant NiteshKant added this to the 0.4.9 milestone May 5, 2015
NiteshKant added a commit that referenced this issue May 6, 2015
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

No branches or pull requests

2 participants