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

Remove redundant messaging #218

Open
wants to merge 2 commits into
base: rawhide
Choose a base branch
from

Conversation

matejak
Copy link
Contributor

@matejak matejak commented Oct 11, 2022

The send_ready already performs what the removed call could aim to accomplish.

Sending those two messages in a quick succession can lead to crashes of Anaconda.

The send_ready already performs what the removed call
could aim to accomplish.
@matejak
Copy link
Contributor Author

matejak commented Oct 11, 2022

@poncovka could you please be so kind and check it out? We suffer from crashes on RHEL8 and RHEL9 as well, would this fix be applicable on those platforms?

@matejak matejak added port-RHEL8 Port this PR to the rhel8-branch port-RHEL9 Port this PR to the rhel9-branch labels Oct 11, 2022
@jan-cerny
Copy link
Member

When the redundant messaging happens? What steps should I perform to trigger it and reproduce? What steps do you perform to test this PR?

@matejak
Copy link
Contributor Author

matejak commented Oct 13, 2022

Sorry for omitting the BZ: https://bugzilla.redhat.com/show_bug.cgi?id=2000998

@poncovka
Copy link
Contributor

Hi, this fix seems to be harmless and should be applied in any case. However, I think it just lowering the probability of the error. It doesn't fix it.

What (I think) happens:

  • The Fetch button is clicked.
  • An OSCAPguiWaitForDataFetchThread thread is created.
  • Later the thread sets self._fetching to False and runs the code from the set_ready decorator.
  • The Fetch button is clicked again.
  • Since self._fetching is False, a new thread will be created.
  • However, the previous thread can still run at this point.
  • In that case, Anaconda will raise the "a thread with the same name already running" error.

My theory: When you removed a command from the set_ready decorator, the window between setting self._fetching to False and actually stopping the thread became smaller and harder to hit. If you put there some sleep, it should start to happen again.

Suggested fix:

  • Remove self._fetching and self._fetch_flag_lock.
  • Use threadMgr.get to check if there is some fetching going on.
if threadMgr.get('OSCAPguiWaitForDataFetchThread'):
   # Fetching in progress.
   ...

@matejak
Copy link
Contributor Author

matejak commented Oct 13, 2022

Thanks for the analysis, so in another words the thread doesn't end right after the _fetching is set to False, but it is guaranteed that if a thread of a known name exists, we are still fetching stuff.
I would drop the _fetching only as a part of a larger-scale refactoring, as touching these things without being aware of the full picture basically is asking for trouble, but extending the definition of "not fetching at the moment" seems as a really good, and perfectly doable idea.

It is not completely practical to rely on locks alone,
and we can elliminate some corner cases by looking
whether well-known UI threads exist.
@scrutinizer-notifier
Copy link

The inspection completed: 1 updated code elements

@poncovka
Copy link
Contributor

Thanks for the analysis, so in another words the thread doesn't end right after the _fetching is set to False, but it is guaranteed that if a thread of a known name exists, we are still fetching stuff. I would drop the _fetching only as a part of a larger-scale refactoring, as touching these things without being aware of the full picture basically is asking for trouble, but extending the definition of "not fetching at the moment" seems as a really good, and perfectly doable idea.

I think it could prevent more issues in the future, but that's up to you. Looks good to me!

@matejak matejak removed the port-RHEL8 Port this PR to the rhel8-branch label Oct 17, 2022
@matejak matejak mentioned this pull request Nov 8, 2022
@matejak matejak removed the port-RHEL9 Port this PR to the rhel9-branch label Nov 8, 2022
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.

None yet

4 participants