[bug #4465] (grass) Re: [bug #2937 [GRASS-dev] povray and grass

Request Tracker grass-bugs at intevation.de
Wed May 17 06:24:45 EDT 2006


this bug's URL: http://intevation.de/rt/webrt?serial_num=4465
-------------------------------------------------------------------------


Hamish wrote:

> > There are other modules that happen to fail due to "too many nested
> > evaluations (infinite loop?)" in GUI. Those I rememeber are v.in.ogr
> > and v.extract. See http://intevation.de/rt/webrt?serial_num=2937
> > 
> > Could it be related?
> 
> I stick by my theory that tcl throws this error when it it is asked
> to process a single string repeatedly in very quick succession.

No. As the error message suggests, Tcl throws this error if the
evaluation stack gets too deep, which is normally due to infinite
recursion. E.g.:

	% proc foo {} {foo}
	% foo
	too many nested evaluations (infinite loop?)

A less obvious case is calling "update" from within an event handler
(e.g. the fileevent handler for process output). If the events occur
more rapidly than they can be processed, each call to update will
result in a nested call to the event handler.

Looking at the code for lib/gtcltk/gronsole.tcl, I notice that:

1. Gronsole::execbg registers Gronsole::file_callback as a fileevent
handler.

2. Gronsole::file_callback calls Gronsole::readout.

3. Gronsole::readout calls Gronsole::output_to_gronsole.

4. Gronsole::output_to_gronsole calls Gronsole::progress.

5. Gronsole::progress calls ProgressBar::_modify (via the widget's
_modify method).

6. ProgressBar::_modify calls update. If more output is available,
this will result in a nested call to Gronsole::file_callback, and so
on.

The last point is the problem; it should rely upon the caller to call
update if necessary (for the fileevent handler, it isn't; the update
should be performed from the event loop when Gronsole::file_callback
returns).

Removing the update from ProgressBar::_modify should eliminate the
problem. Changing it to "update idletasks" might; I'm not sure whether
file events are treated as idle events.

If you don't want to modify the BWidget library, modify the
Gronsole::file_callback function to prevent nested evaluation, e.g.

	namespace eval Gronsole {
		variable _busy
		...
		set _busy 0
	}
	
	...
	
	proc Gronsole::file_callback {path ci mark fh} {
		variable _busy
		if {$_busy} return
		set _busy 1
	
		# do stuff
	
		set _busy 0
	}

-- 
Glynn Clements <glynn at gclements.plus.com>


--- Headers Follow ---

>From glynn at gclements.plus.com  Wed May 17 12:24:44 2006
Return-Path: <glynn at gclements.plus.com>
Delivered-To: grass-bugs at lists.intevation.de
Received: from mail.intevation.de (aktaia [212.95.126.10])
	by lists.intevation.de (Postfix) with ESMTP id BCF8A1006C9
	for <grass-bugs at lists.intevation.de>; Wed, 17 May 2006 12:24:44 +0200 (CEST)
Received: from localhost (localhost [127.0.0.1])
	by mail.intevation.de (Postfix) with ESMTP id 7943D36D7F
	for <grass-bugs at lists.intevation.de>; Wed, 17 May 2006 12:24:44 +0200 (CEST)
Received: from cerise.gclements.plus.com (82-71-30-52.dsl.in-addr.zen.co.uk [82.71.30.52])
	by mail.intevation.de (Postfix) with ESMTP id D70D336D71
	for <grass-bugs at intevation.de>; Wed, 17 May 2006 12:24:41 +0200 (CEST)
Received: from cerise.gclements.plus.com (localhost [127.0.0.1])
	by cerise.gclements.plus.com (8.13.6/8.13.6) with ESMTP id k4HAOcKY025420;
	Wed, 17 May 2006 11:24:38 +0100
Received: (from glynn at localhost)
	by cerise.gclements.plus.com (8.13.6/8.13.6/Submit) id k4HAOb2n025417;
	Wed, 17 May 2006 11:24:37 +0100
From: Glynn Clements <glynn at gclements.plus.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-ID: <17514.63973.369162.189110 at cerise.gclements.plus.com>
Date: Wed, 17 May 2006 11:24:37 +0100
To: Hamish <hamish_nospam at yahoo.com>
Cc: Maciek Sieczka <werchowyna at epf.pl>, grass-bugs at intevation.de,
	grass-dev at grass.itc.it
Subject: Re: [bug #2937 [GRASS-dev] povray and grass
In-Reply-To: <20060517125920.657d1e82.hamish_nospam at yahoo.com>
References: <1147705369.25093.9.camel at forbin>
	<20060515175219.8e45ce43.werchowyna at epf.pl>
	<1147714359.26176.3.camel at forbin>
	<20060515195310.ecf3bace.werchowyna at epf.pl>
	<20060516130742.6fab6356.hamish_nospam at yahoo.com>
	<20060516082204.5d67660f.werchowyna at epf.pl>
	<20060517125920.657d1e82.hamish_nospam at yahoo.com>
X-Mailer: VM 7.07 under 21.4 (patch 15) "Security Through Obscurity" XEmacs Lucid
X-Spam-Status: No, hits=-4.9 tagged_above=-999.0 required=3.0 tests=BAYES_00
X-Spam-Level: 

-------------------------------------------- Managed by Request Tracker




More information about the grass-dev mailing list