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

Don't process ejected tracks #11334

Merged
merged 1 commit into from
Mar 8, 2023
Merged

Don't process ejected tracks #11334

merged 1 commit into from
Mar 8, 2023

Conversation

daschuer
Copy link
Member

@daschuer daschuer commented Mar 6, 2023

This fixes the hard to reproduce crash reported in #11257

Comment on lines +1143 to +1144
bool hasStableTrack = m_pTrackLoaded->toBool() && m_iTrackLoading.loadAcquire() == 0;
if (hasStableTrack && m_pause.tryLock()) {
Copy link
Member

Choose a reason for hiding this comment

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

This might fix the issue, though my guess is that the problem stems from a memory access ordering issue. Have you tried refactoring m_iTrackLoading to a std::atomic<bool> and then use memory_order::seq_cst accesses everywhere?

Copy link
Member Author

Choose a reason for hiding this comment

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

The issue fortunately is pretty clear.
We have identified dff90d2
as the first failing commit.
I have introduced an extra engine callback where the track is already ejected. m_pTrackLoaded is false than.
This is required to clear the effect buffers.

Calling processTrackLocked() without a track is obviously wrong.
I have not found out where exactly the bad memory access happens. Valgrind reveals only the symptom inside Soundtouch.

Copy link
Member

Choose a reason for hiding this comment

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

I see that makes sense.

Copy link
Member

Choose a reason for hiding this comment

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

Are you sure that the CO is not subject to data-races?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, because m_pTrackLoaded and m_iTrackLoading are atomic and only changed under the m_pause lock.

@daschuer
Copy link
Member Author

daschuer commented Mar 7, 2023

@RadioDM has confirmed that his bug is fixed 🎉

@daschuer
Copy link
Member Author

daschuer commented Mar 7, 2023

I have rebated onto upstream/2.4 to have #11333 included.

@Swiftb0y Swiftb0y merged commit 96c5b49 into mixxxdj:2.4 Mar 8, 2023
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.

2 participants