Can bogofilter run by multiprocess at the same time
陈治璋
john.chen at net263.com
Thu Oct 14 11:11:49 CEST 2004
在2004年10月14日的06:46,Matthias Andree写道:
> On Wed, 13 Oct 2004, 陈治璋 wrote:
>
> > > Does it produce an actual deadlock or just make slow progress?
> > It's an actual deadlock. There are many bogofilter processes and they
> > process id remains the same for ever.
>
> A deadlock is when process A has locked resource R and waits for
> resource S while process B has locked resource S and waits for resource
> R. I managed to trigger a "hang" on Linux, which turned out to be
> processes waiting for input, which is why I don't attribute the hang to
> bogofilter but rather the environment.
>
> I didn't have the time to retry your code with fork() yet.
>
> > Yes, I'm using glibc 2.1 in Linux. But in Solaris 2.8, I tested it again
> > by replacing the following function and it blocks:
> >
> > void* bogo_check(void* p)
> > {
> >
> > for(int i = 0; i < 10000; i ++){
> > const char* s_email = "ham.eml";
> > if (i%2){
> > s_email= "spam.eml";
> > }
> > string email = get_email(s_email);
> > FILE* file = popen("bogofilter", "w");
> > signal(SIGPIPE, SIG_IGN);
>
> This for instance is bogus, it masks a crashed child.
Maybe it's because that the program needs too file in the current dir:
ham.eml and spam.eml.
>
> I'm not sure off-hand if the C++ string class is thread-safe.
>
> > And it blocks at vfork().
>
> Which vfork()? The original code you posted used POSIX threads.
> BTW, vfork works only if the child process immediately
> calls execve() or _exit(). If it does anything else, you must use fork.
What I mean is that the program hang when calling popen(), which calls
vfork in solaris.
BTW, is there any library that I can call in my C code to check if an
email is a spam instead of calling popen()?
More information about the bogofilter-dev
mailing list