atom feed12 messages in org.apache.tcl.rivet-devRe: Verify Link using http package
FromSent OnAttachments
Harald OehlmannMay 10, 2013 6:28 am 
Massimo ManghiMay 10, 2013 6:48 am 
Damon CourtneyMay 10, 2013 7:10 am 
Harald OehlmannMay 10, 2013 7:32 am 
Harald OehlmannJun 27, 2013 2:24 am 
Harald OehlmannJun 27, 2013 7:11 am 
Massimo ManghiJun 27, 2013 4:03 pm.rvt
Harald OehlmannJun 28, 2013 1:29 am 
Harald OehlmannJun 28, 2013 2:44 am 
Harald OehlmannJul 1, 2013 3:17 am 
Harald OehlmannJul 2, 2013 1:54 am 
Massimo ManghiJul 2, 2013 2:51 pm 
Subject:Re: Verify Link using http package
From:Harald Oehlmann (hara@elmicron.de)
Date:Jun 28, 2013 1:29:30 am
List:org.apache.tcl.rivet-dev

Hello List,

I have tried: strace -o l.txt /usr/sbin/httpd -X

Then, the issue does not arise and the script works well.

I have tried: strace -o l.txt /usr/sbin/httpd This does not help, as apache goes in daemon mode.

So it must be an issue with the deamon mode etc.

Is there any way to debug this ?

Thank you, Harald

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