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

Modify 5s linking timeout constraint #810

Merged
merged 12 commits into from
Jun 3, 2024

Conversation

FelonEkonom
Copy link
Member

Solves #786

@FelonEkonom FelonEkonom added the no-changelog This label has to be added if changes from the PR are not meant to be placed in the CHANGELOG.md label May 23, 2024
@FelonEkonom FelonEkonom requested a review from mat-hek as a code owner May 23, 2024 14:18
@FelonEkonom FelonEkonom force-pushed the modify_5s_linking_constraint branch from 453de6e to 814f10b Compare May 27, 2024 13:33
"Bin pad #{inspect(pad_ref)} wasn't linked internally within timeout. Pad data: #{inspect(pad_data, pretty: true)}"
case Map.fetch(state.linking_timeout_counters, pad_ref) do
{:ok, 1} ->
Map.update!(state, :linking_timeout_counters, &Map.delete(&1, pad_ref))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remember we talked about something similar, but couldn't we store the reference to the timer in pad_data and compare it when the timeout arrives?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not a good idea, this approach generates some weird race conditions and it's implementation would be far more complex. I don't se any pros of it, only cons

Copy link
Member Author

@FelonEkonom FelonEkonom May 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conclusion from our last talk was that we don't want to do this

@@ -353,6 +353,7 @@ defmodule Membrane.Integration.LinkingTest do
Membrane.Pipeline.terminate(pipeline)
end

@tag :xd
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xd

@FelonEkonom FelonEkonom requested a review from mat-hek May 28, 2024 08:36
Copy link
Member

@mat-hek mat-hek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we spoke, the best approach would be to create the pad data earlier and store the timer reference there

@FelonEkonom FelonEkonom requested a review from mat-hek May 31, 2024 12:59
Comment on lines 328 to 332
with {:error, :unknown_pad} <- PadModel.assert_instance(state, pad_ref) do
PadController.init_pad_data(pad_ref, state)
else
:ok -> state
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a case would look better IMO

@@ -50,8 +49,7 @@ defmodule Membrane.Core.Bin.PadController do
state =
case PadModel.get_data(state, pad_ref) do
{:error, :unknown_pad} ->
init_pad_data(pad_ref, pad_info, state)
|> Map.update!(:pad_refs, &[pad_ref | &1])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove pad_refs? In case you forgot, it was added by yourself in this PR: #641 :P

Copy link
Member Author

@FelonEkonom FelonEkonom Jun 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I didn't remember it 🙈 There was 1 place, where the pad was removed from pads_data but not from pad_refs, so without this PR value stored under this field may be incorrec. I saw that nothing relies on the value of this field. I guess the reason of this field was to have more readable logs, but has anybody ever looked at it in the logs to debug something?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't, but hard to say in general. I have the following idea:

  • call it inspect_pad_refs and assign to it a function that will accept the state and return the pad refs
  • in Membrane.Core.Inspect, if a field starts with inspect_, we'll call the function in it instead of printing it directly

I don't like it much, but should be better than what we have. Otherwise I'd just remove this field, but it should be removed from the element as well

Copy link
Member Author

@FelonEkonom FelonEkonom Jun 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is no such field in the element state

@FelonEkonom FelonEkonom requested a review from mat-hek June 3, 2024 12:31
@FelonEkonom FelonEkonom merged commit 14d8018 into master Jun 3, 2024
5 of 6 checks passed
@FelonEkonom FelonEkonom deleted the modify_5s_linking_constraint branch June 3, 2024 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-changelog This label has to be added if changes from the PR are not meant to be placed in the CHANGELOG.md
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants