Crash in libAVFAudio.dylib

VERIFIED FIXED

Status

()

Firefox for iOS
General
--
critical
VERIFIED FIXED
2 years ago
2 years ago

People

(Reporter: aaronmt, Assigned: st3fan)

Tracking

({crash, reproducible})

unspecified
All
iOS
crash, reproducible

Firefox Tracking Flags

(fxios1.1+, fxios-v1.1 verified)

Details

(URL)

Attachments

(1 attachment)

(Reporter)

Description

2 years ago
Yet another crash in libAVFAudio.dylib

Reproducible.

Steps from ios-mobile-testers

* Visit npr.org, hit play on the live-stream at the top
* Switch out of Firefox, open the timer in the Clock application, set for a min
* Turn off display
* When the alarm goes off, audio suspends in Firefox, on switch back to Firefox we crash
* Re-open Firefox and it crashes again

2015-10-20 10:04:47.390 Client[1476:814824] *** Terminating app due to uncaught exception 'com.apple.coreaudio.avfaudio', reason: 'error 561015905'

* thread #1: tid = 0xc6ee8, 0x0000000198ee31e0 libsystem_kernel.dylib`__pthread_kill + 8, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
Possibly related, I saw this on my Simulator yesterday after Bug 1215972 landed.

2015-10-19 13:41:06.168 Client[13665:3213222] 13:41:06.168 ERROR:    AVAudioIONodeImpl.mm:365: _GetHWFormat: required condition is false: hwFormat
2015-10-19 13:41:06.169 Client[13665:3213222] *** Terminating app due to uncaught exception 'com.apple.coreaudio.avfaudio', reason: 'required condition is false: hwFormat'
*** First throw call stack:
(
	0   CoreFoundation                      0x0000000106558f65 __exceptionPreprocess + 165
	1   libobjc.A.dylib                     0x0000000105878deb objc_exception_throw + 48
	2   CoreFoundation                      0x0000000106558dca +[NSException raise:format:arguments:] + 106
	3   libAVFAudio.dylib                   0x000000010d427e53 _Z19AVAE_RaiseExceptionP8NSStringz + 176
	4   libAVFAudio.dylib                   0x000000010d4693a7 _ZN13AVAudioIOUnit12_GetHWFormatEjPj + 373
	5   libAVFAudio.dylib                   0x000000010d4690aa ___ZN13AVAudioIOUnit22IOUnitPropertyListenerEPvP28OpaqueAudioComponentInstancejjj_block_invoke_2 + 166
Assignee: nobody → sarentz
Status: NEW → ASSIGNED
tracking-fxios: ? → 1.1+
(Assignee)

Comment 2

2 years ago
Console:

2015-10-20 15:01:52.857 Client[10329:2870709] 15:01:52.820 ERROR:    [0x1a1ed2000] >aurioc> 807: failed: '!pla' (enable 2, outf< 2 ch,  44100 Hz, Float32, non-inter> inf< 2 ch,      0 Hz, Float32, non-inter>)
2015-10-20 15:01:52.891 Client[10329:2870709] 15:01:52.889 ERROR:    [0x1a1ed2000] AVAudioEngineGraph.mm:2510: PerformCommand: error 561015905

Trace:

Thread 1Queue : com.apple.main-thread (serial)
#0	0x000000019ac1ff48 in objc_exception_throw ()
#1	0x0000000186f6744c in __NSThreadPerformPerform ()
#2	0x0000000185fe05a4 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ ()
#3	0x0000000185fe0038 in __CFRunLoopDoSources0 ()
#4	0x0000000185fddd38 in __CFRunLoopRun ()
#5	0x0000000185f0cdc0 in CFRunLoopRunSpecific ()
#6	0x0000000191060088 in GSEventRunModal ()
#7	0x000000018b5e6f44 in UIApplicationMain ()
#8	0x000000010023519c in main at /Users/sarentz/Projects/firefox-ios/Client/Application/main.swift:22
#9	0x000000019b44a8b8 in start ()
(Assignee)

Comment 3

2 years ago
Thrown from:

        func startEngine() {
            if !engine.running {
                do {
>>>>>>            try engine.start()
                } catch {
                    log.error("Unable to start AVAudioEngine: \(error)")
                }
            }
        }
(Assignee)

Comment 4

2 years ago
Interesting the catch clause is never called. This may not work as we expect it to.
(Assignee)

Comment 5

2 years ago
Some notes:

Safari behaviour:

Make sure audio is silent
Open a new tab, go to http://www.relay.fm/mpu/284
Play the podcast
Hit the home button - Audio keeps playing
Open Clock, set an alarm for 1 minute
Lock screen - Audio keeps playing
When alarm goes off, silence it "Tap to Stop"
Audio should still be playing
Unlock phone
Double tap
Switch to Safari - Audio should still be playing
(Assignee)

Comment 6

2 years ago
We already fail here:

When alarm goes off, silence it "Tap to Stop"
Audio should still be playing

We don't crash, but the audio stops playing. I think we may be using the wrong audio session flags/mode/etc.
(Assignee)

Comment 7

2 years ago
I have added the 'audio' background mode to the app. This gives us behaviour similar to Safari and stops the crashes.

I don't think this one had anything to do with our AuralProgressBar code. I think this is about the WKWebView playing audio.
(Assignee)

Comment 8

2 years ago
Created attachment 8676446 [details] [review]
PR: https://github.com/mozilla/firefox-ios/pull/1179



This patch adds audio as a required background mode. This prevents the crash and also makes the app behave similar to Safari wrt audio. You can now for example start a podcast in a tab, answer a phone call, or play a game, and the podcast will be correctly suspended and resumed.
Attachment #8676446 - Flags: review?(sleroux)
Attachment #8676446 - Flags: review?(rnewman)
Attachment #8676446 - Flags: feedback?(aaron.train)
(Reporter)

Comment 9

2 years ago
Comment on attachment 8676446 [details] [review]
PR: https://github.com/mozilla/firefox-ios/pull/1179

#1180 works for me

https://github.com/mozilla/firefox-ios/pull/1180
Attachment #8676446 - Flags: feedback?(aaron.train)
I merged that. 273dcf7
Status: ASSIGNED → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → FIXED
Comment on attachment 8676446 [details] [review]
PR: https://github.com/mozilla/firefox-ios/pull/1179

sleroux, please post-review!
Attachment #8676446 - Flags: review?(rnewman) → review+
Attachment #8676446 - Flags: review?(sleroux)
I can't reproduce the crash using the steps from description.
Verifying as fixed on Beta 1113
Status: RESOLVED → VERIFIED
status-fxios-v1.1: affected → verified
You need to log in before you can comment on or make changes to this bug.