Closed tobiashuttinger closed 3 weeks ago
Thanks. I'll take a look. As a matter of interest, is the Mac an Apple Silicon Mac or an Intel Mac?
It's an intel mac. If you can't reproduce it but want to fix it anyway, please let me know if i can help (testing code, running memory dump, debugger).
Hmm, I'm afraid I'm not getting this to happen. Here is my config:
$ shairport-sync -v --statistics
0.000733119 "shairport.c:2278" Startup in classic Airplay (aka "AirPlay 1") mode.
0.000035860 "shairport.c:2314" Version String: "4.3.4-dev-15-g0412a840-OpenSSL-dns_sd-ao-stdout-sysconfdir:/usr/local/etc"
0.000005897 "shairport.c:2333" Command Line: "./shairport-sync -v --statistics".
0.000003076 "shairport.c:2369" Log Verbosity is 1.
0.004824154 "shairport.c:2437" disable_resend_requests is off.
0.000026893 "shairport.c:2441" diagnostic_drop_packet_fraction is 0.000000. A value of 0.0 means no packets will be dropped deliberately.
0.000006168 "shairport.c:2442" statistics_requester status is 1.
0.000002931 "shairport.c:2447" rtsp listening port is 5000.
0.000002678 "shairport.c:2448" udp base port is 6001.
0.000002683 "shairport.c:2449" udp port range is 10.
0.000002668 "shairport.c:2450" player name is "Testmac".
0.000002758 "shairport.c:2451" backend is "ao".
0.000002728 "shairport.c:2452" run_this_before_play_begins action is "(null)".
0.000002751 "shairport.c:2453" run_this_after_play_ends action is "(null)".
0.000002596 "shairport.c:2454" wait-cmd status is 0.
0.000002548 "shairport.c:2455" run_this_before_play_begins may return output is 0.
0.000002671 "shairport.c:2457" run_this_if_an_unfixable_error_is_detected action is "(null)".
0.000106843 "shairport.c:2459" run_this_before_entering_active_state action is "(null)".
0.000015910 "shairport.c:2461" run_this_after_exiting_active_state action is "(null)".
0.000004415 "shairport.c:2462" active_state_timeout is 10.000000 seconds.
0.000004010 "shairport.c:2463" mdns backend "(null)".
0.000003910 "shairport.c:2468" interpolation setting is "basic".
0.000071832 "shairport.c:2469" interpolation soxr_delay_threshold is 30000000.
0.000012090 "shairport.c:2470" resync time is 0.050000 seconds.
0.000006073 "shairport.c:2471" resync recovery time is 0.100000 seconds.
0.000004954 "shairport.c:2472" allow a session to be interrupted: 0.
0.000003865 "shairport.c:2473" busy timeout time is 120.
0.000003707 "shairport.c:2474" drift tolerance is 0.002000 seconds.
0.000003809 "shairport.c:2475" password is not set.
0.000003824 "shairport.c:2476" default airplay volume is: -24.000000.
0.000004251 "shairport.c:2477" high threshold airplay volume is: -16.000000.
0.000005588 "shairport.c:2479" check for higher-than-threshold volume for new play session is disabled.
0.000005951 "shairport.c:2485" ignore_volume_control is 0.
0.000004110 "shairport.c:2489" volume_max_db is not set
0.000003757 "shairport.c:2491" volume range in dB (zero means use the range specified by the mixer): 0.
0.000003608 "shairport.c:2495" volume_range_combined_hardware_priority (1 means hardware mixer attenuation is used first) is 0.
0.000003558 "shairport.c:2497" playback_mode is 0 (0-stereo, 1-mono, 1-reverse_stereo, 2-both_left, 3-both_right).
0.000003518 "shairport.c:2498" disable_synchronization is 0.
0.000003216 "shairport.c:2499" use_mmap_if_available is 1.
0.000036337 "shairport.c:2501" output_format automatic selection is enabled.
0.000011259 "shairport.c:2505" output_rate automatic selection is enabled.
0.000006013 "shairport.c:2509" audio backend desired buffer length is 1.000000 seconds.
0.000006357 "shairport.c:2511" audio_backend_buffer_interpolation_threshold_in_seconds is 0.000000 seconds.
0.000006823 "shairport.c:2512" audio backend latency offset is 0.000000 seconds.
0.000004610 "shairport.c:2514" audio backend silence lead-in time is "auto".
0.000004435 "shairport.c:2518" zeroconf regtype is "_raop._tcp".
0.000004815 "shairport.c:2519" decoders_supported field is 1.
0.000005247 "shairport.c:2520" use_apple_decoder is 0.
0.000006105 "shairport.c:2521" alsa_use_hardware_mute is 0.
0.000012341 "shairport.c:2525" no special mdns service interface was requested.
0.000088090 "shairport.c:2532" configuration file name "/usr/local/etc/shairport-sync.conf" can not be resolved.
0.000010000 "shairport.c:2558" loudness is 0.
0.000004440 "shairport.c:2559" loudness reference level is -20.000000
Running macOS Ventura 13.6.7 (the latest it can use) on a 27" 2017 iMac.
The config of Shairport Sync is a bit different; in particular, metadata is not enabled. Would you be kind enough to try building without metadata and see if the problem persists?
(I'll keep digging myself.)
Thank you for digging into this!
I tried to build with the same options as you did and with the sample config file, but the error still occurs. Also I noticed the Unix System Calls and Process Switches counts in activity monitor go completely crazy once the cpu time is 100%.
./shairport-sync -v --statistics
0.000699258 "shairport.c:2281" Startup in classic Airplay (aka "AirPlay 1") mode.
0.000016477 "shairport.c:2317" Version String: "4.3.4-dev-OpenSSL-dns_sd-ao-stdout-sysconfdir:/usr/local/etc/shairport-sync"
0.000003870 "shairport.c:2336" Command Line: "./shairport-sync -v --statistics".
0.000002559 "shairport.c:2372" Log Verbosity is 1.
0.004336634 "shairport.c:2440" disable_resend_requests is off.
0.000007116 "shairport.c:2444" diagnostic_drop_packet_fraction is 0.000000. A value of 0.0 means no packets will be dropped deliberately.
0.000003344 "shairport.c:2445" statistics_requester status is 1.
0.000002505 "shairport.c:2450" rtsp listening port is 5000.
0.000002351 "shairport.c:2451" udp base port is 6001.
0.000002334 "shairport.c:2452" udp port range is 10.
0.000002275 "shairport.c:2453" player name is "Tobimac".
0.000002433 "shairport.c:2454" backend is "ao".
0.000002330 "shairport.c:2455" run_this_before_play_begins action is "(null)".
0.000002417 "shairport.c:2456" run_this_after_play_ends action is "(null)".
0.000002335 "shairport.c:2457" wait-cmd status is 0.
0.000002237 "shairport.c:2458" run_this_before_play_begins may return output is 0.
0.000002609 "shairport.c:2460" run_this_if_an_unfixable_error_is_detected action is "(null)".
0.000002624 "shairport.c:2462" run_this_before_entering_active_state action is "(null)".
0.000002264 "shairport.c:2464" run_this_after_exiting_active_state action is "(null)".
0.000002383 "shairport.c:2465" active_state_timeout is 10.000000 seconds.
0.000002472 "shairport.c:2466" mdns backend "(null)".
0.000002337 "shairport.c:2471" interpolation setting is "basic".
0.000002356 "shairport.c:2472" interpolation soxr_delay_threshold is 30000000.
0.000002306 "shairport.c:2473" resync time is 0.050000 seconds.
0.000002500 "shairport.c:2474" resync recovery time is 0.100000 seconds.
0.000002396 "shairport.c:2475" allow a session to be interrupted: 0.
0.000002474 "shairport.c:2476" busy timeout time is 120.
0.000002239 "shairport.c:2477" drift tolerance is 0.002000 seconds.
0.000002493 "shairport.c:2478" password is not set.
0.000002407 "shairport.c:2479" default airplay volume is: -24.000000.
0.000002484 "shairport.c:2480" high threshold airplay volume is: -16.000000.
0.000002597 "shairport.c:2482" check for higher-than-threshold volume for new play session is disabled.
0.000002396 "shairport.c:2488" ignore_volume_control is 0.
0.000002350 "shairport.c:2492" volume_max_db is not set
0.000002368 "shairport.c:2494" volume range in dB (zero means use the range specified by the mixer): 0.
0.000002475 "shairport.c:2498" volume_range_combined_hardware_priority (1 means hardware mixer attenuation is used first) is 0.
0.000002624 "shairport.c:2500" playback_mode is 0 (0-stereo, 1-mono, 1-reverse_stereo, 2-both_left, 3-both_right).
0.000002531 "shairport.c:2501" disable_synchronization is 0.
0.000002189 "shairport.c:2502" use_mmap_if_available is 1.
0.000002289 "shairport.c:2504" output_format automatic selection is enabled.
0.000002261 "shairport.c:2508" output_rate automatic selection is enabled.
0.000002496 "shairport.c:2512" audio backend desired buffer length is 1.000000 seconds.
0.000002459 "shairport.c:2514" audio_backend_buffer_interpolation_threshold_in_seconds is 0.000000 seconds.
0.000002766 "shairport.c:2515" audio backend latency offset is 0.000000 seconds.
0.000002393 "shairport.c:2517" audio backend silence lead-in time is "auto".
0.000002197 "shairport.c:2521" zeroconf regtype is "_raop._tcp".
0.000002441 "shairport.c:2522" decoders_supported field is 1.
0.000002298 "shairport.c:2523" use_apple_decoder is 0.
0.000002178 "shairport.c:2524" alsa_use_hardware_mute is 0.
0.000002366 "shairport.c:2528" no special mdns service interface was requested.
0.000017756 "shairport.c:2532" configuration file name "/usr/local/etc/shairport-sync/shairport-sync.conf" resolves to "/usr/local/etc/shairport-sync/shairport-sync.conf".
0.000003896 "shairport.c:2561" loudness is 0.
0.000002279 "shairport.c:2562" loudness reference level is -20.000000
140.222129153 "rtsp.c:645" Connection 1: As Yeats almost said, "Too long a silence / can make a stone of the heart".
4.004061899 "rtsp.c:654" *fatal error: an unrecoverable error, "unable_to_cancel_play_session", has been detected.
0.000033788 "rtsp.c:530" Connection 1: cancelled.
0.000288527 "shairport.c:1728" emergency exit
My next steps would be to try on a fresh install of Mac OS Ventura as well as Sonoma and see if it works then. I'll try this over the next days.
Well, I have found something. Let me look at it...
So, I found a bug and pushed a fix [I hope!] in the development
branch. If you got a chance to test it and report back, it would be appreciated!
Amazing, that fixed the error and it works perfectly now!
Thanks for the feedback, and indeed thanks for the bug report. BTW, I've just made the session timeout two minutes by default -- one minute seems to be a bit short.
This issue has been inactive for 28 days so will be closed 7 days from now. To prevent this, please remove the "stale" label or post a comment.
What happened?
When streaming from an iOS device to shairport sync in airplay mode 1 and toggling airplane mode mid-stream (or interrupting the connection otherwise, so that iOS switches back to local playback), after reconnecting the client device to the network, shairport-sync ramps up to 100% cpu utilization on one core and crashes shortly afterwards.
This also happens when setting allow_session_interruption to yes and for different values for session_timeout (e.g. 0), with the difference, that shairport-sync doesn't crash but hast 100% cpu indefinitely and no log output. Streaming still works in those cases.
Relevant log output
System Information.
Client: iPhone with iOS 17 Server: Mac OS 14.5 Sonoma with shairport-sync 4.3.3 via Homebrew
Configuration Information.
PulseAudio or PipeWire installed?
How did you install Shairport Sync?
Homebrew for Mac
Check previous issues