Opened 5 years ago
Closed 5 years ago
#15263 closed bug (fixed)
Media_addon_server crash when attempting to reboot or shut down Haiku (Copy2Int())
Reported by: | vidrep | Owned by: | leavengood |
---|---|---|---|
Priority: | normal | Milestone: | R1/beta2 |
Component: | Servers/media_addon_server | Version: | R1/Development |
Keywords: | Cc: | jerome.duval@…, ttcoder | |
Blocked By: | Blocking: | #15260, #15332, #15530, #15676 | |
Platform: | All |
Attachments (9)
Change History (47)
by , 5 years ago
Attachment: | media_addon_server-6818-debug-17-08-2019-00-17-43.report added |
---|
comment:1 by , 5 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 5 years ago
Blocking: | 15260 added |
---|
comment:3 by , 5 years ago
comment:4 by , 5 years ago
It seems to only happen after I have been playing a media file. If I have not been playing any media during a session, then Haiku will shut down cleanly. During my last session, it was impossible to shut down Haiku unless I either terminated media_addon_server from the alert notification, or restart the desktop and force a reboot from TeamManager.
comment:5 by , 5 years ago
Wierd, with asking it to quit from the team monitor the behaviour seams oposite to that, i have had it crash on shutdown without having used any media stuff in a session, if i quit it (and it dies) and subsequently try to play something the media server will be restarted (upon request) and quiting media_addon_server after that doesn't produce a crash anymore.
comment:6 by , 5 years ago
It probably caused by improper cleanup when media_addon_server quit. Crash occured in MultiAudioNode thread which is still active when some dependent resource is released. media_addon_server should stop and delete all nodes it hosts before quit.
by , 5 years ago
Attachment: | media_addon_server-4693-debug-19-08-2019-03-33-01.report added |
---|
by , 5 years ago
Attachment: | syslog.txt added |
---|
comment:8 by , 5 years ago
I will look at this within the next few days. I am almost done with my current Tracker fix.
I think X512 has the right idea here, though it seems like a pretty basic thing that the media_addon_server would stop all its nodes before quitting...
I just did some quick testing and I cannot seem to reproduce this, but I might not be using the right version of media_addon_server. I am also testing in VirtualBox and whatever version of Intel HD they have doesn't seem to work, and this crash seems to be dependent on that (multi_audio media add-on.) And this machine has a Realtek so I also do not think I would see this if I booted natively. But I'll keep trying.
comment:9 by , 5 years ago
Cc: | added |
---|
Jérôme, you may know this code better than I, any insights? One question I have is why this was commented out: https://xref.plausible.coop/source/xref/haiku/src/add-ons/media/media-add-ons/multi_audio/MultiAudioNode.cpp#1294
We suspect this thread is still trying to access buffers after they have been deleted from the BufferCache during shutdown due to my change in hrev53379.
comment:10 by , 5 years ago
Trying to build media_addon_server with debug info by using "DEBUG=1 jam -q media_addon_server", but release build is still produced. media_server debug build complete without problems. What I am doing wrong?
comment:11 by , 5 years ago
I look like problem is in multi_audio add-on. media_addon_server termination sequence seems to be correct. Crash occured when mixer node are released by media_addon_server in _DestroyInstantiatedFlavors. mixer is released before MultiAudioNode, so MultiAudioNode::_OutputThread is still running. MultiAudioNode don't correctly respond to stop and disconnect notifications. Same crash can be also caused by removing connection between "Audio Mixer" and "HD Audio" nodes.
comment:12 by , 5 years ago
Thanks for digging into this X512. We have some other media-related bugs about not being able to change the media output without having to reboot afterwards, so I think there is some refactoring that is needed here to decouple the mixer from multi audio. I haven't gotten to that part of the media kit code yet so I still have some things to learn.
comment:13 by , 5 years ago
Blocking: | 15332 added |
---|
by , 5 years ago
Attachment: | media_addon_server-471-debug-06-10-2019-13-02-36.report added |
---|
comment:15 by , 5 years ago
I can confirm this one, am seeing it pretty consistently in latest Haiku 64 bit builds...kind of an "ouch" issue because it hurts credibility a little. I'll attach a report.
by , 5 years ago
Attachment: | media_addon_server-563-debug-24-11-2019-21-45-04.report.txt added |
---|
media_addon_server crash at restart - latest Haiku 64 bit version
comment:16 by , 5 years ago
Cc: | added |
---|---|
Summary: | Media_addon_server crash when attempting to reboot or shut down Haiku → Media_addon_server crash when attempting to reboot or shut down Haiku (Copy2Int()) |
@Dane you could configure debug_server to silently drop media_addon_server when it crashes, much like we did with CC6 quietly-generate-report thing. That's a hackish work-around at best, but then again media_addon_server has been doing that kind of thing for me ever since I started using Haiku in the alpha days (10+ years ago), so expecting a quick resolution might be less reasonable than applying a work-around here :-)
comment:17 by , 5 years ago
Now that my sound card works with the patched HDA driver (see #15499) I see media_addon_server crashing on shutdown or reboot. Before that fix I did not see the crash. Maybe this helps in finding the cause for this.
comment:18 by , 5 years ago
Blocking: | 15530 added |
---|
by , 5 years ago
Attachment: | media_addon_server-494-debug-22-12-2019-12-11-18.report added |
---|
comment:20 by , 5 years ago
I had another crash on shutdown with media_addon_server on hrev53644, although i am unsure of whether it is the same issue or a different one.
by , 5 years ago
Attachment: | media_addon_server-494-debug-22-12-2019-12-16-57.report added |
---|
longer report hrev53644
comment:21 by , 5 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
comment:23 by , 5 years ago
Still reproduced on hrev53644 x86_64.
Steps to reproduce:
- Play some sound.
- Exit media server by ProcessController -> Quit an Application.
- media_addon_server will crash.
100% reproducible.
comment:24 by , 5 years ago
Older version (https://git.haiku-os.org/haiku/tree/src/add-ons/media/media-add-ons/multi_audio/MultiAudioNode.cpp?id=be4e010170a900c3c38b00e17f6104a7bdb938ed) used fBuffer_free
semaphore that was deleted later. Maybe it was actually required.
comment:26 by , 5 years ago
Disconnecting HD Audio from Audio Mixer in Cortex also do not produce crash after fix.
comment:27 by , 5 years ago
@nephele could you do the following?
- in a Terminal: launch_roster stop x-vnd.haiku-media_server
- then quit media_server with ProcessController
- in Terminal: /system/servers/media_server
- then quit media_server with ProcessController
Please post the log.
comment:28 by , 5 years ago
by , 5 years ago
follow-up: 32 comment:31 by , 5 years ago
korli: i have done what you asked, however i could not reproduce a crash this way :/
comment:32 by , 5 years ago
Replying to nephele:
korli: i have done what you asked, however i could not reproduce a crash this way :/
Maybe try to log to a file "/system/servers/media_server 2>&1 1>media_server.log"
comment:33 by , 5 years ago
How does redirecting file descriptors help? it just did not crash with that test :), i have already added the full log of the test (and media_server) to the ticket
comment:34 by , 5 years ago
In my case it did crash. Do you need the debug report in addition to the terminal log?
comment:35 by , 5 years ago
I was playing around with this today, and apparently, if you kill the mixer thread ("Yeah baby, very shagadelic") manually first, media_addon_server will not crash on shutdown (Yesterday's hrev)?
Might give a hint as to what's wrong...
comment:36 by , 5 years ago
Blocking: | 15676 added |
---|
comment:37 by , 5 years ago
Milestone: | Unscheduled → R1/beta2 |
---|
comment:38 by , 5 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Fixed in Fixed in hrev53876.
This seams to be easily reproducible by asking media_addon_server to quit from the team manager, this gives me a quite similar debug report (i can attach this if that is relevant too)
same hrev for me.