Comments (7)
Found the issue here - the problem was that SpanEnvelope
s were accidentally being logged, rather than their underlying message contents
from phobos-issues.
Figured out this issue, finally:
public sealed class AwaitActor : ReceiveActor
{
private readonly IActorRef _testActor;
private readonly IActorRef _echoActor;
public AwaitActor(IActorRef testActor, IActorRef echoActor)
{
_testActor = testActor;
_echoActor = echoActor;
ReceiveAsync<int>(async i =>
{
using var scope = Context.GetInstrumentation().Tracer
.BuildSpan("FireAsync")
.IgnoreActiveSpan()
.StartActive(true);
var result = await _echoActor.Ask<int>(i, TimeSpan.FromSeconds(3));
_testActor.Tell(result);
});
}
}
[Fact(DisplayName = "ScopeLeak: awaited operations that don't use ActiveSpan should not leak")]
public async Task Bugfix19()
{
// arrange
var echoActor = Sys.ActorOf(EchoActor.Props(this), "echo");
var awaitActor = Sys.ActorOf(Props.Create(() => new AwaitActor(TestActor, echoActor)), "await");
// act
awaitActor.Tell(1);
ExpectMsg(1);
// assert
await WaitForTracesToStabilize();
var finishedSpans = FinishedSpans;
var allSpans = LeakTracking.AllScopes;
allSpans.Count.Should().Be(finishedSpans.Count);
}
Not sure if the issue is the await
or the IgnoreActiveSpan()
but I should be able to find out quickly.
from phobos-issues.
The above unit test fails with the following:
Expected allSpans.Count to be 2, but found 3.
from phobos-issues.
It's definitely the await
- or more accurately, it's the async
state machine. This also causes the test to fail:
ReceiveAsync<int>(async i =>
{
using var scope = Context.GetInstrumentation().Tracer
.BuildSpan("FireAsync")
.IgnoreActiveSpan()
.StartActive(true);
var result = _echoActor.Ask<int>(i, TimeSpan.FromSeconds(3)).Result;
_testActor.Tell(result);
});
from phobos-issues.
Looks like we might have a fix for this....
Before
After
from phobos-issues.
Simplified this:
public sealed class AwaitActor : ReceiveActor
{
private readonly IActorRef _testActor;
private readonly IActorRef _echoActor;
public AwaitActor(IActorRef testActor, IActorRef echoActor)
{
_testActor = testActor;
_echoActor = echoActor;
ReceiveAsync<int>(async i =>
{
using var scope = Context.GetInstrumentation().Tracer
.BuildSpan("FireAsync")
.IgnoreActiveSpan()
.StartActive(true);
var result = await _echoActor.Ask<int>(i, TimeSpan.FromSeconds(3)).ConfigureAwait(false);
_testActor.Tell(result);
});
}
}
[Fact(DisplayName = "ScopeLeak: awaited operations that don't use ActiveSpan should not leak")]
public async Task Bugfix19()
{
// arrange
var echoActor = Sys.ActorOf(EchoActor.Props(this), "echo");
var awaitActor = Sys.ActorOf(Props.Create(() => new AwaitActor(TestActor, echoActor)), "await");
// act
awaitActor.Tell(1);
ExpectMsg(1);
// assert
await WaitForTracesToStabilize();
LeakTracking.AllScopes.All(x => x.WasDisposed).Should().BeTrue();
}
from phobos-issues.
Final version of this graph:
from phobos-issues.
Related Issues (20)
- Attempt to create a root span results in a child span HOT 7
- How to prevent incoming messages from forming an endless span hierarchy? HOT 7
- Serializer exception when using Phobos and Akka.Hosting HOT 16
- Custom span creation with Phobos 2.0.3-beta1 HOT 16
- Lots of noise in logging when using cluster sharding HOT 6
- Span is created for akka.actor.ask even when create-trace-upon-receive is set to off HOT 5
- UsableContext value becomes NULL in the middle of processing chain HOT 2
- Stashing message may result in reset UsableContext HOT 16
- Create a gauge for all alive actors of each type in any given `ActorSystem` HOT 1
- How to filter `Ask<T>` out of traces? HOT 6
- Manually created trace spans don't seem to flow across the cluster HOT 14
- When spans are created manually messages from cluster singleton break trace transactions HOT 19
- Does sending a message to sender from Persist/PersistAsync break trace transaction? HOT 10
- Can auto-generated shard messages be omitted from a trace transaction with manual span management? HOT 18
- Need to make all Akka.Cluster.Sharding infrastructure transparent in traces HOT 12
- Missing `unit` for all metrics received from Phobos in Prometheus HOT 16
- `Tracer.CurrentSpan` and `PhobosActorContext.ActiveSpan` should be the same when actor is processing message, but currently are not
- Add support for tracking Akka.Cluster.Sharding `ShardRegion` metrics HOT 1
- Phobos `DeadLetter` logging HOT 1
- `Ask<T>` tracing does not properly follow `Tracer.ActiveSpan` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phobos-issues.