Re: AW: AW: Patch to DorothyLocker

"Thomas Klaeger" <[email protected]> Sat, 25 Sep 2004 13:58:58 +0200
Newsgroups gmane.comp.pythin.pyds.devel
Message-ID <415579A2.14622.9178EE@localhost>
--Message-Boundary-26696
Content-type: text/plain; charset=US-ASCII
Content-transfer-encoding: 7BIT
Content-description: Mail message body

Hello!

One problem is that DorothyLocker gets the full stack trace every time - and this 
needs some additional time even if the locking succeeds without waiting.

A small improvement provides the following patch. With this patch the stack trace is 
built without reading the corresponding source lines.

Garth, do you see a possibility to do the work without getting the stack trace every 
time? I envision something like getting just the callers frame on acquire/release and 
getting the full stack trace only if checking for re-acquire within the same thread.

Regards,
Thomas

> Even though it does work now, it is horribly slow. Any idea what slows down the
> system that  much? Even if I don't get that much lock messages, the system is
> crawling with every access. I noticed this mostly in the aggregator, but other
> pages are much slower, too. For example the shutdown takes forever. And the
> system takes far too much CPU resources. I actually kill -9 the system because
> the shutdown took forever.
> 
> Without -v it works as expected. So there must still be a bug in the
> DorothyLocker stuff.
> 
> bye, Georg
> 




--Message-Boundary-26696
Content-type: text/plain; charset=US-ASCII
Content-transfer-encoding: 7BIT
Content-description: Text from file '200409251146-dorothy.diff'

Index: PyDS/DorothyLocker.py
===================================================================
RCS file: /pyds/PyDS/PyDS/DorothyLocker.py,v
retrieving revision 1.4
diff -u -r1.4 DorothyLocker.py
--- PyDS/DorothyLocker.py	23 Sep 2004 17:25:23 -0000	1.4
+++ PyDS/DorothyLocker.py	25 Sep 2004 09:30:20 -0000
@@ -76,7 +76,7 @@
 	"""Distil a calling context, ignoring certain code objects and 
 	function names."""
 	try: 
-		stack = inspect.stack()
+		stack = inspect.stack(context=0)
 		codestack = []
 		for frame, filename, lineno, co_name, lines, index in stack: 
 			if frame.f_code is context.func_code \

--Message-Boundary-26696--