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

Random floating point exception #34

Open
kargirwar opened this issue Aug 30, 2023 · 4 comments
Open

Random floating point exception #34

kargirwar opened this issue Aug 30, 2023 · 4 comments

Comments

@kargirwar
Copy link

kargirwar commented Aug 30, 2023

Describe the bug
I am using soloud to play an mp3 file. It works most of the time. But every now and then
the app crashes with the reason as Floating point exception: 8. It appears to originate
from soloud.

To Reproduce
This is hard to do, since the problem occurs randomly. This is code snippet:

 const BEEP_INTERVAL: u64 = 1000; //milliseconds                                                    
 const POLL_INTERVAL: u64 = 100;    
 for _ in 0..5 {                                                                                        
    thread::spawn(|| {                                                                                 
        let mut sl = Soloud::default().unwrap();                                                       
        sl.set_global_volume(3.0);                                                                     
                                                                                                       
        let mut wav = audio::Wav::default();                                                           
                                                                                                       
        wav.load_mem(include_bytes!("beep.mp3")).unwrap();                                             
                                                                                                       
        sl.play(&wav);                                                                                 
                                                                                                       
        while sl.voice_count() > 0 {                                                                   
            std::thread::sleep(std::time::Duration::from_millis(POLL_INTERVAL));                       
        }                                                                                              
    });                                                                                                
                                                                                                       
    std::thread::sleep(std::time::Duration::from_millis(BEEP_INTERVAL));                               
}     

Expected behavior
Code should never crash.

Desktop:

Additional context
Using this crate in a Tauri application

@kargirwar
Copy link
Author

kargirwar commented Aug 30, 2023

Rename beep.txt to beep.mp3

@MoAlyousef
Copy link
Owner

Hi
I’ll look into it deeper this weekend. Looking at the log, it seems like an upstream issue.

@MoAlyousef
Copy link
Owner

I tried running the provided code with different configurations/modifications/feature flags (namely coreaudio on macos), and I can't seem to hit the exception. I've also run with sanitizers.

I'm using macos 12.6.6 on an intel x64 cpu. Using the latest version of soloud-rs.
What arch are you building then running the app?
Also what's in your Cargo.toml.
I can't help but think it might be an architecture issue, or some other dependency conflict.

@kargirwar
Copy link
Author

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

No branches or pull requests

2 participants