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 bug where it was attempting to use a null parent span #314

Merged
merged 1 commit into from
Sep 13, 2024

Conversation

matt-richardson
Copy link
Contributor

Background

While investigating logs, i spotted:

[2024-09-13 01:50:49,249]  ERROR - y.server.TeamCityBuildListener - {teamcity.build.id=14082131, teamcity.root.build.id=14082074} - Exception in Build Finish caused by: java.lang.NullPointerException: Cannot invoke "io.opentelemetry.context.ImplicitContextKeyed.storeInContext(io.opentelemetry.context.Context)" because "value" is nullnull, with message: Cannot invoke "io.opentelemetry.context.ImplicitContextKeyed.storeInContext(io.opentelemetry.context.Context)" because "value" is null, and stacktrace: [io.opentelemetry.context.Context.with(Context.java:174), com.octopus.teamcity.opentelemetry.server.helpers.OTELHelperImpl.createTransientSpan(OTELHelperImpl.java:68), com.octopus.teamcity.opentelemetry.server.TeamCityBuildListener.createBlockMessageSpan(TeamCityBuildListener.java:349), com.octopus.teamcity.opentelemetry.server.TeamCityBuildListener.createBuildStepSpans(TeamCityBuildListener.java:324), com.octopus.teamcity.opentelemetry.server.TeamCityBuildListener.buildFinishedOrInterrupted(TeamCityBuildListener.java:189), com.octopus.teamcity.opentelemetry.server.TeamCityBuildListener.buildInterrupted(TeamCityBuildListener.java:170), jdk.internal.reflect.GeneratedMethodAccessor543.invoke(Unknown Source), java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43), java.base/java.lang.reflect.Method.invoke(Method.java:568), jetbrains.buildServer.util.EventDispatcher.invokeListeners(EventDispatcher.java:157), jetbrains.buildServer.util.EventDispatcher.lambda$dispatch$0(EventDispatcher.java:134), jetbrains.buildServer.util.NamedThreadFactory.executeWithNewThreadName(NamedThreadFactory.java:76), jetbrains.buildServer.util.EventDispatcher.dispatch(EventDispatcher.java:134), jetbrains.buildServer.serverSide.ServerSideEventDispatcher.superDispatch(ServerSideEventDispatcher.java:6), jetbrains.buildServer.serverSide.ServerSideEventDispatcher.lambda$dispatch$0(ServerSideEventDispatcher.java:3), jetbrains.buildServer.serverSide.impl.auth.SecurityContextImpl.runAs(SecurityContextImpl.java:5), jetbrains.buildServer.serverSide.impl.auth.SecurityContextImpl.runAsUnchecked(SecurityContextImpl.java:25), jetbrains.buildServer.serverSide.impl.auth.SecurityContextImpl.runAsSystemUnchecked(SecurityContextImpl.java:53), jetbrains.buildServer.serverSide.ServerSideEventDispatcher.dispatch(ServerSideEventDispatcher.java:12), jetbrains.buildServer.util.EventDispatcher$2.invoke(EventDispatcher.java:82), jdk.proxy3/jdk.proxy3.$Proxy46.buildInterrupted(Unknown Source), jetbrains.buildServer.serverSide.impl.BaseRunningBuild.finishWithPatchedTreadName(BaseRunningBuild.java:274), jetbrains.buildServer.serverSide.impl.BaseRunningBuild.finish(BaseRunningBuild.java:100), java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804), java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136), java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635), java.base/java.lang.Thread.run(Thread.java:833)]

Results

Looks like it was possible to get a null parent span, which likely would cause a bunch of pain.

I've also added better logging around the main entry points, so errors will go into the proper log file

How to review this PR

Pre-requisites

  • I have considered informing or consulting the right people
  • I have considered appropriate testing for my change.

@matt-richardson matt-richardson requested a review from a team as a code owner September 13, 2024 04:15
@matt-richardson matt-richardson merged commit 6ffc8f6 into main Sep 13, 2024
2 checks passed
@matt-richardson matt-richardson deleted the mattr/rsb/fix-null-span branch September 13, 2024 04:21
@matt-richardson
Copy link
Contributor Author

[sc-87109]

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.

2 participants