Re: [AOLSERVER] 3.3+ad13 w/ Tcl 8.4.1 ?

2003-01-07 Thread Elizabeth Thomas
In a message dated 1/7/03 2:58:23 PM Eastern Standard Time, [EMAIL PROTECTED] writes:

Disable the fast allocator on AOLserver (which was the default mode if nsd was started without the -z flag) and then disable the fast allocator when building Tcl 8.4 with -DUSE_THREAD_ALLOC=0.  

Some additional info for anyone who goes down this path:

Building AOLServer 3.5.2 w/tcl 8.4 on Solaris without the fast memory allocator (for purifying purposes), I encountered the following:

I had to modify the tcl Makefile and remove the -DUSE_THREAD_ALLOC flag altogether in order to build without the fast memory allocator. Setting it to 0 didn't seem to work.

I then encountered a small bug in nsthread/nsthreadtest.c w/respect to this - if tcl has been built without the fast memory allocator, you'll get a link error because it references Tcl_GetMemoryInfo, which isn't defined without USE_THREAD_ALLOC (a hack to nsthread.c to avoid the call will allow your build to complete)  (not sure if this is an issue for pre-3.5)

-Elizabeth


Elizabeth Thomas
Principal Software Engineer
America OnLine, Inc.



Re: [AOLSERVER] 3.3+ad13 w/ Tcl 8.4.1 ?

2003-01-07 Thread Jim Davidson

In a message dated 1/6/03 8:59:58 PM, [EMAIL PROTECTED] writes:


On Mon, Jan 06, 2003 at 01:54:05PM -0800, Jeff Hobbs wrote:
> > Has anyone successfully built and used Tcl 8.4.1 (or any flavor of 8.4
> > for that matter) with AOLserver 3.3+ad13, or a similar AOLserver
> > version (aka, pre-3.5)?  If you have, could you tell me how you built
> > it?

> I don't have that version of AOLServer to compare against, but Tcl 8.4.1
> should not require any core patching to work with AOLServer now.  I'm
> not sure if that also accompanied changes to AOLServer code ...

Yes, that's what I don't know either, whether Tcl 8.4.1 can be used
stock with ALL versions of AOLserver, or whether AOLserver was changed
c. versions 3.5 and 4.0 to be able to use the stock Tcl.  Who knows
for sure?

I did try to hack up Tcl 8.4.1 the way 8.3.2 was hacked for AOLserver
3.3 (+ad13, although I doubt that matters in this context).  I failed
miserably.  For your amusement, I've attached my README.AOLSERVER with
all my notes on what I did on how it broke.

On the other hand a completley stock 8.4.1 w/ 3.3+ad13 DID build
libtcl8.4g.a and nsd8x successfully, but a brief test showed that it
DEFINITELY wasn't working right - crashing with bus errors, bad stuff
like that.

Back in July, Roberto Mello reported that his AOLserver 3.3+ad13 w/
Tcl 8.4b1 crashed several times while testing, but I don't know how he
built it.

I'll probably try AOLserver 3.5 next, but it would be nice to know if
and how older versions of AOLserver can be made to work with Tcl 8.4.

--
Andrew Piskorski <[EMAIL PROTECTED]>
http://www.piskorski.com



Hi,

If I recall correctly, the mods to Tcl 8.3.2 for AOLserver 3.x were in a few areas:

- Fixes to a memory leak or two and use of thread safe functions (e.g., ns_readdir instead of readdir).   Tcl 8.4 should have all these fixes now.

- Setting default channel encoding to binary just for backwards compatibility with old Tcl code. I think we gave up on this in 3.5 and 4.0 after fixing most places it was a problem (e.g., the ns_form code for multipart forms).   I'd suggest ignoring that previous hack.

- Use of nsthreads instead of Tcl Win32 or pthread code for better platform independence. AOLserver could be compiled against non-pthread Unix thread libraries in the past (e.g., SGI multiprocessing API's) but now requires pthreads so it should be fine to leave the Tcl thread code as is.

- Redirection of Tcl's memory allocation to AOLserver's fast thread allocator and custom Tcl_Obj allocator which was necessary because standard Tcl code would lock up under moderate load here at AOL.   Tcl 8.4 now includes AOLserver's fast allocator in the core.

So, if you build Tcl 8.4 just like you would for AOLserver 3.x, specifically with the --enable-threads, and then do minimal hacks to AOLserver makefiles things should compile find.   I think that's what you did but running it resulted in crashes.   I'm guessing the crashes were related to the last point above.   The reason is that linking old AOLserver code in this manner would have Tcl and AOLserver using different memory allocators and sometimes they get mixed up (e.g., an ns_malloc later Tcl_Free'd or free'd) - there's an example of this mixup in the old nsperm code.   To fix this, you could try one or both of the following:

1.   Modify nsthreads to use Tcl_Alloc, Tcl_Free.   This is how AOLserver 3.5 and 4.0 work.   It adds a dependency on Tcl for nsthreads but that shouldn't be hard to work around.   In fact, you may be able to use the nsthread library for 3.5 directly.   This would fix mixing ns_malloc with Tcl_Alloc but would not fix mixing with malloc/free.

2.   Disable the fast allocator on AOLserver (which was the default mode if nsd was started without the -z flag) and then disable the fast allocator when building Tcl 8.4 with -DUSE_THREAD_ALLOC=0.   This would direct Tcl_Alloc and ns_malloc to normal malloc.   If you then find performance a problem, you could consider pre-loading some faster malloc replacement (e.g., www.hoard.org).

If that doesn't fix the crash, send a stack trace - it might remind me of some other Tcl/AOLserver weirdness from long ago :)

-Jim


Re: [AOLSERVER] 3.3+ad13 w/ Tcl 8.4.1 ?

2003-01-06 Thread Andrew Piskorski
On Mon, Jan 06, 2003 at 01:54:05PM -0800, Jeff Hobbs wrote:
> > Has anyone successfully built and used Tcl 8.4.1 (or any flavor of 8.4
> > for that matter) with AOLserver 3.3+ad13, or a similar AOLserver
> > version (aka, pre-3.5)?  If you have, could you tell me how you built
> > it?

> I don't have that version of AOLServer to compare against, but Tcl 8.4.1
> should not require any core patching to work with AOLServer now.  I'm
> not sure if that also accompanied changes to AOLServer code ...

Yes, that's what I don't know either, whether Tcl 8.4.1 can be used
stock with ALL versions of AOLserver, or whether AOLserver was changed
c. versions 3.5 and 4.0 to be able to use the stock Tcl.  Who knows
for sure?

I did try to hack up Tcl 8.4.1 the way 8.3.2 was hacked for AOLserver
3.3 (+ad13, although I doubt that matters in this context).  I failed
miserably.  For your amusement, I've attached my README.AOLSERVER with
all my notes on what I did on how it broke.

On the other hand a completley stock 8.4.1 w/ 3.3+ad13 DID build
libtcl8.4g.a and nsd8x successfully, but a brief test showed that it
DEFINITELY wasn't working right - crashing with bus errors, bad stuff
like that.

Back in July, Roberto Mello reported that his AOLserver 3.3+ad13 w/
Tcl 8.4b1 crashed several times while testing, but I don't know how he
built it.

I'll probably try AOLserver 3.5 next, but it would be nice to know if
and how older versions of AOLserver can be made to work with Tcl 8.4.

--
Andrew Piskorski <[EMAIL PROTECTED]>
http://www.piskorski.com


Tcl8.4.1 for AOLserver
--

I tried building Tcl 8.4.1 with AOLserver 3.3+ad13 two different ways.
One, stock Tcl with basically no changes.  Two, with my attempts to
hack Tcl 8.4.1 in the same ways Tcl 8.3.2 was hacked for AOLserver.

In both cases, the following changes apply:

../include/Makefile.global :

  8.4.1: You have to change the following lines like so:
  [EMAIL PROTECTED], 2003/01/06 18:17 EST

#TCL8X_DIR=tcl8.3.2
TCL8X_DIR=tcl8.4.1
#TCL8X_LIB=libtcl8.3g.a
TCL8X_LIB=libtcl8.4g.a

[EMAIL PROTECTED], 2003/01/06 15:08 EST


Tcl8.4.1, stock, for AOLserver
--

Stock Tcl 8.4.1, aolserver/tcl8.4.1/Makefile copied identically from
3.3+ad13 aolserver/tcl8.2.2/Makefile:

Note that I did NOT use "--enable-threads".

aolserver/tcl8.4.1/unix/libtcl8.4g.a - Built successfully, but with
the following weird warnings:

  In file included from ./../generic/regcomp.c:33:
  ../generic/regguts.h:58: warning: `NDEBUG' redefined
  *Initialization*:1: warning: this is the location of the previous definition
  
  ./../generic/tclIOUtil.c: In function `Tcl_Stat':
  ./../generic/tclIOUtil.c:110: warning: integer overflow in expression

aolserver/nsd/nsd8x - Built successfully!

TODO: Does it work?  I have not tested.  [EMAIL PROTECTED],
2003/01/06 19:12 EST


Tcl8.3.2 for AOLserver
--

This directory contains a subset of the Tcl8.3.2 files required to build
the nsd8x AOLserver.  The following directories where removed:

mac tests tools library doc unix/dltest

  8.4.1:

  I did the same, except I left unix/dltest as for some reason Tcl
  wouldn't build without it, even though the Makefile has
  "--disable-shared".  [EMAIL PROTECTED], 2003/01/06 15:08 EST


Otherwise, the files are unchanged except for the following:

Makefile:

New file in this directory which will execute unix/configure
with the correct flags and then make libtcl8.3.a with
a CFLAGS used to build AOLserver.

  8.4.1:

  Initially I copied the Makefile verbatim, had "No rule to make
  target `libtcl8.4g.a'" build problems, added "--enable-threads".

generic/tclIO.c:

Changed channel translation mode to binary by default.

  8.4.1:

  Made same changes as in 8.3.2.  Code is a little different though -
  8.4.1 seems to have taken some code from the AOLserver version, a
  few other differences, e.g. this was added in 8.4.1:
  [EMAIL PROTECTED], 2003/01/06 17:31 EST

Tcl_EventuallyFree((ClientData) chanPtr, TCL_DYNAMIC);

generic/tclObj.c:
generic/tclInt.h:

Changed the Tcl_Obj allocate and free to called ckalloc/ckfree
directly instead of maintaining the object "cache".  The idea
is that the AOLserver's -z allocator, utilized by ckalloc/ckfree,
is faster than the object cache with required mutex lock.

  8.4.1:

  I got tired and didn't make any changes at all.  Plus I think this
  stuff may already be handling it the way AOLserver wants.
  [EMAIL PROTECTED], 2003/01/06 17:44 EST

generic/nsthreads.c:

  8.4.1:

  This wasn't mentioned in the 8.3.2 notes, but 8.3.2/AOLserver added
  this file.  I simply copied the file verbatim.  [EMAIL PROTECTED],
  2003/01/06 18:14 EST

unix/Makefile.in:

Removed tclUnixThrd.o and tclAlloc.o objects.  The required
functions are included in thread/tcl8x.c for compatibility
with nsthreads.

  8.4.1:

  Made same changes as in

Re: [AOLSERVER] 3.3+ad13 w/ Tcl 8.4.1 ?

2003-01-06 Thread Jeff Hobbs
> Has anyone successfully built and used Tcl 8.4.1 (or any flavor of 8.4
> for that matter) with AOLserver 3.3+ad13, or a similar AOLserver
> version (aka, pre-3.5)?  If you have, could you tell me how you built
> it?
>
> I'm trying building it now, and am wondering which of the many changes
> descriibed in "aolserver/tcl8.3.2/README.AOLSERVER" I need to do for
> 8.4.1, etc.

I don't have that version of AOLServer to compare against, but Tcl 8.4.1
should not require any core patching to work with AOLServer now.  I'm
not sure if that also accompanied changes to AOLServer code ...

  Jeff Hobbs The Tcl Guy
  Senior Developer   http://www.ActiveState.com/
  Tcl Support and Productivity Solutions