AOLserver crash related to ns_atclose and namespace commands
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > AOL Webserver > AOLserver crash related to ns_atclose and namespace commands




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    AOLserver crash related to ns_atclose and namespace commands  
Tom Jackson


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-22-07 12:11 AM

I have been getting some crashes in AOLserver (current cvs version).
AOLserver doesn't exit, but prints the following and stops responding:

'Tcl_SetBooleanObj called with shared object'

Here is a tcl page which exposes the behavior:

-----------
# Script to expose bug with ns_atclose/namespace commands
set store " ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcd
efghijklmnop"
namespace eval ::bug { }

# Commenting out this line leads to bug: 'Tcl_SetBooleanObj called with shar
ed
object'
#namespace eval ::bug::$store { }

proc ::bug::atClose { store } {
ns_log Debug "checking if namespace ::bug::$store exists"
if {[namespace exists ::bug::${store}]} {
ns_log Debug "Deleting namespace ::bug::$store"
namespace delete ::bug::${store}
#log Notice "Closed store (memory delete) $store"
return $store
} else {
ns_log Debug "namespace ::bug::$store does not exist"
}

}

# Comment out one of these and things work fine:
ns_atclose ::bug::atClose $store
#ns_atclose ::bug::atClose $store


ns_return 200 text/plain "ns_atclose bug"

-----------------

The bug doesn't show up under all conditions. If the namespace exists, or ha
d
existed and was deleted, things work as expected. Also, even if the namespac
e
never existed, if ns_atclose is only called once, things work as expected.

However, if the namespace to be deleted never existed, and ns_atclose is
called twice with the same args, none of the ns_log Debug statements print,
and the crash occurs. (But the page is returned)

Not sure what is the cause.

tom jackson

On Friday 03 November 2006 10:31, Alex wrote:
> Oh, well
>
> so I guess it was too early to celebrate. Now I am getting the same
> crashes again, even without "exit" command in the tcl code executed in
> thread.
>
> Seems to me that the same problem now discussed in
> bug 1589968
> https://sourceforge.net/tracker/?fu....aolserver.com/
>
> To Remove yourself from this list, simply send an email to
> <listserv@listserv.aol.com> with the body of "SIGNOFF AOLSERVER" in the
> email message. You can leave the Subject: field of your email blank.







[ Post a follow-up to this message ]



    Re: AOLserver crash related to ns_atclose and namespace commands  
Tom Jackson


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-22-07 06:11 AM

Okay, some more info on this.

ns_atclose has been changed in some strange ways.

First it now requires that you are in an open connection to invoke ns_atclos
e.

ns_atclose used to execute in scheduled procs, which makes sense so that you
can use one method to clean up stuff in case of errors.

It is easy to re-enable adding ns_atclose to scheduled procs by removing a f
ew
lines of code. Now I can call ns_atclose everywhere, but in scheduled procs,
the cleanup scripts don't run.

Question is: why the (silent) change, and
is there something to replace this?

The old description of the command is here:
<http://rmadilo.com/files/nsapi/ns_atclose.html>

I still haven't figured out where exactly the crash is coming from, but _it 
is
not in the NsAtCloseObjCmd or NsRunAtClose... code.

tom jackson

On Sunday 21 January 2007 11:24, Tom Jackson wrote:
> I have been getting some crashes in AOLserver (current cvs version).
> AOLserver doesn't exit, but prints the following and stops responding:
>
> 'Tcl_SetBooleanObj called with shared object'
>
> Here is a tcl page which exposes the behavior:
>
> -----------
> # Script to expose bug with ns_atclose/namespace commands
> set store " ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcd
efghijklmnop"
> namespace eval ::bug { }
>
> # Commenting out this line leads to bug: 'Tcl_SetBooleanObj called with
> shared object'
> #namespace eval ::bug::$store { }
>
> proc ::bug::atClose { store } {
>     ns_log Debug "checking if namespace ::bug::$store exists"
>     if {[namespace exists ::bug::${store}]} {
>         ns_log Debug "Deleting namespace ::bug::$store"
>         namespace delete ::bug::${store}
>         #log Notice "Closed store (memory delete) $store"
>         return $store
>     } else {
>         ns_log Debug "namespace ::bug::$store does not exist"
>     }
>
> }
>
> # Comment out one of these and things work fine:
> ns_atclose ::bug::atClose $store
> #ns_atclose ::bug::atClose $store
>
>
> ns_return 200 text/plain "ns_atclose bug"
>
> -----------------
>
> The bug doesn't show up under all conditions. If the namespace exists, or
> had existed and was deleted, things work as expected. Also, even if the
> namespace never existed, if ns_atclose is only called once, things work as
> expected.
>
> However, if the namespace to be deleted never existed, and ns_atclose is
> called twice with the same args, none of the ns_log Debug statements print
,
> and the crash occurs. (But the page is returned)
>
> Not sure what is the cause.
>
> tom jackson
>
> On Friday 03 November 2006 10:31, Alex wrote: 
>
> --
> AOLserver - http://www.aolserver.com/
>
> To Remove yourself from this list, simply send an email to
> <listserv@listserv.aol.com> with the body of "SIGNOFF AOLSERVER" in the
> email message. You can leave the Subject: field of your email blank.







[ Post a follow-up to this message ]



    Re: AOLserver crash related to ns_atclose and namespace commands  
Tom Jackson


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-22-07 06:11 AM

I found the following change fixes the bug:

in nsd/tclresp.c, line 840:

static int
Result(Tcl_Interp *interp, int result)
{
/*  Tcl_SetBooleanObj(Tcl_GetObjResult(inter
p), result == NS_OK ? 1 : 0); */
Tcl_SetObjResult(interp, Tcl_NewBooleanObj((result == NS_OK ? 1 : 0)));
return TCL_OK;
}

I'll commit the change.

tom jackson


On Sunday 21 January 2007 17:06, Tom Jackson wrote:
> Okay, some more info on this.
>
> ns_atclose has been changed in some strange ways.
>
> First it now requires that you are in an open connection to invoke
> ns_atclose.
>
> ns_atclose used to execute in scheduled procs, which makes sense so that
> you can use one method to clean up stuff in case of errors.
>
> It is easy to re-enable adding ns_atclose to scheduled procs by removing a
> few lines of code. Now I can call ns_atclose everywhere, but in scheduled
> procs, the cleanup scripts don't run.
>
> Question is: why the (silent) change, and
> is there something to replace this?
>
> The old description of the command is here:
> <http://rmadilo.com/files/nsapi/ns_atclose.html>
>
> I still haven't figured out where exactly the crash is coming from, but _i
t
> is not in the NsAtCloseObjCmd or NsRunAtClose... code.
>
> tom jackson
>
> On Sunday 21 January 2007 11:24, Tom Jackson wrote: 
>
> --
> AOLserver - http://www.aolserver.com/
>
> To Remove yourself from this list, simply send an email to
> <listserv@listserv.aol.com> with the body of "SIGNOFF AOLSERVER" in the
> email message. You can leave the Subject: field of your email blank.







[ Post a follow-up to this message ]



    Re: AOLserver crash related to ns_atclose and namespace commands  
Brett Schwarz


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-22-07 12:11 PM

That's funny actually...I just changed a bunch of these cases in a Tcl exten
sion I help maintain, just earlier today. I happened upon this post that tal
ks about it:

> Okay, some more info on this.
>
> ns_atclose has been changed in some strange ways.
>
> First it now requires that you are in an open connection to invoke
> ns_atclose.
>
> ns_atclose used to execute in scheduled procs, which makes sense so that
> you can use one method to clean up stuff in case of errors.
>
> It is easy to re-enable adding ns_atclose to scheduled procs by removing a
> few lines of code. Now I can call ns_atclose everywhere, but in scheduled
> procs, the cleanup scripts don't run.
>
> Question is: why the (silent) change, and
> is there something to replace this?
>
> The old description of the command is here:
> <[url]http://rmadilo.com/files/nsapi/ns_atclose.html" target="_blank">http://sourceforge.net/mailarchive/...ns_atclose.html>
>
> I still haven't figured out where exactly the crash is coming from, but _i
t
> is not in the NsAtCloseObjCmd or NsRunAtClose... code.
>
> tom jackson
>
> On Sunday 21 January 2007 11:24, Tom Jackson wrote: 
>
> --
> AOLserver - http://www.aolserver.com/
>
> To Remove yourself from this list, simply send an email to
> <listserv@listserv.aol.com> with the body of "SIGNOFF AOLSERVER" in the
> email message. You can leave the Subject: field of your email blank.


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to <listserv@listser
v.aol.com> with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject:
 field of your email blank.






 ________________________________________
____________________________________
________
Looking for earth-friendly autos?
Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center.
http://autos.yahoo.com/green_center/







[ Post a follow-up to this message ]



    Re: AOLserver crash related to ns_atclose and namespace commands  
Tom Jackson


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-22-07 06:11 PM

On Sunday 21 January 2007 23:20, Brett Schwarz wrote:
> That's funny actually...I just changed a bunch of these cases in a Tcl
> extension I help maintain, just earlier today. I happened upon this post
> that talks about it:
> [url]http://sourceforge.net/mailarchive/forum.php?thread_id=30611212&forum_id=43[/url
]
>966
>
> Might be worthwhile doing an audit of the rest of the aolserver code for
> these occurances.

I only found a few in the AOLserver code, I changed about half before I foun
d
the one that stopped the bug.

I even changed one in the tcl codebase that uses this while checking if a
namespace exists.

I have a feeling that the bug shows up for some other reason. ns_atclose
stores scripts and uses a hash array. I'm guessing that two identical script
s
might appear as one at some point. This could change the reference count for
the object, somehow leading to the problem.

tom jackson







[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 01:30 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register