[San-Diego-pm] mysteriously shared email addresses (was: Re: Perl question)

Anthony Foiani tkil at scrye.com
Tue Apr 6 19:20:48 PDT 2010

Norm --

On Tue, Apr 6, 2010 at 10:56 AM, Knupp, Norman C. <norman.knupp.ctr at swrmc.navy.mil> wrote:
> I have been seeing an occasional problem with my application.  It
> sends out event-related e-mails, but once in a while I see instances
> where a message is sent to a recipient for wrong event.  It is as if
> two instances of the program are running at exactly the same time
> and sharing global variable space.  Is that possible?  I'm not
> explicitly scoping them.  

As Bob mentioned, if you're running two separate processes, they will
not share information unless you go through some effort for them to do

What might be happening, though, is that your script might use some
sort of global resource in such a way that another process could be
impacting that resource.

In this case, I wonder if your e-mail generating script perhaps writes
temporary files to /tmp or similar?  If those names are not carefully
chosen, I can easily see a situation where process 1 writes a message,
process 2 overwrites it with another message, then process 1 sends the
contents of that file to some address.

Various standard ways of generating tempfile names (or even naked file
descriptors that never even appear in a listing) should fix that.

> I'm using a hash to store two types of addresses: authenticated and
> unauthenticated.  The list of addresses in the authenticated hash
> gets one message and each address in the unauthenticated has gets
> another message, but both are supposed to be for the same event.

Is this a persistent hash, e.g., using one of the DBM modules, or
BerkeleyDB or similar?  If so, that's another place where you could be
accidentally sharing information.

Make sure that your access to any shared resource (/tmp, email
database, etc) is fully protected against unwanted reader/writer

Good luck,

More information about the San-Diego-pm mailing list