Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions apps/opentelemetry/src/otel_batch_processor.erl
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,14 @@ terminate(_Reason, _State, #data{exporter=Exporter,
%% `export' is used to perform a blocking export
_ = export(Exporter, Resource, CurrentTable),

%% Synchronously shut the exporter down before this gen_statem exits.
%% Linked transport resources (e.g. grpcbox channels) clean up via
%% gproc in their own `terminate'; if we just return here, those
%% terminations race with the shutdown of the `grpcbox' application
%% itself and crash with "the table identifier does not refer to an
%% existing ETS table". See open-telemetry/opentelemetry-erlang#868.
_ = otel_exporter:shutdown(Exporter),

ok.

%%
Expand Down
7 changes: 6 additions & 1 deletion apps/opentelemetry/src/otel_simple_processor.erl
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,12 @@ handle_event_(_, _, _, _) ->
keep_state_and_data.

%% @private
terminate(_, _, _Data) ->
terminate(_, _, #data{exporter=Exporter}) ->
%% Synchronously shut the exporter down before this gen_statem exits,
%% mirroring `otel_batch_processor:terminate/3'. See #868 — linked
%% grpcbox channels crash on a missing `gproc' ETS table when they
%% terminate after the `grpcbox' application is already gone.
_ = otel_exporter:shutdown(Exporter),
ok.

%%
Expand Down