[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: PHP's CURL & Tor integration hangin



----- Original Message -----
From: "coderman" <coderman@xxxxxxxxx>
To: or-talk@xxxxxxxxxxxxx
Date: Tue, 24 Jul 2007 16:27:03 -0700
Subject: Re: PHP's CURL & Tor integration hangin

> 
> On 7/21/07, Mr. Blue <trashdsfg@xxxxxxxxx> wrote:
> > ...
> > Be aware that I did set connection timeout for
CURL at
> > 60 seconds ...
> 
> is this connect timeout, dns resolve timeout,
transfer timeout, etc?


It is: connect timeout -> set to 60 sec
       dns resolve timeout -> set to 120 sec
	  
There is no transfer timeout, but I did found
CURLOPT_TIMEOUT (integer) - The maximum number of
seconds to allow cURL functions to execute.
So I decided to use it this time because I've never
used it before.
I've set it to 300 sec (5min).

So no matter where it "hitch" now - Curl will be
overruled by that 5 min rule.

 
> > If site does load, then exit node is considered
valid
> > and then I use it to POST data at 12 sites.
> 
> you're not doing anything obnoxious, are you? :)

Of course not!
Don't be ridiculous, I would never be..., obnoxious.

I'm mommy's boy!
:D

 
> > Problem is that every approx. 15th - 30th time, it
> > hangs indefinitely at, for example, 7th site.
> > Even when node was checked at a begening before
usage,
> > against 60sec connection timeout rule it can stuck
at
> > any of sites.
> >
> > Last time it did hang that way for 19 hours?!?
> 
> that sounds like a curl/php problem.

I did wroten another PHP script which is paresed each
10 min(cron) and is checking the first one, does it
"hangs".
From then..., no more problems!
:)


> > Obviously, it is up to Tor, because it is sending
some
> > signal to reset 60sec CURL's rule for
termination(so
> > PHP's CURL can't close it!!).
> 
> it is up to Tor? Tor will timeout a failed connect
attempt at 120 or
> 180 seconds(?), but if you've got a connection, and
the server doesn't
> close it, and you never time it out, sure, it could
hang open for
> hours.
> 
> you need to fix the curl part to timeout transfers
as well as
>  connect/dns.

I added another CURL option from above:
CURLOPT_TIMEOUT (integer) - The maximum number of
seconds to allow cURL functions to execute


> best regards,


Anyway..., last question which is bash shell related.
Second script that each 10 mins check first one, is
killing first one by it's PID(if hangs more than 30
min) and the restarting it with command:

php -f chk_tor.php > /dev/null 2>&1 &

Now, I like PHP coder am not too skilled with FreeBSD
6.2' bash shell, so here is how would I like that
command to be altered.

I want output that currently goes in /dev/null, be
saved in a variable ($OUTPUT), and then piped to mail
function where body=$OUTPUT (I will set 'subject' and
'to' by mayself).
Effect should be the same one when you instal crontab
with set MAILTO=...
I don't know bash shell syntax to do it..., thanks in advance.


      ____________________________________________________________________________________
Luggage? GPS? Comic books? 
Check out fitting gifts for grads at Yahoo! Search
http://search.yahoo.com/search?fr=oni_on_mail&p=graduation+gifts&cs=bz