[Dub-pm] hello

Aidan Kehoe kehoea at parhasard.net
Sat Jul 24 08:30:47 CDT 2004

 Ar an tríú lá is fiche de mí Iúil, scríobh Fergal Daly: 

 > It compiled because Perl is a dynamic language and Perl does not know in
 > advance that selectall_arrayref will not be returning a subroutine
 > reference. It's perfectly valid code for suitable values of $sbh.

Fine, dynamic typing makes my life better, I hadn't realised that the arrow
operator takes an array as its right-hand operand when you use it to
dereference a subroutine reference. 

 > That code should have died every time with an error like "Not a CODE
 > reference at blah blah".

I don't have the stderr logs for most of the time it was running, but the
logs I do have show it dying, most of the time, inside selectall_arrayref
because it hadn't received the right number of arguments.

 > Have you used eval anywhere in your code? That is the only reason I can
 > think of that the problem hasn't shown up sooner. If it was executing inside
 > an eval and you weren't checking $@ after the eval then that could hide the
 > fact that your code was dying.

The approach we take to keeping this process alive is to have any code that
uses its services check if it's running, and then either signal it that new
data is available, or launch it, at which point it checks for new data. So
the process dying isn't something that causes the system to be down for
hours. (Thankfully, because this code path was relatively rarely exercised,
and keeping the system alive is more important and urgent than the need to
fix a comparatively small failure in a rare case.)

We weren't using eval. Nor mod_perl. (Tangent; I don't anticipate ever
choosing mod_perl on purpose in the future; what advantages it has over PHP
are hugely outweighed, for me, by the generally crazy programming style you
have to adopt and the acrobatics I had to go through to get it installed and
running within the strictures of particular machine's apt database.) It
could, _possibly_ be the case that an earlier version without the bug was
running for some of those four months, but I'm pretty sure it wasn't. Eh. 

Anyway, cool, I learned something, score one for the list. Thanks, all. 

The cow, if it were a metaphysician, would argue: 'Everything in my own
desires and hopes and fears has reference to myself; hence by induction I
conclude that everything in the universe has reference to myself. This noisy
train, therefore, intends to do me either good or evil. I cannot suppose
that it intends to do me good, since it comes in such a terrifying form, and
therefore, as a prudent cow, I shall endeavour to escape from it.' (Russell)

More information about the Dublin-pm mailing list