Deallocations causing real-time issues in UniformSourceIterator
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- rust
- Ambito
- audio-video-rtc
Direzione di ricerca
Read src/source/uniform.rs around UniformSourceIterator::next and src/conversions/sample_rate.rs around SampleRateConverter::into_inner; the issue links the relevant lines and includes an RT-sanitizer stack trace. Trace why the iterator drops and rebuilds its inner source during next, then determine how that behavior can avoid deallocation in real-time context. Done means the reported unsafe free no longer occurs during real-time iteration.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
While reviewing real-time issues in the source code of a custom Source, which uses UniformSourceIterator, RT-sanitizer noticed the following call to free, which is not real-time safe:
==3137==ERROR: RealtimeSanitizer: unsafe-library-call
Intercepted call to real-time unsafe function `free` in real-time context!
#0 0x558ee21b2218 in free /home/runner/work/rtsan-libs/rtsan-libs/llvm-project/compiler-rt/lib/rtsan/rtsan_interceptors_posix.cpp:781:36
#1 0x558ee3f3f462 in _$LT$alloc..raw_vec..RawVec$LT$T$C$A$GT$$u20$as$u20$core..ops..drop..Drop$GT$::drop::hb7b789cbf687a464 /home/lino/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/raw_vec/mod.rs:406:18
#2 0x558ee3f0a31a in core::ptr::drop_in_place$LT$alloc..raw_vec..RawVec$LT$f32$GT$$GT$::hbbace72dc3778dc1 /home/lino/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:524:1
#3 0x558ee3f09f43 in core::ptr::drop_in_place$LT$alloc..vec..Vec$LT$f32$GT$$GT$::ha086ab91020cee54 /home/lino/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:524:1
#4 0x558ee2192d9a in rodio::conversions::sample_rate::SampleRateConverter$LT$I$GT$::into_inner::h1bd55bdb7682e840 /home/lino/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rodio-0.21.1/src/conversions/sample_rate.rs:96:5
#5 0x558ee204f660 in _$LT$rodio..source..uniform..UniformSourceIterator$LT$I$GT$$u20$as$u20$core..iter..traits..iterator..Iterator$GT$::next::ha02484dbde2a47d6 /home/lino/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rodio-0.21.1/src/source/uniform.rs:82:21
#6 0x558ee2081e56 in _$LT$rodio_scheduler..Scheduler$LT$I$GT$$u20$as$u20$core..iter..traits..iterator..Iterator$GT$::next::haca8445718b4f9eb /home/lino/prj/coop-editor/rodio_scheduler/src/lib.rs:404:28
(The callstack then continues a bit further, omitted for clarity...)
SUMMARY: RealtimeSanitizer: unsafe-library-call /home/lino/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/raw_vec/mod.rs:406:18 in _$LT$alloc..raw_vec..RawVec$LT$T$C$A$GT$$u20$as$u20$core..ops..drop..Drop$GT$::drop::hb7b789cbf687a464
I believe this is caused by the inner source of the UniformSourceIterator being dropped/taken and then bootstrapped again inside the body of UniformSourceIterator::next:
https://github.com/RustAudio/rodio/blob/47dab16f79f02fe1c327a89c814c3e3f8498647b/src/source/uniform.rs#L82-L85
However, this behaviour dates back to at least 2015 from the history I've seen.
Is there a reason behind this design? Ideally I'd like to send a PR fixing it, but I would need some pointers first.
- Lingua principale
- Rust
- Stelle
- 2.5k
- Fork
- 338
- Merge medio
- 1g 3h
- PR unite (30g)
- 1
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di RustAudio/rodio
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 73/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 62/100
-
WavDecoder::size_hint underflows (u32 wrap, ~4.29e9) after EOF, causes multi-GB Vec::collect() allocationForse già presa @marin-m l’ha presa 2 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 72/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
Tutte le issue di RustAudio/rodio
Issue simili
-
muse P3
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
HerringtonDarkholme/hd-lang#923 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
longbridge/gpui-kit#3712 ·
I maintainer di solito rispondono entro 1 giorno
-
documentation enhancement SIEM
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
ADORSYS-GIS/wazuh-agent-status#265 ·
I maintainer di solito rispondono entro 2 giorni
-
documentation enhancement SIEM
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
-
[Feature] 数据表查询结果转置后显示字段注释Apertaai-priority/P2 enhancement user-priority/P0
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno