Forum OpenACS Development: Proposal to make slight adjustments to config.tcl

I'd like to suggest a minor change to the config.tcl file on the "oacs-5-0" branch, to accomodate both AOLserver 4 and 3.x with a minimum of fuss.

At the same time I also propose an increase of the default stacksize (without knowing exactly what would be a reasonable default) ...

If folks think this is reasonable, I'd like to commit it before the launch of 5.0.

Comments?

Index: config.tcl
===================================================================
RCS file: /cvsroot/openacs-4/etc/config.tcl,v
retrieving revision 1.12
diff -u -r1.12 config.tcl
--- config.tcl  11 Nov 2003 16:51:47 -0000      1.12
+++ config.tcl  30 Nov 2003 22:39:01 -0000
@@ -53,7 +53,6 @@
 ns_param   nssha1             ${bindir}/nssha1.so
 ns_param   nscache            ${bindir}/nscache.so
 ns_param   nsrewrite          ${bindir}/nsrewrite.so
-ns_param   libtdom            ${bindir}/libtdom.so
                                                                                
 #---------------------------------------------------------------------
 # nsopenssl will fail unless the cert files are present as specified
@@ -74,9 +73,13 @@
 #ns_param   nscgi              ${bindir}/nscgi.so
 #ns_param   nsjava             ${bindir}/libnsjava.so
                                                                                
-# Required for AOLserver 4
-#ns_param   nsdb               ${bindir}/nsdb.so
-
+if { [ns_info version] >= 4 } {
+    # Required for AOLserver 4.x
+    ns_param   nsdb               ${bindir}/nsdb.so
+} else {
+    # Required for AOLserver 3.x
+    ns_param   libtdom            ${bindir}/libtdom.so
+}
                                                                                
 #---------------------------------------------------------------------
 #
@@ -143,7 +146,7 @@
                                                                                
 ns_section ns/threads
 ns_param   mutexmeter         true      ;# measure lock contention
-ns_param   stacksize          500000
+ns_param   stacksize          [expr 1000 * 1024]
                                                                                
 #
 # MIME types.
Collapse
Posted by Don Baccus on
The version checking bit looks good, yes.

Is there evidence that a 1/2 MB stack is insufficient?  .LRN seems to run OK for me on my x86 box with 1/2 MB.  Of course as 64-bit machines become more common stack requirements will increase, too ...

Collapse
Posted by Joel Aufrecht on
Looks good with one caveat: shouldn't this be part of a changeset that includes the code to load tdom in AOLserver4?
Collapse
Posted by Jeff Davis on
I think we should add the following to 0-acs-init.tcl
if {[string equal {} [info commands domNode]]} { 
    if {[ns_info version] == 3} {
        ns_log Error "0-acs-init.tcl: domNode command not found -- libtdom.so not loaded?"
    } elseif {[ns_info version] > 3} {
        if {[catch {set version [package require tdom]} errmsg]} { 
            ns_log Error "0-acs-init.tcl: error loading tdom: $errmsg" 
        } else {
            foreach {major minor point} [split $version .] { break }
            if {$major == 0 
                && ( $minor < 7 || ($minor == 7 && $point < 8))} { 
                ns_log Error "0-acs-init.tcl: please use tdom version 0.7.8 or greater (you have version $version)"
            }
        }
    }
}
Collapse
Posted by Alfred Werner on
the only thing that would concern me about adding that is that if the next version of tdom was (e.g) 0.8 you would probably get an error that point is unset... I think a little layer of either catches or use regsub to count the dots and then an if branch is necessary.
Collapse
Posted by russ m on
if stacksize in the default config is being changed, can it explicitly be set to a multiple of 8k with a comment that it is required to be so for AOLserver to run under OSX?
Collapse
Posted by Ola Hansson on
That looks good, Jeff, but do all versions of AOLserver 3.x really return version "3"? (AOLserver 4 from cvs HEAD returned "4.1", at least.)

Don: I have no evidence that 500000 bytes are not enough. I just decided it was in accordance with Moore's law to increase it 😊

Joel: I dug up the AOLserver 4 installation instructions from here https://openacs.org/forums/message-view?message_id=135723 and what differs form 3.x - when it comes to tDom - is basically:

- a different tDom "configure" setting
- a symlink to the tdom.tcl "module"
- a couple of config.tcl file changes

It would be nice of course if the AOLserver 4 instructions (from the thread I mentioned) was merged with the documentation, but I'm not sure what your plan on this is for the upcoming (5.0) release, though.

Anyway, the changes I suggest to config.tcl and Jeff's check that the correct module is loaded (his check does not in itself load all the necessery tdom stuff) won't hurt folks who choose to employ AOLserver 3.x.

Russel: Sure, why not? Please let us know exactly what you think is a good expression (and a comment) to put in there. Thanks.

/Ola

Collapse
Posted by russ m on
Leaving aside the question of what a good stack size would be, I was thinking of something like

# The per-thread stack size must be a multiple of 8k for AOLServer to run under MacOS X
ns_param stacksize [expr 128 * 8192]
Collapse
Posted by Jeff Davis on
I don't think a symlink for tdom.tcl is either necessary or desirable and package require is all you need to do.

Here is what the README.AOL says in tdom 0.7.8:

For AOLserver 4.x:

      This version supports standard Tcl "pacakge require" mechanism
      so you can just:

        make install

      and it will install the library in the proper place. All you
      need to do then is to use "ns_eval package require tdom" to
      load the library and register it for every connection thread.
      You should add this command to some of the Tcl startup files
      in modules/tcl, so it loads the library on server startup.
I would prefer the package require in 0-acs-init.tcl so we can make it more transparent what it going in and refrain from twiddling a default aolserver install.
Collapse
Posted by Ola Hansson on
Since this didn't meet any big objections and is too trivial to require a TIP, I think, I've committed the discussed changes (to etc/config.tcl and tcl/0-acs-init.tcl) to the oacs-5-0 branch.

Jeff: Would you mind taking a look at tcl/0-acs-init.tcl? Where I placed your code may not be where you planned it ...

/Ola

Collapse
Posted by Jeff Davis on
looks just fine to me.  Thanks for taking care of that...
Collapse
Posted by Ola Hansson on
Alfred,

Just to test it I put "set version 8.0" right in front of the foreach, and there was no error message in the server log after I restarted.

I think there should be no problem.

/Ola

Collapse
Posted by Ola Hansson on
set version 0.8 I mean ...
Collapse
Posted by Jeff Davis on
foreach {a b c} {x y} {break} will create variable c if needed but will set it to the empty string so it's not a problem.
it could be a problem if the version was 0.8a or something since then the numeric comparison might break but I don't think they number them that way (and it's 0.8.0 in cvs now).
Collapse
Posted by Alfred Werner on
Was just trying to be proactive :) Glad it won't break!