This bug has been around forever.  It also happens, at least in 2.3.3, when
you do an ns_return, forget the TCL return, and do a 2nd ns_return.  We
redefined ns_return so that if it is attempted twice, the 2nd call is
ignored because it kept crashing our server.

Jim

>
> I ran the following in a registered proc and crashed my AOLServer:
>
>   ns_respond -status 200 -type text/html \
>       -string "<html></html>" -headers [ns_conn outputheaders]
>   set setId [ns_conn outputheaders]
>   for {set i 0} {$i < [ns_set size $setId]} {incr i} {
>     ns_log debug "[ns_set key $setId $i]: [ns_set value $setId $i]"
>   }
>
> I got something like the following as output (it differs each time):
>
>   [08/May/2002:07:07:57][31507.7176][-conn0-] Debug: �w@�w@@@: �w@�w@@@
>
> So it seems like what's happening is that ns_respond is freeing the strings
> that held the outputheaders, as it thinks (rightfully so) that it no longer
> needs them.  However, the outputheaders ns_set still points to the old
> memory location, so when you deal in that set, you meander until you
> stumble upon a seg fault.
>
> Has anyone ran into this?  It doesn't sit right with me to make ns_respond
> close the connection after it's done, but it seems like it's kinda doing
> that... just half-assed.
>
> Thanks,
> -T
>
> AOLServer 3.4 / Linux
>

Reply via email to