You are viewing a plain text version of this content. The canonical link for it is here.
Posted to websh-dev@tcl.apache.org by Ronnie Brunner <ro...@netcetera.ch> on 2002/07/25 16:47:36 UTC
memory leaks fixed
I just closed another leak and now I can't produce any unexpected
memory consumption in mod_websh anymore.
Please let me know if you still think it leaks anywhere. Note that
running multiple (and different) requests in the same interp causes
websh to grow initially, until all the code is sourced and run
once. (You can definitly still write an application that leaks: just
add something like
global foo
if {![info exists foo]} {
set foo "a bar"
} else {
append foo " and another bar"
}
to it and you will logically eat memory until tomorrow. For that
reason it might be cool to set a limit on the maximum requests in any
interpreter. I'll check in the webshconf.tcl with that limit set to
a 1000 requests. Hope that's ok.
Summary of fixed leaks
======================
- requestFillRequestValues: a New Tcl_Obj was created, but never used
(It seems that Tcl doesn't clean that up, if there is never a
Tcl_DecrRefCount, which means you have to call Tcl_IncrRefCount to
be able to roperly call Tcl_DecrRefCount and have the object cleaned
up. -> just commented the call)
- cfg_Init and request_Init both called Tcl_CreateThreadExitHandler,
which results in a leak when interpreter are created and deleted.
(I don't know, why these handlers are added in the first place -> I
commented them out, but added a fixme, because I can't reach Simon,
who is on vacation). IMHO go for the release like this is ok.
- web::putx leaked big time, because the paresed strings (DStrings)
were never freed (strange that no one noticed this earlier)
Ronnie
------------------------------------------------------------------------
Ronnie Brunner ronnie.brunner@netcetera.ch
Netcetera AG, 8040 Zuerich phone +41 1 247 79 79 fax +41 1 247 70 75
---------------------------------------------------------------------
To unsubscribe, e-mail: websh-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: websh-dev-help@tcl.apache.org
Re: memory leaks fixed
Posted by "David N. Welton" <da...@dedasys.com>.
Ronnie Brunner <ro...@netcetera.ch> writes:
> Ok. I'll think of something. Only problem: webshconf.tcl seems in an
> odd place then. Can I move it to the websh directory as well? (I'll
> want to rename it to websh.conf however)
Sure, as long as everything works.
> As for the other files: if we don't think it's a (security) problem
> we could actually integrate the websh.com.gen stuff into the site as
> a visual example of how a site is set up with mod_websh. Problems
> with that? Proper naming for that would be something like
If you are happy with the style, and don't think there are any undue
risks, I'm ok with it.
Personally, I think it is a little bit confusing to follow, and that
might put people off. We should be sure to comment everything well if
we go this route.
> websh.conf
> websh.interpclass
> websh.interpclass.initializer
> Like this we have everything in one place and it kind of speaks for
> itself. (Only problem is that websh.conf has some absolute paths
> that would show.)
For now, I would be happy to just get it up and running, and then add
it in later.
--
David N. Welton
Consulting: http://www.dedasys.com/
Personal: http://www.dedasys.com/davidw/
Free Software: http://www.dedasys.com/freesoftware/
Apache Tcl: http://tcl.apache.org/
---------------------------------------------------------------------
To unsubscribe, e-mail: websh-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: websh-dev-help@tcl.apache.org
Re: memory leaks fixed
Posted by Ronnie Brunner <ro...@netcetera.ch>.
> It's probably best to leave things alone as much as possible for now.
> After the release, we will have a freer hand to tweak the code,
> without inadvertently creating more problems.
> > I'll try to work on the web site over the weekend. Please let me
> > know, where I should put files like websh.com.gen if I want to take
> > them out of the document root. (IMHO this could be the same
> > directory as webshconf.tcl) I will change some file names as well, I
> > hope that's ok.
>
> Hrm. From the point of view of CVS, it seems easier to leave
> everything in the tcl-site CVS module... maybe we could change the
> name to .conf, and then disallow requests for *.conf files?
Ok. I'll think of something. Only problem: webshconf.tcl seems in an
odd place then. Can I move it to the websh directory as well? (I'll
want to rename it to websh.conf however)
As for the other files: if we don't think it's a (security) problem we
could actually integrate the websh.com.gen stuff into the site as a
visual example of how a site is set up with mod_websh. Problems with
that? Proper naming for that would be something like
websh.conf
websh.interpclass
websh.interpclass.initializer
Like this we have everything in one place and it kind of speaks for
itself. (Only problem is that websh.conf has some absolute paths that
would show.)
------------------------------------------------------------------------
Ronnie Brunner ronnie.brunner@netcetera.ch
Netcetera AG, 8040 Zuerich phone +41 1 247 79 79 fax +41 1 247 70 75
---------------------------------------------------------------------
To unsubscribe, e-mail: websh-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: websh-dev-help@tcl.apache.org
Re: memory leaks fixed
Posted by "David N. Welton" <da...@dedasys.com>.
Ronnie Brunner <ro...@netcetera.ch> writes:
> I can't really reproduce that with the current setup: it's cleaner
> setup with a proper initializer, so the main code gets executed only
> once per interpreter. -> I have no memory leak like this. We will
> find the remaining leak eventually, but I'm giving up for now.
It's probably best to leave things alone as much as possible for now.
After the release, we will have a freer hand to tweak the code,
without inadvertently creating more problems.
> I'll try to work on the web site over the weekend. Please let me
> know, where I should put files like websh.com.gen if I want to take
> them out of the document root. (IMHO this could be the same
> directory as webshconf.tcl) I will change some file names as well, I
> hope that's ok.
Hrm. From the point of view of CVS, it seems easier to leave
everything in the tcl-site CVS module... maybe we could change the
name to .conf, and then disallow requests for *.conf files?
--
David N. Welton
Consulting: http://www.dedasys.com/
Personal: http://www.dedasys.com/davidw/
Free Software: http://www.dedasys.com/freesoftware/
Apache Tcl: http://tcl.apache.org/
---------------------------------------------------------------------
To unsubscribe, e-mail: websh-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: websh-dev-help@tcl.apache.org
Re: memory leaks fixed
Posted by Ronnie Brunner <ro...@netcetera.ch>.
David,
I can't really reproduce that with the current setup: it's cleaner
setup with a proper initializer, so the main code gets executed only
once per interpreter. -> I have no memory leak like this.
We will find the remaining leak eventually, but I'm giving up for now.
I'll try to work on the web site over the weekend. Please let me know,
where I should put files like websh.com.gen if I want to take them out
of the document root. (IMHO this could be the same directory as
webshconf.tcl) I will change some file names as well, I hope that's ok.
> @ashland [~] $ ps auxw | grep 'apache -X'
> www-data 28621 14.0 1.6 45060 4236 pts/1 S 10:18 0:00 apache -X
> davidw 28624 0.0 0.2 1812 700 pts/0 S 10:18 0:00 grep apache -X
> @ashland [~] $ ps auxw | grep 'apache -X'
> www-data 28621 32.9 1.9 45540 4856 pts/1 S 10:18 0:08 apache -X
> davidw 28628 0.0 0.2 1812 700 pts/0 S 10:19 0:00 grep apache -X
>
> There is still something going on with index.ws3/ but the leakage
> shown is after 1000 requests, so it's definitely tollerable.
------------------------------------------------------------------------
Ronnie Brunner ronnie.brunner@netcetera.ch
Netcetera AG, 8040 Zuerich phone +41 1 247 79 79 fax +41 1 247 70 75
---------------------------------------------------------------------
To unsubscribe, e-mail: websh-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: websh-dev-help@tcl.apache.org