Skip to content

Commit 7f43503

Browse files
authored
Warn on demand on pad with eos (#851)
1 parent faa90ca commit 7f43503

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Changelog
22

33
## 1.1.2
4-
* Remove 'failed to insert a metric' stalker warning [#849](https://github.com/membraneframework/membrane_core/pull/849)
4+
* Remove 'failed to insert a metric' stalker warning [#849](https://github.com/membraneframework/membrane_core/pull/849)
55

66
## 1.1.1
77
* Fix 'table identifier does not refer to an existing ETS table' error when inserting metrics into the observability ETS. [#835](https://github.com/membraneframework/membrane_core/pull/835)

lib/membrane/core/element/action_handler.ex

+15-1
Original file line numberDiff line numberDiff line change
@@ -229,11 +229,12 @@ defmodule Membrane.Core.Element.ActionHandler do
229229
@impl CallbackHandler
230230
def handle_action(
231231
{:demand, {pad_ref, size}},
232-
_cb,
232+
cb,
233233
_params,
234234
%State{type: type} = state
235235
)
236236
when is_pad_ref(pad_ref) and is_demand_size(size) and type in [:sink, :filter, :endpoint] do
237+
:ok = maybe_warn_on_demand_action(pad_ref, size, cb, state)
237238
delay_supplying_demand(pad_ref, size, state)
238239
end
239240

@@ -481,4 +482,17 @@ defmodule Membrane.Core.Element.ActionHandler do
481482
end
482483

483484
defp handle_outgoing_event(_pad_ref, _event, state), do: state
485+
486+
defp maybe_warn_on_demand_action(pad_ref, demand_size, callback, state) do
487+
if PadModel.get_data!(state, pad_ref, :end_of_stream?) do
488+
Membrane.Logger.warning("""
489+
Action :demand with value #{inspect(demand_size)} for pad #{inspect(pad_ref)} was returned \
490+
from callback #{inspect(callback)}, but stream on this pad has already ended, callback \
491+
c:handle_end_of_stream/3 for this pad has been called and no more buffers will arrive on \
492+
this pad.
493+
""")
494+
end
495+
496+
:ok
497+
end
484498
end

0 commit comments

Comments
 (0)