Re: perl programs hang if run with daemontools

Oscar Retana <[email protected]>
Newsgroups gmane.comp.djb.syslog
Organization GridShield
Message-ID <[email protected]>
Perfect! Thanks a lot!

- Oscar.

Peter Samuel wrote:
> Quoting Oscar Retana <[email protected]>:
> 
> 
>>Hello list. I've using daemontools since two years ago, it's great, I
>>can't think of a daemon anymore without thinking in daemontools. Thanks
>>a lot DJB.
>>
>>My problem is when running perl programs under daemontools. If my perl
>>script is something like this, it works fine wit daemonstools and 
>>multilog logs everything right:
>>
>>#!/usr/bin/perl -w -T
>>while (1) {
>>   print "test\n";
>>}
>>
>>But any real script hangs. For example, if I add a single "sleep", I 
>>stop receiving any log. This hangs: (or at least, it never produce any 
>>output; the "sleep" is just a little example that fails)
>>
>>#!/usr/bin/perl -w -T
>>while (1) {
>>   print "test\n";
>>   sleep 1;
>>}
> 
> 
> You are running up against STDIO buffering. In the first code example above the
> program will quickly fill up the STDIO buffer (typically 4k) and the output will
> be sent to file descriptor 1. In the second example it will take 820 seconds to
> fill up the 4k buffer. So you won't see anything for that period of time.
> 
> You can tell Perl to flush on very write by setting $| to a non-zero value.
> 
> See
> 
>     man perlvar
> 
>  
> 
>>I am runnign spamassassin with daemonstools, and it turns out that the 
>>spamd daemon is a perl script itself. I have no problems running 
>>spamassassin. At the beggining of the spamd script they have some 
>>special things, I tried using them, but nothing.
>>
>>I don't know if there's something special I should consider for Perl, if 
>>I want to use daemontools with it. And I have googled for serveral days, 
>>but nothing yet.
>>
>>I apologize for posting this here, if it turns that this is not related 
>>at all to daemontools (or multilog), and it is a Perl issue instead. 
>>But maybe you have seen this behavior before, and can give me a bit of help.
>>
>>Thanks a lot!
>>
>>
>>-- 
>>Oscar Retana
>>
>>
> 
> 
> 

-- 
Oscar Retana, GridShield
San Jose, Costa Rica
Tel: (506) 258-5757
http://www.gridshield.net/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.