Bug 915121 - The game Gweled crashes in Fedora 18 and sound and music fails to work
Summary: The game Gweled crashes in Fedora 18 and sound and music fails to work
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: gweled
Version: 19
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Hans de Goede
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-02-25 00:42 UTC by roglee
Modified: 2013-07-30 15:23 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-07-30 15:17:12 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description roglee 2013-02-25 00:42:22 UTC
Description of problem:
The game Gweled when started in a terminal gives the error- Audio driver chosen:
no sound
segmentation fault
There is never any sound or music. I have sound and music selected in the preferences. You might need to try starting the game more than once to see it crash and close. I am using 3.7.9-201.fc18.i686.PAE
The sound and music worked ok with Gweled in Fedora 16 and no crashing.


Version-Release number of selected component (if applicable):


How reproducible:
no sound or music every time. crashes sometimes 

Steps to Reproduce:
1.Start Gweled
2.
3.
  
Actual results:
No sound or music. sometimes crashes and closes.

Expected results:
Sound and music and game playing without crashing.

Additional info:

Comment 1 Kriton Kyrimis 2013-04-28 20:28:08 UTC
In my case I get:

Audio driver choosen: ALSA
Write error: File descriptor in bad state

after which, the program exits.

Kernel is 3.8.9-200.fc18.x86_64
Gweled is gweled-0.9.1-5.fc18.x86_64

If I comment out the line:

MikMod_RegisterDriver(&drv_alsa);

in sound.c gweled's source, I can get the program to run, but without getting any sound. Turning off sounds, by editing ~/.config/gweled.conf, allows me to play the game.

It seems that this is an ALSA problem. Roglee's problem might be caused by ALSA not being installed in his system, while my problem may be caused by not having enough (or having too much) of it installed in mine. These are the alsa-related RPMS that are installed in my system:

alsa-firmware-1.0.25-2.fc18.noarch.rpm
alsa-lib-1.0.26-2.fc18.i686.rpm
alsa-lib-1.0.26-2.fc18.x86_64.rpm
alsa-lib-devel-1.0.26-2.fc18.x86_64.rpm
alsa-plugins-pulseaudio-1.0.26-2.fc18.i686.rpm
alsa-plugins-pulseaudio-1.0.26-2.fc18.x86_64.rpm
alsa-tools-firmware-1.0.26.1-1.fc18.x86_64.rpm
alsa-utils-1.0.26-1.fc18.x86_64.rpm
bluez-alsa-4.101-6.fc18.x86_64.rpm
wine-alsa-1.5.24-1.fc18.i686.rpm
wine-alsa-1.5.24-1.fc18.x86_64.rpm

Comment 2 Herbert Carl Meyer 2013-07-16 16:40:09 UTC
I also have this problem, on Fedora 19, with gweled-0.9.1-6.fc19.x86_64

Comment 3 Karel Volný 2013-07-24 14:20:42 UTC
Hi,

1) this was filed under wrong component, it has nothing to do with game-music-emu, it should have been filed under gweled ... but after further investigation the culprit seems to be libmikmod, so reassigning to libmikmod

2) I can reproduce with gweled-0.9.1-6.fc19.x86_64 and libmikmod-3.2.0-21.fc19.x86_64, updating the version

3) trying to strace ...

open("/lib64/tls/x86_64/libasound.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/lib64/tls/x86_64", 0x7fff8ed7d330) = -1 ENOENT (No such file or directory)
open("/lib64/tls/libasound.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/lib64/tls", {st_mode=S_IFDIR|0555, st_size=4096, ...}) = 0
open("/lib64/x86_64/libasound.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/lib64/x86_64", 0x7fff8ed7d330)   = -1 ENOENT (No such file or directory)
open("/lib64/libasound.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/lib64", {st_mode=S_IFDIR|0555, st_size=151552, ...}) = 0
open("/usr/lib64/tls/x86_64/libasound.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib64/tls/x86_64", 0x7fff8ed7d330) = -1 ENOENT (No such file or directory)
open("/usr/lib64/tls/libasound.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib64/tls", {st_mode=S_IFDIR|0555, st_size=4096, ...}) = 0
open("/usr/lib64/x86_64/libasound.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib64/x86_64", 0x7fff8ed7d330) = -1 ENOENT (No such file or directory)
open("/usr/lib64/libasound.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib64", {st_mode=S_IFDIR|0555, st_size=151552, ...}) = 0
munmap(0x7f10b5667000, 156490)          = 0
access("/dev/sound/dsp", F_OK)          = -1 ENOENT (No such file or directory)
access("/dev/dsp0", F_OK)               = -1 ENOENT (No such file or directory)
open("/dev/dsp", O_WRONLY|O_NONBLOCK)   = -1 ENOENT (No such file or directory)
brk(0)                                  = 0x12bd000
brk(0x12de000)                          = 0x12de000
brk(0)                                  = 0x12de000
brk(0x130a000)                          = 0x130a000
brk(0)                                  = 0x130a000
brk(0x132e000)                          = 0x132e000
brk(0)                                  = 0x132e000
brk(0x135c000)                          = 0x135c000
brk(0)                                  = 0x135c000
brk(0x1386000)                          = 0x1386000
brk(0)                                  = 0x1386000
brk(0x13a7000)                          = 0x13a7000
brk(0)                                  = 0x13a7000
brk(0x13cf000)                          = 0x13cf000
mmap(NULL, 8392704, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = 0x7f10b4e8d000
mprotect(0x7f10b4e8d000, 4096, PROT_NONE) = 0
clone(child_stack=0x7f10b568cd30, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tidptr=0x7f10b568d9d0, tls=0x7f10b568d700, child_tidptr=0x7f10b568d9d0) = 4320
fstat(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(136, 9), ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f10b56b0000
write(1, "Audio driver choosen: No Sound\n", 31) = 31


there seems to be a problem that it tries to access unversioned library libasound.so which is provided only by alsa-lib-devel, but gweled nor libmikmod does not (and should not!) depend on this package

the subsequent failure may be attributed to fallback to OSS which provides /dev/dsp - which is unavailable on stock Fedora 18/19 as it does not enable OSS emulation by default

so, the important part that needs to be fixed here is linking and packaging, libmikmod has to be fixed to use the proper version of libasound.so.X


4) if libasound.so is available, there's another problem which seems to be in the way libmikmod (alsa?) tries to use the interprocess pipe

stracing further, the pipe gets created as this:

[pid  5001] pipe2([9, 10], O_CLOEXEC)   = 0
[pid  5001] fcntl(9, F_GETFD)           = 0x1 (flags FD_CLOEXEC)
[pid  5001] fcntl(10, F_GETFD)          = 0x1 (flags FD_CLOEXEC)
[pid  5001] fcntl(9, F_GETFL)           = 0 (flags O_RDONLY)
[pid  5001] fcntl(9, F_SETFL, O_RDONLY|O_NONBLOCK) = 0
[pid  5001] fcntl(10, F_GETFL)          = 0x1 (flags O_WRONLY)
[pid  5001] fcntl(10, F_SETFL, O_WRONLY|O_NONBLOCK) = 0

later on, the access to the fd 10 fails like this:

pid  5001] sendto(10, "W", 1, MSG_NOSIGNAL, NULL, 0) = -1 ENOTSOCK (Socket operation on non-socket)

which I believe is the cause of the error message printed later:

"Write error: File descriptor in bad state"

while ordinary write seems to work fine:

[pid  5001] write(10, "W", 1)           = 1
[pid  5001] write(10, "W", 1)           = 1

or I may be completely mistaken :-)

I've tried to see what happens around that sendto by using "catch syscall sendto" in gdb, but it doesn't work for me, so debugging this seems far beyond my abilities :-(

Comment 4 Hans de Goede 2013-07-27 11:29:11 UTC
Hi all,

I don't think this is a libmikmod issue, but more likely a gweled issue. IE looking at code like this from music.c:

+void music_stop()
+{
+       if (music_isplaying()){
+       if (module)
+               {
+               Player_Stop();
+               Player_Free(module);
+                       pthread_cancel(thread);
+                       pthread_join(thread, NULL);
+               prefs.music_on = FALSE;
+               is_playing = FALSE;
+               }
+       }
+
+}

I see:
1) Freeing resources used by the thread before killing it
2) hard killing of the thread rather then letting it end gracefully

Both of which are just asking for trouble. I'm not saying this is the cause, this is just the first thing that stands out, and to me gives an indication of the code quality (or lack there of). Where as the new libmikmod, had various issues directly after the update, but there have been none recently, so my gut feeling says this is a gweled issue.

But before I investigate this any further, Karel, I see that you've updated gweled in rawhide and F-19 to a new version which has switched to using libcanberra. So is there any reason to investigate this further? If not I suggest you make the current gweled update:
https://admin.fedoraproject.org/updates/FEDORA-2013-13664/gweled-0.9.1-7.20130725bzr91.fc19

Close this bug.

Thanks,

Hans

Comment 5 Karel Volný 2013-07-29 14:19:34 UTC
(In reply to Hans de Goede from comment #4)
> But before I investigate this any further, Karel, I see that you've updated
> gweled in rawhide and F-19 to a new version

not me, limburgher ;-)

> which has switched to using libcanberra.

yep, the upgrade pulled this as dependency

> So is there any reason to investigate this further?

as for the part "sound fails to work", yes, because on my system, I don't get any sounds (while music plays) despite I can see on the console messages like this:

libcanberra playing sound click.ogg [file: /usr/share/sounds/gweled/click.ogg]; Success

but this may be rather a pulseaudio bug, as it has some troubles handling my usb headset along the integrated soundcard

so, I'd like to ask others for testing:

1) please upgrade gweled - something like this:
# yum --enablerepo=updates-testing upgrade gweled

2) test with sound

3) reply here - clear needinfo whether the sound works for you

4) and don't forget to leave karma at https://admin.fedoraproject.org/updates/FEDORA-2013-13664/gweled-0.9.1-7.20130725bzr91.fc19 ;-)

Comment 6 Hans de Goede 2013-07-29 17:04:01 UTC
Using libcanberra for a game seems like a bad idea, I've disabled system sounds (in older gnome-preferences you could do this) and gweled for me know says:
libcanberra playing sound autonom.ogg [file /usr/share/sounds/gweled/autonom.ogg]: Sound disabled

Which is how I like it since normally libcanberra is used for annoying notification sounds.

Using SDL_mixer (or fixing the old code which directly uses libmikmod) seems like a better idea. A quick google has found me this version which uses SDL_mixer: https://github.com/Marisa-Chan/gweled-sdl_mixer

Comment 7 Herbert Carl Meyer 2013-07-30 00:51:36 UTC
Works for me. I am on an F19, 64 bit. Starting from terminal shell, I get messages:

Initializing canberra-gtk context for display :0 on screen 0
libcanberra playing sound autonom.ogg [file /usr/share/sounds/gweled/autonom.ogg]: Success
libcanberra playing sound click.ogg [file: /usr/share/sounds/gweled/click.ogg]; Success

Success message repeats, I can hear music.

Comment 8 Hans de Goede 2013-07-30 07:52:02 UTC
(In reply to Herbert Carl Meyer from comment #7)
> Works for me. I am on an F19, 64 bit. Starting from terminal shell, I get
> messages:
> 
> Initializing canberra-gtk context for display :0 on screen 0
> libcanberra playing sound autonom.ogg [file
> /usr/share/sounds/gweled/autonom.ogg]: Success
> libcanberra playing sound click.ogg [file:
> /usr/share/sounds/gweled/click.ogg]; Success
> 
> Success message repeats, I can hear music.

But can you also hear sound effects for swapping crystals, and for matching them and them disappearing? 

On my other machine (where I never bothered to disable notification sounds) I get only music.

Comment 9 Karel Volný 2013-07-30 09:24:03 UTC
(In reply to Hans de Goede from comment #6)
> Using SDL_mixer (or fixing the old code which directly uses libmikmod) seems
> like a better idea. A quick google has found me this version which uses
> SDL_mixer: https://github.com/Marisa-Chan/gweled-sdl_mixer

ok, so, probably filing a bug for gweled to use that code and closing this one as cantfix would be way to go now?

Comment 10 Hans de Goede 2013-07-30 09:57:23 UTC
(In reply to Karel Volný from comment #9)
> (In reply to Hans de Goede from comment #6)
> > Using SDL_mixer (or fixing the old code which directly uses libmikmod) seems
> > like a better idea. A quick google has found me this version which uses
> > SDL_mixer: https://github.com/Marisa-Chan/gweled-sdl_mixer
> 
> ok, so, probably filing a bug for gweled to use that code and closing this
> one as cantfix would be way to go now?

That sounds like a good way to move forward to me, yes.

Comment 11 Karel Volný 2013-07-30 15:17:12 UTC
(In reply to Hans de Goede from comment #10)
...
> That sounds like a good way to move forward to me, yes.

um, I was silently hoping you're going to do that :-)

but I see gweled got a new update already - which works, cool

Comment 12 Gwyn Ciesla 2013-07-30 15:23:56 UTC
Ah, I'll build the fix for f18, also.


Note You need to log in before you can comment on or make changes to this bug.