[reSIProcate] Weird problem with Mutex

Matthias Moetje - TERASENS GmbH moetje at terasens.com
Thu Jun 22 18:58:25 CDT 2006


Alexander and Matt,
 
 
thanks very much for checking this. I have now re-downloaded
the complete stack, auto-upgraded the VC7.1 files and with this
setup the error went away.. :-)
 
Since the code files are identical, the problem must be due to 
the compilation settings. Still strange how compilation settings
can make this kind of error happen, but at least I have a better
idea now about where the problem lies...
 
Thanks again and best regards,

Matthias Moetje

 	
TERASENS GmbH
Augustenstraße 24
80333 Munich
GERMANY	  	 Phone:
Fax:
e-mail:
Web:	 	+49.89.143370-0
+49.89.143370-22
info at terasens.com <mailto:info at terasens.com> 
www.terasens.com <http://www.terasens.com/> 	
 


________________________________

	From: resiprocate-devel-bounces at list.sipfoundry.org [mailto:resiprocate-devel-bounces at list.sipfoundry.org] On Behalf Of Alexander Altshuler
	Sent: Wednesday, June 21, 2006 8:20 AM
	To: resiprocate-devel at list.sipfoundry.org
	Subject: RE: [reSIProcate] Weird problem with Mutex
	
	

	It works. VS 7.1

	 

	-----Original Message-----
	From: resiprocate-devel-bounces at list.sipfoundry.org [mailto:resiprocate-devel-bounces at list.sipfoundry.org] On Behalf Of Matthias Moetje - TERASENS GmbH
	Sent: Wednesday, June 21, 2006 4:51 AM
	To: resiprocate-devel at list.sipfoundry.org
	Subject: RE: [reSIProcate] Weird problem with Mutex

	 

	Could perhaps anyone using Visual Studio 8.0 (or maybe 7.1) be so kind

	to paste these few lines of code into basicRegister to see if this problem

	can be reproduced if compiled in release config?

	Thanks,

	Matthias 

		 

		
________________________________


		From: resiprocate-devel-bounces at list.sipfoundry.org [mailto:resiprocate-devel-bounces at list.sipfoundry.org] On Behalf Of Matthias Moetje - TERASENS GmbH
		Sent: Friday, June 16, 2006 11:22 PM
		To: resiprocate-devel at list.sipfoundry.org
		Subject: [reSIProcate] Weird problem with Mutex

		Hi,

		 

		I was finally able to find a minimal piece of code to reproduce 

		an issue I am fighting against during the last days. To reproduce

		you just need to paste the following code to the start of the 

		main() function in basicRegister for example:

		 

		
________________________________


		#include "resip/dum/UserAuthInfo.hxx"

		
________________________________


		resip::SipStack* mStack;
		resip::DialogUsageManager* mDum;

		mStack = new resip::SipStack();
		mDum = new resip::DialogUsageManager(*mStack);

		mDum->addTransport(UDP,5060);
		mDum->addTransport(TCP,5060);

		UserAuthInfo* msg = new UserAuthInfo("asd","asd","asd","asd");
		mDum->post(msg); 

		
________________________________


		Now, the following happens during mDum->post:

		in TransactionUser::post(Message* msg), mFifo.add is called.

		then in TimeLimitFifo<Msg>::add it constructs the lock object:

		Lock::Lock(Lockable & lockable, LockType lockType)

		in this constructor, I get an access violation when it tries to 
		call myLockable.lock();

		When I examine the myLockable I can see that the virtual function
		pointers seem corrupted:

		 

		Usually (that means, when post is called from the dum or stack 
		thread in my application) in the vfptr[] array I can see valid pointers,
		but in this case they are wrong.

		The mID (Windows Critical Section structure) member of the
		Mutex (which inherits from Lockable) seems to remain OK, 
		just the vfptr to the base methods  is wrong.

		I don't really have an idea why this is happening and I feel like 
		banging my head gainst the wall. In my application everything works
		fine. If I put a breakpoint in one of these functions during normal
		operation (inbound, outbound calls, client registration etc.), the
		lockable is always OK, but as soon as I call mDum->post 
		manually, the lockable seems to be damaged and I get an access
		violation exception.

		If I compile the application in debug mode, the problem does not exist!

		I am using VS 2005. Here are the relevant configuration settings I 
		am using for basicRegister:

		Optimization: Disabled
		Inline Function Expansion: Default
		Favor Size or Speed: Neither
		Omit Frame Pointers: No
		Enable String Pooling: No
		Runtime Library: Multi-threaded DLL
		Buffer security check: Yes

		Linker:

		Generate Debug Info: Yes
		References: Default
		Enable COMDAT Folding: Default
		Link time Code Generation: Use Link Time CG

		I would be very thankful for any comments as I am running out of
		ideas on this subject (apart from implementing a simple critical 
		section directly without the lockable and mutex objects).

		Thanks and best regards,

		Matthias Moetje

 

TERASENS GmbH
Augustenstraße 24
80333 Munich
GERMANY

 

Phone:
Fax:
e-mail:
Web:

 

+49.89.143370-0
+49.89.143370-22
info at terasens.com <mailto:info at terasens.com> 
www.terasens.com <http://www.terasens.com/> 

		 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.resiprocate.org/pipermail/resiprocate-devel/attachments/20060623/61b020f3/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TERASE1.jpg
Type: image/jpeg
Size: 2937 bytes
Desc: TERASE1.jpg
URL: <http://list.resiprocate.org/pipermail/resiprocate-devel/attachments/20060623/61b020f3/attachment.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 24834 bytes
Desc: image001.jpg
URL: <http://list.resiprocate.org/pipermail/resiprocate-devel/attachments/20060623/61b020f3/attachment-0001.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.jpg
Type: image/jpeg
Size: 2937 bytes
Desc: image002.jpg
URL: <http://list.resiprocate.org/pipermail/resiprocate-devel/attachments/20060623/61b020f3/attachment-0002.jpg>


More information about the resiprocate-devel mailing list