-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Don't process ejected tracks #11334
Conversation
bool hasStableTrack = m_pTrackLoaded->toBool() && m_iTrackLoading.loadAcquire() == 0; | ||
if (hasStableTrack && m_pause.tryLock()) { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
@RadioDM has confirmed that his bug is fixed 🎉 |
I have rebated onto upstream/2.4 to have #11333 included. |
This fixes the hard to reproduce crash reported in #11257