Thursday, September 06, 2007
More notes on a graylist daemon
Man, my email is still scarily empty. One thing to keep in mind—until yesterday, I did no filtering for spam. Nothing. I got it all. And now?
It's like spam doesn't even exist.
Even though I started yesterday (just before midnight) I really only have about twelve hours of actual stats since there were a few problems with the program (more on that in a bit). But, in the past twelve hours, 2,251 emails came in, and only six made it through to the whitelist, a rate of about 0.3%.
Not bad.
And of the six, two were spam, but only one got through because the other one was sent to a non-existant account.
Now, the problems.
Problem one—the default embargo time was set too high. I only found this out after running the program for an hour. So that was a restart.
Problem two—the program crashed when dumping the tuples, and I don't know why. The program responds to the signal USR1
by calling fork()
(which creates a duplicate of the running process); the parent process then goes back to servicing requests while the child process generates the dump file and exits. I do it this way for two reasons; 1) the program can still process requests and 2) since the child process gets a separate copy of everything, it can dump the data without the parent changing the data as it runs. The dump went fine; it is when the child process ends that the program goes into the weeds.
Now, I've used similar code in another daemon I wrote, and it worked on the development server, but not on my email server. There is a slight difference in Linux kernels between the two, but the major difference between the two—the mail server is a virtual server. Perhaps the calls to _exit()
were problematic on the virtual server? Change them to exit()
(there's a slight difference between the two, the details of which aren't important, because—).
And that didn't work. Program still crashed (and mind you, each of these tests take just over an hour to do). It could just be a problem with fork()
and signal semantics under the virtual server. To work around that problem, I just removed the call to fork()
and have the single process do the dump (ignoring any requests in the meantime).
And that seems to have done the trick to keep it up and running.
A disturbing lack of spam poetry
The graylist daemon is working. And that's great, but there's one downside to it that I've just now realized: I'll no longer get spam poetry.
In other words—amusing subject lines, like:
- Access Error Headline functionality has been disabled from your intranet.
- likeable blood clot
- cantankerous abstraction
- cocoa powder bootlegger [I especially like this one —Editor]
- load bearing dust bunny
- Anyway, it's all good now and I owe Tom a Krispy Kreme or something.
- Milli Vanilli: The Movie
(yes, they're all real subject lines from spam I've received over the years)
Alas, I guess I'll have to live without spam poetry from now on.