2019-12-07 09:17 EST


View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0002333FSSCPsoundpublic2010-11-08 18:04
Reportersmr42 
Assigned ToThe_E 
PrioritynormalSeverityminorReproducibilityrandom
StatusresolvedResolutionfixed 
Product Version 
Target VersionFixed in Version3.6.13 
Summary0002333: Random crashes caused by snd_get_duration()
DescriptionWhen playing bp2-15.fs2 from blueplanet WiH, the game crashes randomly. I would say 9 of 10 times i tried to play the mission.
The problem was also reported by this user:
http://www.hard-light.net/forums/index.php?topic=71860.20
The user was advised to remove all custom CFLAGS and recompile, but to no avail. Same with me.
I experienced the same random crashes in other BoE situations.

So I tried running fsopen with gdb and found out, that the game always crashes in the function snd_get_duration() from code/sound/sound.cpp at "return Sounds[snd_id].duration;".

It's been a while since I coded some C/C++, but I think the problem is either that the index snd_id is outside of Sounds[] or that the element Sounds[snd_id] has no attribute "duration".

I tried putting the return statement inside a try block:
try {
    return Sounds[snd_id].duration;
}
catch(const char*) {
    return 0;
}
return 0;

and recompiled. Et voila, no more crashes.

I know this is only a hotfix and that the causing problem lies elsewhere.
I would guess that
- when Sounds[n] is filled there is no following check that Sounds[n] contains a valid object
- Sounds[snd_id] is deleted a the same moment when snd_get_duration(int snd_id) is called. Or maybe the index snd_id is just to old.


Sven

Additional InformationVersion: Subversion checkout (revision 6713)
OS: Gentoo
CFLAGS: -g -pipe
CXXFLAGS: $CFLAGS
mediavps: 3612
VPs for blueplanet and bluepanet: newest from hard-light.net

TagsNo tags attached.
Attached Files

-Relationships
+Relationships

-Notes

~0012440

The_E (administrator)

Last edited: 2010-11-07 20:41

Can you do a new checkout from FSO trunk (revision 6714++), and run this again? I've added a few checks to snd_get_index that will help us narrow this down; If you are on gdb, please provide a callstack as well as an fs2_open.log from the debug build (will be stored in ~/.fs2_open/data).

~0012441

smr42 (reporter)

Ok. Checked out 6714. Programm is still crashing.
This is the gdb output:

 gdb fs2_open_INF_d

warning: Can not parse XML syscalls information; XML support was disabled at compile time.
GNU gdb (Gentoo 7.0.1 p1) 7.0.1
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.gentoo.org/>...
Reading symbols from /testext4/FreeSpace2/fs2_open_INF_d...done.
(gdb) set args -mod blueplanet2,blueplanet,mediavps_3612 -spec -glow -env -mipmap -normal -3dshockwave -dualscanlines -targetinfo -rearm_timer -ballistic_gauge -ship_choice_3d -weapon_choice_3d -fps
(gdb) run
Starting program: /testext4/FreeSpace2/fs2_open_INF_d -mod blueplanet2,blueplanet,mediavps_3612 -spec -glow -env -mipmap -normal -3dshockwave -dualscanlines -targetinfo -rearm_timer -ballistic_gauge -ship_choice_3d -weapon_choice_3d -fps
[Thread debugging using libthread_db enabled]
Future debug output directed to: /home/sven/.fs2_open/data/fs2_open.log
[New Thread 0xb5f94b70 (LWP 19598)]
[Thread 0xb5f94b70 (LWP 19598) exited]
[New Thread 0xb5f94b70 (LWP 19599)]
[Thread 0xb5f94b70 (LWP 19599) exited]
[New Thread 0xb5f94b70 (LWP 19600)]
[Thread 0xb5f94b70 (LWP 19600) exited]
[New Thread 0xb5f94b70 (LWP 19601)]
[New Thread 0xb5793b70 (LWP 19602)]
WARNING: "Ship class UEB Vajradhara has only 3 points on dock path "$path01". Recommended minimum number of points is 4. Docking along that path will look strange. You may wish to edit the model." at ai/aicode.cpp:10546
WARNING: "Ship class UEB Vajradhara has only 3 points on dock path "$path01". Recommended minimum number of points is 4. Docking along that path will look strange. You may wish to edit the model." at ai/aicode.cpp:10546
WARNING: "Ship class UEB Vajradhara has only 3 points on dock path "$path01". Recommended minimum number of points is 4. Docking along that path will look strange. You may wish to edit the model." at ai/aicode.cpp:10546
ASSERTION FAILED: "snd_id < Sounds.size()" at sound/sound.cpp:1052 Passed snd_id is invalid. (Passed id: 522, number of elements in Sounds[]: 120)
[Thread 0xb5793b70 (LWP 19602) exited]

Program received signal SIGABRT, Aborted.
0xb7fe1424 in __kernel_vsyscall ()
(gdb)


I will upload fs2_open.log as separate file because of its length.

~0012442

The_E (administrator)

Hmm....Any chance I can get a callstack for this? I really want to know where this is called from...

~0012443

The_E (administrator)

Never mind, found the issue.

Bug was caused by having a thruster start sound tabled as "-1" in ships.tbl. When that was fed into gamesnd_get_by_tbl_index (gamesnd.cpp line 60), due to the fact that the "sig" member of the game_snd struct is initialized to -1, the function returned the index of the first (technically uninitialized) member of the Snds[] vector, which was 522 in this case.

~0012445

The_E (administrator)

Fixed in FSO revision 6715
+Notes

-Issue History
Date Modified Username Field Change
2010-11-07 16:32 smr42 New Issue
2010-11-07 20:37 The_E Note Added: 0012440
2010-11-07 20:38 The_E Status new => assigned
2010-11-07 20:38 The_E Assigned To => The_E
2010-11-07 20:41 The_E Note Edited: 0012440
2010-11-08 13:42 smr42 Note Added: 0012441
2010-11-08 13:42 smr42 File Added: fs2_open.log
2010-11-08 16:14 The_E Note Added: 0012442
2010-11-08 17:36 The_E Note Added: 0012443
2010-11-08 18:04 The_E Note Added: 0012445
2010-11-08 18:04 The_E Status assigned => resolved
2010-11-08 18:04 The_E Fixed in Version => 3.6.13
2010-11-08 18:04 The_E Resolution open => fixed
+Issue History