Hi,

I tried to isolate the issue that a ::http::geturl call hangs in rivet
but works in tclsh.

Could you please verify the following scripts to check if this is the
same for you ?

--Issue--

I tried to isolate the issue, that the following file works well when
executed in a tcl8.6 shell and lets an apache thread hang:
--test_linkcheck.tcl---
puts [package require http]<br/>
if { [catch {
        set h [::http::geturl "http://www.elmicron.de/test.txt";]
} err] } {
        puts " unknown url<br/>"
} else {
        puts [::http::status $h]<br/>
        ::http::cleanup $h
}
--EOF--

% tclsh8.6 test_linkcheck.tcl
2.8.7<br/>
ok<br/>
%

The file is saved in "/var/www/http" of my test server, and a request of
the address: "//centostest/test_linkcheck.tcl" lets the client wait
until I restart the apache server.

An additional option "-timeout 1000" to geturl would let stop geturl in
a timeout.

The file "http://www.elmicron.de/test.txt"; is a 12 byte test file.

----

Tests I have done:

--T1: Try synchronous socket--

The following script tries to get the data by a synchronous socket:

--test_socket.tcl--
set h [socket www.elmicron.de 80]
fconfigure $h -translation crlf -buffering line -blocking 1
puts $h "GET /test.txt HTTP/1.0\nHost: www.elmicron.de\n"
while { ! [eof $h] } {
        set data [gets $h]
        if {$data ne ""} {
                puts $data
        }
}
close $h
--eof--

This works well in rivet and in tclsh

--T2: Try asynchronous socket--

The following script loads the data by an asynchoneous method:

--test_socket_async.tcl--
proc sockin {} {
        global h
        puts [gets $h]
        if {[eof $h]} {
                close $h
                set h ""
        }
}

set h [socket -async www.elmicron.de 80]
fconfigure $h -translation crlf -buffering line -blocking 0
puts $h "GET /test.txt HTTP/1.0\nHost: www.elmicron.de\n"
fileevent $h readable sockin
vwait h
--eof--

This works well in tcl86 and hangs the browser when executed with rivet.

--T3: Event loop--

So I thought the issue is the event loop.
So I tried a simple event loop example which stays for 1 second in the
event loop:

--test_vwait.tcl--
puts "wait 1 sec"
set h 0
after 1000 "set h 1"
vwait h
puts end
--eof--

This works well in tclsh and rivet.

------

Is this a bug or a feature ?
Do you also see what I see ?
Are my tests just stupid ?

Thank you for any ideas,
Harald

---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscr...@tcl.apache.org
For additional commands, e-mail: rivet-dev-h...@tcl.apache.org

Reply via email to