[AOLSERVER] ns_sock_select issues again

12 views
Skip to first unread message

Titi Alailima

unread,
May 7, 2008, 2:54:45 PM5/7/08
to AOLS...@listserv.aol.com

I’m having problems with ns_httpget on my Win32, 4.5.0, Tcl 8.5.  Again I’ve narrowed it down to the ns_sock_select in _ns_http_puts (defined in modules/tcl/http.tcl).  It’s not crashing now like it did with 4.0.10, Tcl 8.4.17 (you may recall a month ago I was getting an “UpdateStringProc should not be invoked for type bytecode” error then).  Now it just errors out like so:

 

invalid command name "ƒÄ,¶——"

    while executing

"Ä,¶——"

    (procedure "_ns_http_puts" line 1)

    invoked from within

"_ns_http_puts $timeout $wfd "$method $uri HTTP/1.0\r""

    invoked from within

"ns_httpopen GET $url $rqset $timeout"

    (procedure "ns_httpget" line 10)

    invoked from within

"ns_httpget http://www.google.com/"

 

I’m guessing the gobbledygook is some sort of representation of ns_sockselect.  Is this at all related to the UpdateStringProc error from before?  Is it bytecode pretending to be a string?  Must be, because if I put together the series of commands leading up to it, like so:

 

set fds [ns_sockopen -nonblock www.google.com 80]

set rfd [lindex $fds 0]

set wfd [lindex $fds 1]

if {[lindex [ns_sockselect -timeout 30 {} $wfd {}] 1] == ""} {

    error "Foo"

}

puts $wfd "GET / HTTP/1.0\r"

 

it works but if I use _ns_http_puts like this:

 

set fds [ns_sockopen -nonblock www.google.com 80]

set rfd [lindex $fds 0]

set wfd [lindex $fds 1]

_ns_http_puts 30 $wfd "GET / HTTP/1.0\r"

 

It throws the error again.  I’m beyond my depth figuring out why this would be the case.

 

I guess it could be something about the system I’m on, since it seems like the same problem has manifested itself twice with two different versions of both AOLserver and Tcl codebases, and two different compilers even.  The only common denominator is this Win2k3 Server box I’m on, which isn’t all that special as far as I can tell.  I’ll try to find another machine to try it out on.

 

In the meantime, any ideas on what is causing this?

 

Titi Ala'ilima

Lead Architect

MedTouch LLC

1100 Massachusetts Avenue

Cambridge, MA 02138

617.621.8670 x309

 

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

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

Titi Alailima

unread,
May 7, 2008, 3:31:05 PM5/7/08
to AOLS...@listserv.aol.com

I tried a couple more things.  I re-defined _ns_http_puts with the original definition and everything worked fine.  This got me curious so I ran [info body _ns_http_puts] (in a new interpreter where I hadn’t redefined the proc) and of course I got “ƒÄ,¶——“.

 

A workaround is obvious, but the mystery remains as to how the proc got redefined with the gobbledygook in the first place.  It might not be ns_sockselect after all, though I was able to narrow it down to that in the 4.0.10 case.  It must happen before my custom libraries are processed or else my redefinition wouldn’t fix the problem.

 

Titi Ala'ilima

Lead Architect

MedTouch LLC

1100 Massachusetts Avenue

Cambridge, MA 02138

617.621.8670 x309

 

 

Tom Jackson

unread,
May 7, 2008, 4:47:24 PM5/7/08
to AOLS...@listserv.aol.com
Maybe you have a bad character somewhere in the file, or the wrong char
encoding or something?

tom jackson

Titi Alailima

unread,
May 8, 2008, 9:38:11 AM5/8/08
to AOLS...@listserv.aol.com
It's not a simple character problem because:
a. other functions in the same file work fine.
b. redefining it later works even though it is cut and pasted.
c. I can even move the definition around in http.tcl (it was at the end to start with) and it still fails while the other functions work.
d. Just for grins I typed out a redefinition of the function immediately after the original, and it still failed. If I comment out the chunk with ns_sockselect, it doesn't get redefined (as confirmed by [info body _ns_http_puts]), but it also doesn't work.

So something has to be happening during startup that corrupts it. I'm guessing it's getting called before ns_sockselect is really ready to be used, but I can't find where that might be. I searched through and could find no calls to _ns_http_puts, ns_httpopen, ns_httpget, or ns_httppost that precede my redefinition. The only other calls to ns_sockselect I could find are in sendmail.tcl (_ns_smtp_send and _ns_smtp_recv) but those functions seem to be fine.

Like I said, I have a workaround that seems to be fine, but this behavior is troubling. I'll be testing it out on other servers in the next couple of days so I'll let you know what I see.

Titi Ala'ilima
Lead Architect
MedTouch LLC
1100 Massachusetts Avenue
Cambridge, MA 02138
617.621.8670 x309

Reply all
Reply to author
Forward
0 new messages