Dear all,
i did some more digging/googling in this issue and i share
the opinion that - at least for the time being -
Tcl_Finalize() could be omitted on windows versions without
too much harm. Some background:
The Tcl manpage says:
*Tcl_Finalize* is similar to*Tcl_Exit* except that it does not exit
from
the current process. It is useful for cleaning up when a process is
finished using*Tcl* but wishes to continue executing, and when*Tcl*
is
used in a dynamically loaded extension that is about to be unloaded.
On some systems*Tcl* is automatically notified when it is being
unloaded, and it calls*Tcl_Finalize* internally; on these systems it not
necessary for the caller to explicitly call*Tcl_Finalize*. However, to
ensure portability, your code should always invoke*Tcl_Finalize* when
*Tcl* is being unloaded, to ensure that the code will work on all
plat-
forms.*Tcl_Finalize* can be safely called more than once.
For aolserver, it is questionable for me why we need
Tcl_Finalize() (the primarily purpose for Tcl_Finalize
according to its documentation is that the process wants to
continue without Tcl....), furthermore there seems to be
some magic involved, that "some systems .... call
Tcl_Finalize() ... automatically" (hinting most likely the
windows situation with the assembly code). Since finalize
tries to unload Tcl, there seems to be some race conditions
in this area on windows, at least when there are still are
multiple threads around. E.g. [1] says: "Because DLL
notifications are serialized, entry-point functions should
not attempt to communicate with other threads or processes.
Deadlocks may occur as a result."
Neither aolserver 4.0.10 nor naviserver call Tcl_Finalize(),
so i guess we can live with a 4.5.1+ version under windows
without it.
-gustaf neumann
[1] http://msdn.microsoft.com/en-us/library/ms682583.aspx
On 06.08.11 16:28, Maurizio Martignano wrote:
It is me again...
Well I noticed that the change I suggested about
Tcl_Finalize did not make it into CVS HEAD.
If it doesn't go there, I am afraid I will have to anyhow
introduce it myself in my distribution.
I need to have a working system. With that call still in,
the service can't (CANNOT) be stopped gracefully.
This is a matter of testing:
Take the system, make it run with a real OpenACS based
application (how about ]po[, or xowiki....) and see how it
works and see how it interacts with the system... Does it
start? Does it run? Does it stop properly?
For the time being in Windows 64 that function needs to be
out.
Thanks a lot,
Maurizio
Thank you,
Maurizio
*From:*AOLserver Discussion
[mailto:AOLSERVER@LISTSERV.AOL.COM] *On Behalf Of *Gustaf
Neumann
*Sent:* 06 August 2011 10:28
*To:* AOLSERVER@LISTSERV.AOL.COM
*Subject:* Re: [AOLSERVER] Aolserver Progress - Some few
examples....
Maurizio,
Tcl_Finalize() is supposed to work, and if it does now
work something is still broken in the windows version.
Omitting Tcl_Finalize() is removeing the symptom, not the
cause. It is not unlikely that something else will have
the same problem due to this cause.
When Tcl_Finalize() is not run, the registered exit
handlers are not executed. How serious this is depends on
the exit handlers. You are right, that the "memory leak"
does not matter due to the shutdown. The difference is
like between a graceful and an ungraceful shutdown.
-gustaf
On 05.08.11 16:29, Maurizio Martignano wrote:
Dear Gustav,
I understand your concerns about
Tcl_Finalize... but it is called just when the
process/service is about to end.
Once it ends the OS takes charges and releases the
process/service resources (memory included).
You can make an easy test.... Have Aolserver / nsd running
on a big application... observe the OS resources given to
the process
and released when I finishes. Do this twice: with
Tcl_Finalize on and Tcl_Finalize commented out. And see if
you can find any difference.
Ciao,
Maurizio
--
AOLserver - http://www.aolserver.com/
To Remove yourself from this list, simply send an email to
<lists...@listserv.aol.com> with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject:
field of your email blank.