|
|
|
Return to C++ coding using Panda3D
by jean-claude » Sat Nov 19, 2011 11:40 am
Hi,
Don't know what has been changed, but using today a new Panda build from last CVS, I'm getting a really weird crash of an app that has been working fine upto yesterday night.
This is the call stack dump at the time of the crash.
> NED.exe!unref_delete(OrthographicLens * ptr=0x0000000f) Line 360 + 0x34 bytes C++ NED.exe!PointerToBase<OrthographicLens>::reassign(OrthographicLens * ptr=0x25a28800) Line 79 + 0xc bytes C++ NED.exe!PointerTo<TextureStage>::operator=(TextureStage * ptr=0x25a28800) Line 108 C++ NED.exe!Pantin_Quid::set_control_joint(const int XN_J=2, const char * const EGG_J=0x00d19b5c, char * name=0x00d19b54) Line 496 + 0xa7 bytes C++ NED.exe!Pantin_Quid::attach_control_joints() Line 549 + 0x24 bytes C++ NED.exe!Pantin_Quid::load(PandaFramework * pframework=0x00d08b60, WindowFramework * window=0x036926b8, float echelle=0.10500000, std::basic_string<char, std::char_traits<char>, std::allocator<char> > filename="quidhom11XJ", char * pantin_name=0x00d09ae0, bool is_visitor=false) Line 478 + 0xd bytes C++ NED.exe!main(int argc=1, char * * argv=0x058db260) Line 2152 + 0xab bytes C++ NED.exe!__tmainCRTStartup() Line 586 + 0x17 bytes C kernel32.dll!74e0339a() [Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll] ntdll.dll!772d9ed2() ntdll.dll!772d9ea5()
What really strikes me is that this is reported happening while setting control_joints which is not related to orthographiclens... (and the reason why a call to find_child would end up dealing with texturestage and lenses...)
- Code: Select all
bool Pantin_Quid::set_control_joint(const int XN_J, const char *EGG_J, char *name) { CJ[XN_J] = Actor.attach_new_node(name); // add new node "name" to be used to control EGG_J if (Bundle->control_joint(EGG_J, CJ[XN_J].node()) ) {// get EGG_J control through Control Joint "name" ChJ[XN_J] = DCAST(CharacterJoint, Bundle->find_child(EGG_J)); // ** HERE ** // ptr to EGG_J node in bundle tree } else { std::cout << "node: " << name << " not found in bundle tree \n"; return false; }
At this point I'm really in the dark, since no changes were made to my code...
Last edited by jean-claude on Sun Nov 20, 2011 11:32 am, edited 1 time in total.
-

jean-claude
-
- Posts: 378
- Joined: Sun Jan 23, 2011 1:41 pm
- Location: Paris - France
by drwr » Sat Nov 19, 2011 2:11 pm
This smells like a build-sync issue. When you have calls to one function that end up somehow making calls to a completely unrelated function, it often means your build is out of sync: parts of your build are still compiled using an older version of Panda that maybe had different offsets in some of the low-level structures.
I'd make a full, clean rebuild just to prove that this isn't what's going on in this case.
David
-
drwr
-
- Posts: 11253
- Joined: Fri Feb 13, 2004 12:42 pm
- Location: Glendale, CA
by jean-claude » Sat Nov 19, 2011 2:54 pm
Ok, I'm going to generate a full rebuild just in case.
-

jean-claude
-
- Posts: 378
- Joined: Sun Jan 23, 2011 1:41 pm
- Location: Paris - France
by jean-claude » Sat Nov 19, 2011 3:34 pm
Completed a full rebuild .... and :
> NED.exe!unref_delete(OrthographicLens * ptr=0x0000000f) Line 360 + 0x34 bytes C++ NED.exe!PointerToBase<OrthographicLens>::reassign(OrthographicLens * ptr=0x225ad448) Line 79 + 0xc bytes C++ NED.exe!PointerTo<GraphicsBuffer>::operator=(GraphicsBuffer * ptr=0x225ad448) Line 108 C++ NED.exe!Pantin_Quid::set_control_joint(const int XN_J=2, const char * const EGG_J=0x00c89b90, char * name=0x00c89b88) Line 504 + 0xa7 bytes C++ NED.exe!Pantin_Quid::attach_control_joints() Line 567 + 0x24 bytes C++ NED.exe!Pantin_Quid::load(PandaFramework * pframework=0x00c78b60, WindowFramework * window=0x01d126b8, float echelle=0.10500000, std::basic_string<char, std::char_traits<char>, std::allocator<char> > filename="quidhom11XJ", char * pantin_name=0x00c79ae0, bool is_visitor=false) Line 481 + 0xd bytes C++ NED.exe!main(int argc=1, char * * argv=0x04449f68) Line 2161 + 0xab bytes C++ NED.exe!__tmainCRTStartup() Line 586 + 0x17 bytes C kernel32.dll!7620339a() [Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll] ntdll.dll!77e29ed2() ntdll.dll!77e29ea5()
Don't have a clue what is going on. Seems that while a Bundle->find_child(xx) is performed, some Null PT cleanup is taking place...
-

jean-claude
-
- Posts: 378
- Joined: Sun Jan 23, 2011 1:41 pm
- Location: Paris - France
by drwr » Sat Nov 19, 2011 7:48 pm
This is baffling to me as well. Are you using threads in your application? Can you prove it still happens with "support-threads 0"?
I don't suppose a simple application fails in a similar way for you? Does pview work? All my applications are working just fine.
David
-
drwr
-
- Posts: 11253
- Joined: Fri Feb 13, 2004 12:42 pm
- Location: Glendale, CA
by jean-claude » Sat Nov 19, 2011 9:28 pm
Hi,
pview just works fine.
with "support-threads 0", it just gives another form of crash...
NED.exe!0002719e() [Frames below may be incorrect and/or missing, no symbols loaded for NED.exe] NED.exe!00026cc3() NED.exe!00025fdf() NED.exe!00017143() > msvcr90.dll!malloc(unsigned int size=0) Line 163 + 0x5f bytes C msvcp90.dll!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Tidy(bool _Built=true, unsigned int _Newsize=1901062443) Line 2169 + 0x11 bytes C++ msvcp90.dll!std::num_put<char,std::ostreambuf_iterator<char,std::char_traits<char> > >::_Fput(std::ostreambuf_iterator<char,std::char_traits<char> > _Dest={...}, std::ios_base & _Iosbase={...}, char _Fill='è', const char * _Buf=0x03c93748, unsigned int _Beforepoint=63518536, unsigned int _Afterpoint=1, unsigned int _Trailing=46, unsigned int _Count=46) Line 1426 + 0x39 bytes C++ 158623d8() libpanda.dll!std::_Tree<std::_Tset_traits<NodePathComponent *,pointer_hash,pallocator_single<NodePathComponent *>,0> >::insert(NodePathComponent * const & _Val=) Line 650 + 0xf bytes C++ libpanda.dll!PandaNode::get_top_component(PandaNode * child_node=0x003afcd8, bool force=true, int pipeline_stage=8, Thread * current_thread=0x73c2ce95) Line 3640 + 0x8b bytes C++ msvcr90.dll!_unlock(int locknum=301220) Line 376 C NED.exe!00049835() NED.exe!000498bb() NED.exe!00046694() msvcr90.dll!_initterm(void (void)* * pfbegin=0x00000001, void (void)* * pfend=0x03c65cc0) Line 903 C
-

jean-claude
-
- Posts: 378
- Joined: Sun Jan 23, 2011 1:41 pm
- Location: Paris - France
by jean-claude » Sat Nov 19, 2011 9:48 pm
I'm still investigating what could be the root cause of this, since again no changes were made in my app code..
Having said so, let me take the opportunity to mention a second issue that popped up (again) after some recent cvs changes
This phenomenon started showing up say 2 weeks ago, then was healed by some CVS changes,
and reappeared for the last couple of days as a consequence of new CVS changes: on my side
I didn't change anything on my code.
main task: AM = AudioManager::create_AudioManager(); sound_bump = AM->get_sound("boing.wav"); // bump into wall sound sound_bell = AM->get_sound("bell.wav"); // hit bell
then within a collision_task (** running in a threaded task_chain **) if (has_collided_into_wall && (sound_bump->status()!=sound_bump->PLAYING) ) sound_bump->play(); if (bell_was_hit && (sound_bell->status()!=sound_bell->PLAYING) ) sound_bell->play();
(1) USING OPENAL
----------------
load_prc_file_data("", "audio-library-name p3openal_audio"); // use openAL
> mp3 playing fine (some subtle crackings heard)
> ** weird sounding: ie increased length duration, pitch and speed for 'short' sounds boing.wav and bell.wav.
ie a bell sound becomes similar to a buzzer... **
(2) USING FMOD
--------------
load_prc_file_data("", "audio-library-name p3fmod_audio"); // use fmod
> no sound at all!
-

jean-claude
-
- Posts: 378
- Joined: Sun Jan 23, 2011 1:41 pm
- Location: Paris - France
by jean-claude » Sun Nov 20, 2011 10:27 am
I sort of put my finger on a possible culprit.
For whatever reason _SECURE_SCL now defined as 0 is creating some troubles with additional modules included in my c++ app (at compile time this value is defined in dtoolconfig.h).
1>C:\Panda3D-1.8.0\include\dtool_config.h(85): warning #47: incompatible redefinition of macro "_SECURE_SCL" (declared at line 128 of "c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\yvals.h") 1> #define _SECURE_SCL 0
The compile ends up ok but at exec time this generates crashes...
Digging into past versions of makepanda.py, I noticed that the value used to be set at 1. I don't know the reason it was changed, and the consequences, but apparently this has generated side effects.
What I'll do is try a full rebuild with _SECURE_SCL at 1.
Honestly I'm far from having fully understood the underlying phenomenons... Let's see..
-

jean-claude
-
- Posts: 378
- Joined: Sun Jan 23, 2011 1:41 pm
- Location: Paris - France
by jean-claude » Sun Nov 20, 2011 11:14 am
I confirm that getting _SECURE_SCL at 1 in makepanda.py solved the issue. (although there may be some tricky problem well hidden somewhere).
Btw. for the second phenomenon reported (ie the one related to accelerated wav play) it still exists!
-

jean-claude
-
- Posts: 378
- Joined: Sun Jan 23, 2011 1:41 pm
- Location: Paris - France
by drwr » Sun Nov 20, 2011 3:04 pm
Wow, that's a helluva thing. We ran into compilation problems on MSVS2010, which turned out to be related to the explicit setting of _SECURE_SCL to 1. We ourselves weren't sure why it was set there in the first place (another developer did it, but he's since dropped out of communication). We guessed it was maybe a "best practices" thing, because it seems to be related to enabling additional checking within the STL library.
We fixed our problem by changing the setting from 1 to 0. But it appears that explicitly setting it to 0 is causing you problems. Maybe the right answer is not to explicitly set it to either value. I'll remove this from makepanda and we'll see what happens.
Edit: can you post your sound files so I can test the weird audio issues on my build?
David
-
drwr
-
- Posts: 11253
- Joined: Fri Feb 13, 2004 12:42 pm
- Location: Glendale, CA
by jean-claude » Sun Nov 20, 2011 3:33 pm
Hi,
Here are the 2 sound files
https://rapidshare.com/files/2414930192/bell.wav
https://rapidshare.com/files/3453952356/boing.wav
I don't think the issue is related to these specific files, since they've been playing ok for a long time.
What has happen since then is that depending on the cvs versions (some worked ok), these files started to sound in an accelerated way (ie the boing became a whizzzzzz, and the bell a buzzer...) this under openAL, with the sound.play() being called inside a secondary threaded task_chain... (The phenomenon is the same if I switch to set option no thread)
Moreover as previously mentionned I did try to check if using fmod would change something: the net result is no sound at all...
-

jean-claude
-
- Posts: 378
- Joined: Sun Jan 23, 2011 1:41 pm
- Location: Paris - France
by drwr » Sun Nov 20, 2011 4:04 pm
Well, I was able to reproduce your problems playing these files on my own computer--even though I'm running on a Mac. I don't have an FMod build here, but they sounded strange via OpenAL. It didn't have anything to do with threading; the same thing happens when they are played in the main thread.
On investigation, it appears that these .wav files are 8-bit PCM, which relies on a slightly more obscure variation on the .wav standard (original .wav files were all 16-bit PCM). When I re-encode them to 16-bit PCM, they play just fine via OpenAL.
We did recently upgrade the ffmpeg library used in the build; perhaps the new version is for some reason a little less robust with the .wav file format than the old version, and now it only understands 16-bit PCM?
Edit: addendum. I got my local FMod build working, and I find that it can play both 8-bit and 16-bit versions successfully on my Mac. But perhaps there is a different problem with the Windows FMod build.
David
-
drwr
-
- Posts: 11253
- Joined: Fri Feb 13, 2004 12:42 pm
- Location: Glendale, CA
by jean-claude » Sun Nov 20, 2011 5:19 pm
Excellent that clarifies the matter!
wrt. fmod, the sound issue is not solely tied to these 2 files, actually I'm getting no sound at all (with the other files that are mp3)!
-

jean-claude
-
- Posts: 378
- Joined: Sun Jan 23, 2011 1:41 pm
- Location: Paris - France
by drwr » Sun Nov 20, 2011 9:43 pm
Hmm, are you sure fmod is loading at all? Are you getting any error messages about fmod when starting?
David
-
drwr
-
- Posts: 11253
- Joined: Fri Feb 13, 2004 12:42 pm
- Location: Glendale, CA
by jean-claude » Mon Nov 21, 2011 6:50 am
Well, as far as I can see in vs2008 output pane when launching it in debug mode libp3fmod_audio.dll is loaded and I'm getting no warning or whatsoever in the panda console...
'NED.exe': Loaded 'C:\Panda3D-1.8.0\bin\avcodec-53.dll', Binary was not built with debug information. 'NED.exe': Loaded 'C:\Panda3D-1.8.0\bin\avutil-51.dll', Binary was not built with debug information. 'NED.exe': Loaded 'C:\Panda3D-1.8.0\bin\avformat-53.dll', Binary was not built with debug information. 'NED.exe': Loaded 'C:\Windows\SysWOW64\avifil32.dll' 'NED.exe': Loaded 'C:\Windows\SysWOW64\msacm32.dll' 'NED.exe': Loaded 'C:\Windows\SysWOW64\msvfw32.dll' 'NED.exe': Loaded 'C:\Panda3D-1.8.0\bin\swscale-2.dll', Binary was not built with debug information. 'NED.exe': Loaded 'C:\LIBRARIES\opencv\bin\opencv_core220.dll', Symbols loaded. 'NED.exe': Loaded 'C:\Program Files (x86)\Intel\Composer XE 2011 SP1\redist\ia32\compiler\libmmd.dll', Symbols loaded. 'NED.exe': Loaded 'C:\LIBRARIES\opencv\bin\opencv_highgui220.dll', Symbols loaded. 'NED.exe': Loaded 'C:\Windows\SysWOW64\avicap32.dll' 'NED.exe': Loaded 'C:\Panda3D-1.8.0\bin\libp3framework.dll', Symbols loaded. 'NED.exe': Loaded 'C:\Panda3D-1.8.0\bin\libp3direct.dll', Symbols loaded. 'NED.exe': Loaded 'C:\Windows\SysWOW64\opengl32.dll' 'NED.exe': Loaded 'C:\Windows\SysWOW64\glu32.dll' 'NED.exe': Loaded 'C:\Windows\SysWOW64\ddraw.dll' ... 'NED.exe': Loaded 'C:\Windows\SysWOW64\d3d9.dll' 'NED.exe': Loaded 'C:\Windows\SysWOW64\d3d8thk.dll' 'NED.exe': Loaded 'C:\Windows\SysWOW64\D3DX9_43.dll' 'NED.exe': Loaded 'C:\Panda3D-1.8.0\bin\libpandagl.dll', Symbols loaded. 'NED.exe': Loaded 'C:\Panda3D-1.8.0\bin\libp3windisplay.dll', Symbols loaded. 'NED.exe': Loaded 'C:\Panda3D-1.8.0\bin\cgGL.dll'
'NED.exe': Loaded 'C:\Panda3D-1.8.0\bin\libp3ptloader.dll', Symbols loaded. 'NED.exe': Loaded 'C:\Panda3D-1.8.0\bin\libpandaegg.dll', Symbols loaded. 'NED.exe': Loaded 'C:\Program Files (x86)\NVIDIA Corporation\3D Vision\nvStereoApiI.dll' 'NED.exe': Loaded 'C:\Windows\SysWOW64\nvd3dum.dll' 'NED.exe': Loaded 'C:\Panda3D-1.8.0\bin\libp3fmod_audio.dll', Symbols loaded. **************** 'NED.exe': Loaded 'C:\Panda3D-1.8.0\bin\fmodex.dll', Binary was not built with debug information.
I'm not using FMOD in my app, so this doesn't really hurt, but just to mention...
-

jean-claude
-
- Posts: 378
- Joined: Sun Jan 23, 2011 1:41 pm
- Location: Paris - France
by Sam » Mon May 21, 2012 6:35 pm
drwr wrote:Wow, that's a helluva thing. We ran into compilation problems on MSVS2010, which turned out to be related to the explicit setting of _SECURE_SCL to 1. We ourselves weren't sure why it was set there in the first place (another developer did it, but he's since dropped out of communication). We guessed it was maybe a "best practices" thing, because it seems to be related to enabling additional checking within the STL library.
We fixed our problem by changing the setting from 1 to 0. But it appears that explicitly setting it to 0 is causing you problems. Maybe the right answer is not to explicitly set it to either value. I'll remove this from makepanda and we'll see what happens.
FWIW, I just had to look into this, and the key issue is for the _SECURE_SCL to match in all modules that pass STL data structures to eachother (including std::string), since _SECURE_SCL changes the in-memory layout.
In VS2008, both debug and release default to _SECURE_SCL being on (which has a serious performance impact on using STL iterators). In VS2010, they changed it to default to off in release builds.
So, panda3d should be able to set it to on or off in any version of VS, but the important thing is to be clear about what value was used to compile it, so C++ consumers can use the same setting. (And it can't just be set in the Panda3D headers, since STL may be included first).
A good discussion of this is at :
https://connect.microsoft.com/VisualStu ... re-scl-0-c
Key quote is " Mismatch will be not detected by the VC8/VC9 linker, and will cause incomprehensible crashes".
I realize this post is old, but hope this helps others,
Sam
-
Sam
-
- Posts: 19
- Joined: Tue Mar 09, 2010 3:11 pm
- Location: LA, CA
Return to C++ coding using Panda3D
Who is online
Users browsing this forum: No registered users and 0 guests
| | |