Skip to content

Fix false positive "First sound has been moved!" warnings - #16054

Merged
acolombier merged 3 commits into
mixxxdj:2.5from
daschuer:valrind_firstsound
Feb 27, 2026
Merged

Fix false positive "First sound has been moved!" warnings#16054
acolombier merged 3 commits into
mixxxdj:2.5from
daschuer:valrind_firstsound

Conversation

@daschuer

Copy link
Copy Markdown
Member

This may happen in case of cache misses. The issue was cough by valgrind:

==9950== Thread 22 CachingReaderWor:
==9950== Conditional jump or move depends on uninitialised value(s)
==9950==    at 0x4D49B12: __find_if<__gnu_cxx::__normal_iterator<float const*, std::span<float const> >, __gnu_cxx::__ops::_Iter_pred<(anonymous namespace)::first_sound<__gnu_cxx::__normal_iterator<float const*, std::span<float const> > >(__gnu_cxx::__normal_iterator<float const*, std::span<float const> >, __gnu_cxx::__normal_iterator<float const*, std::span<float const> >)::<lambda(auto:53)> > > (stl_algobase.h:2094)
==9950==    by 0x4D49B12: __find_if<__gnu_cxx::__normal_iterator<float const*, std::span<float const> >, __gnu_cxx::__ops::_Iter_pred<(anonymous namespace)::first_sound<__gnu_cxx::__normal_iterator<float const*, std::span<float const> > >(__gnu_cxx::__normal_iterator<float const*, std::span<float const> >, __gnu_cxx::__normal_iterator<float const*, std::span<float const> >)::<lambda(auto:53)> > > (stl_algobase.h:2114)
==9950==    by 0x4D49B12: find_if<__gnu_cxx::__normal_iterator<float const*, std::span<float const> >, (anonymous namespace)::first_sound<__gnu_cxx::__normal_iterator<float const*, std::span<float const> > >(__gnu_cxx::__normal_iterator<float const*, std::span<float const> >, __gnu_cxx::__normal_iterator<float const*, std::span<float const> >)::<lambda(auto:53)> > (stl_algo.h:3910)
==9950==    by 0x4D49B12: first_sound<__gnu_cxx::__normal_iterator<float const*, std::span<float const> > > (analyzersilence.cpp:28)
==9950==    by 0x4D49B12: AnalyzerSilence::findFirstSoundInChunk(std::span<float const, 18446744073709551615ul>) (analyzersilence.cpp:63)
==9950==    by 0x4D4A00B: AnalyzerSilence::verifyFirstSound(std::span<float const, 18446744073709551615ul>, mixxx::audio::FramePos, mixxx::audio::ChannelCount) (analyzersilence.cpp:78)
==9950==    by 0x4DFB328: _firstCachingReaderWorker::verifyFirstSound(CachingReaderChunk const*, mixxx::audio::ChannelCount) (cachingreaderworker.cpp:326)
==9950==    by 0x4DFBA9A: CachingReaderWorker::processReadRequest(CachingReaderChunkReadRequest const&) (cachingreaderworker.cpp:87)
==9950==    by 0x4DFE980: CachingReaderWorker::run() (cachingreaderworker.cpp:151)
==9950==    by 0xB0CCFCE: operator() (qthread_unix.cpp:356)
==9950==    by 0xB0CCFCE: terminate_on_exception<QThreadPrivate::start(void*)::<lambda()> > (qthread_unix.cpp:292)
==9950==    by 0xB0CCFCE: QThreadPrivate::start(void*) (qthread_unix.cpp:315)
==9950==    by 0xB800AC2: start_thread (pthread_create.c:442)
==9950==    by 0xB891A83: clone (clone.S:100)
==9950== 
``

@daschuer daschuer added this to the 2.5.5 milestone Feb 27, 2026
Comment thread src/engine/cachingreader/cachingreaderworker.cpp
pChunk->readBufferedSampleFrames(
sampleBuffer, probeFrameIndexRange);
VERIFY_OR_DEBUG_ASSERT(bufferedFrameIndexRange == probeFrameIndexRange) {
return;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As I understand, this early return would handle the case where the reader is unable to read the file (e.g IO issues). Since this could technically happen on a release build, could you put a qWarning message? My hopes is that there could be other messages in the log, related to readBufferedSampleFrames failing, but just to be extra sure, and since the early returns happen here, it would be safer to have log message attached to the abortion.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This can no longer happen. That's just an assertion for this assumption. The actual fix has been done via
if (status == CHUNK_READ_SUCCESS) { above. I can add the additional basic warning anyway.
The actual warning about this situation is already in place.
"Failed to read chunk samples for frame index range:"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I run into this assertion with a very short ogg track (1.74 s) I use for testing.
Also, when I put this track on repeat and play, it runs a few times, then stops at the end.

debug [CachingReaderWorker 1] SoundSourceProxy - SoundSourceProvider "Xiph.org OggVorbis" created a SoundSource for file "/mu/TickTack.ogg" of type "ogg"
debug [Engine] RubberBandWrapper::setup - using 2 channel(s) per task
critical [CachingReaderWorker 1] DEBUG ASSERT: "bufferedFrameIndexRange == probeFrameIndexRange" in function void CachingReaderWorker::verifyFirstSound(const CachingReaderChunk*, mixxx::audio::ChannelCount) at ./src/engine/cachingreader/cachingreaderworker.cpp:332
warning [CachingReaderWorker 1] skipping verifyFirstSound()

ffprobe finds no issues.
Is this a Mixxx issue or something else wrong with that file?


When I play a copy of that file, it passes the assertion but still fails to repeat (stops after ~3 rounds)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Interesting. Can you file an issue and append the file or send it to me? Than will have a look.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@daschuer

Copy link
Copy Markdown
Member Author

Done.

@acolombier acolombier left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks!

@acolombier
acolombier merged commit cd76eba into mixxxdj:2.5 Feb 27, 2026
15 checks passed
@github-project-automation github-project-automation Bot moved this to In progress in Releases Mar 5, 2026
@github-project-automation github-project-automation Bot moved this from In progress to Done in Releases Mar 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants