Hi,

I'm using vpopmaild in my qmail installation to automate some operations. Unfortunately some time vpopmaild after some command remains to use all CPU TIME as long as I kill vpopmaild process:


PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
30689 root      20   0  1012 1012  768 R 97.1  0.1   3:20.21 vpopmaild

http://www.mail-archive.com/vchkpw@inter7.com/msg25601.html

We believe that the problem could be here, in wait_read() function:

original vpopmaild.c, line 247 ~, in :

  if (select(2,&rfds,(fd_set *) 0,(fd_set *)0,&tv)>=1) {
    fgets(ReadBuf,sizeof(ReadBuf),stdin);
    return(1);

replacing

"fgets(ReadBuf,sizeof(ReadBuf),stdin);"

with

"if(fgets(ReadBuf,sizeof(ReadBuf),stdin) != NULL)"

the problem disappears.

The problem is caused by the fact that if you close the socket client-side execution is trapped in an infinite loop that calls wait_read and that fgets returns NULL, because the socket is closed.

From "fgets()"

[...]
If the End-of-File is encountered and no characters have been read, the contents of str remain unchanged and a null pointer is returned. If an error occurs, a null pointer is returned.
[...]

Thanks to Davide Gelardi for this information.



!DSPAM:4ccd29d732711172621150!

Reply via email to