Skip to content

Commit

Permalink
Swallow ObjectDisposedException (#2844)
Browse files Browse the repository at this point in the history
  • Loading branch information
reyang authored Feb 2, 2022
1 parent 102ac27 commit 1b8599b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/OpenTelemetry/BatchExportProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ private void ExporterProc()
}
catch (ObjectDisposedException)
{
// the exporter is somehow disposed before the worker thread could finish its job
return;
}
}
Expand All @@ -251,8 +252,16 @@ private void ExporterProc()
this.exporter.Export(batch);
}

this.dataExportedNotification.Set();
this.dataExportedNotification.Reset();
try
{
this.dataExportedNotification.Set();
this.dataExportedNotification.Reset();
}
catch (ObjectDisposedException)
{
// the exporter is somehow disposed before the worker thread could finish its job
return;
}
}

if (this.circularBuffer.RemovedCount >= this.shutdownDrainTarget)
Expand Down
4 changes: 4 additions & 0 deletions src/OpenTelemetry/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
* Fail-fast when using AddView with guaranteed conflict.
([2751](https://github.com/open-telemetry/opentelemetry-dotnet/issues/2751))

* Swallow `ObjectDisposedException` from the `BatchExportProcessor` worker
thread.
([2844](https://github.com/open-telemetry/opentelemetry-dotnet/issues/2844))

## 1.2.0-rc1

Released 2021-Nov-29
Expand Down

0 comments on commit 1b8599b

Please sign in to comment.