Skip to content

Remove previously deprecated methods and make Continuation static#1419

Merged
tylerbenson merged 3 commits into
masterfrom
tyler/make-continuation-static
May 13, 2020
Merged

Remove previously deprecated methods and make Continuation static#1419
tylerbenson merged 3 commits into
masterfrom
tyler/make-continuation-static

Conversation

@tylerbenson
Copy link
Copy Markdown
Contributor

@tylerbenson tylerbenson commented Apr 30, 2020

finishSpanOnClose will still work at the OpenTracing API level, except for ScopeManger.active() which returns a wrapped scope without the original finishSpanOnClose boolean.

The motivation here is to prevent unconstrained memory usage growth resulting from a chain of ContinuableScope/Continuation references like so:

ContinuableScope scope = tracer.scopeManager().active();
Continuation continuation = scope.capture();
scope.close();
while(true){
  try(Scope scope = continuation.activate()) {
    continuation = scope.capture();
  }
}

Prior to this change the above would result in an OOM error. Now, the Continuation shouldn't hold on to the previous Scope which will allow it to be GC'd.

This PR should go out in the release following #1424.

@dougqh
Copy link
Copy Markdown
Contributor

dougqh commented May 1, 2020

Can we put a bit more detail in the PR description as to what the problem was and how this addresses it?

@tylerbenson tylerbenson changed the title Attempt at breaking reference chain of Continuations and ContinuableScopes Remove previously deprecated methods and make Continuation static May 5, 2020
@tylerbenson tylerbenson force-pushed the tyler/make-continuation-static branch 5 times, most recently from 15f5525 to 855425d Compare May 12, 2020 14:10
@tylerbenson tylerbenson marked this pull request as ready for review May 13, 2020 14:07
@tylerbenson tylerbenson requested a review from a team as a code owner May 13, 2020 14:07
`finishSpanOnClose` will still work at the OpenTracing API level, except for `ScopeManger.active()` which returns a wrapped scope without the original `finishSpanOnClose` boolean.

The motivation here is to prevent unconstrained memory usage growth resulting from a chain of `ContinuableScope`/`Continuation` references like so:

```java
ContinuableScope scope = tracer.scopeManager().active();
Continuation continuation = scope.capture();
scope.close();
while(true){
  try(Scope scope = continuation.activate()) {
    continuation = scope.capture();
  }
}
```
Prior to this change the above would result in an OOM error. Now, the Continuation shouldn't hold on to the previous Scope which will allow it to be GC'd.
`test continuation doesn't have hard reference on scope` is still failing, so we need to figure out where the hard reference is.
@tylerbenson tylerbenson force-pushed the tyler/make-continuation-static branch from 2add3ef to 17ce99b Compare May 13, 2020 14:09
Copy link
Copy Markdown
Contributor

@richardstartin richardstartin left a comment

Choose a reason for hiding this comment

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

Is there more to this than removing implicit references to outer classes? If not, looks good.

@tylerbenson tylerbenson merged commit 0cbf245 into master May 13, 2020
@tylerbenson tylerbenson deleted the tyler/make-continuation-static branch May 13, 2020 16:51
@github-actions github-actions Bot added this to the 0.52.0 milestone May 13, 2020
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