run_erl under Linux (was: erl_interface and ALIVE)
Vance Shipley
vances@REDACTED
Fri Sep 8 20:58:14 CEST 2000
I did dresolve this problem. Testing showed that select was
returning 0 yet it had not timed out yet. The solution turned
out to be setting the define USE_SETPGRP_NOARGS. The following
snippet from run_erl.c was the source of the problem:
/* disassociate from control terminal */
#ifdef USE_SETPGRP_NOARGS /* SysV */
setpgrp();
#else
#ifdef USE_SETPGRP /* BSD */
setpgrp(0,getpid());
#else /* POSIX */
setsid();
#endif
It had been using setsid().
-Vance
} Yes, but check out the times! My buffers are filling up
} with these messages as they are produced many times a second.
}
} This seems to be produced by run_erl. In run_erl.c:
}
} /* Enter the work loop */
}
} timeout.tv_sec = LOG_ALIVE_MINUTES*60;
} timeout.tv_usec = 0;
} while (1) {
} maxfd = MAX(rfd, mfd);
} FD_ZERO(&readfds);
} FD_SET(rfd, &readfds);
} FD_SET(mfd, &readfds);
} time(&last_activity);
} ready = select(maxfd + 1, &readfds, NULL, NULL, &timeout);
} if (ready < 0) {
} /* Some error occured */
} error("Error in select.");
} exit(1);
} } else {
} /* Check how long time we've been inactive */
} time_t now;
} time(&now);
} if(!ready || now - last_activity > LOG_ACTIVITY_MINUTES*60) {
} /* Either a time out: 15 minutes without action, */
} /* or something is coming in right now, but it's a long time */
} /* since last time, so let's write a time stamp this message */
} sprintf(buf, "\n===== %s%s", ready?"":"ALIVE ", ctime(&now));
} write_to_log(&lfd, &lognum, buf, strlen(buf));
} }
} }
}
}
} I believe that what is happening is that select is returning 0 at
} these times. It gets into a state where it gets stuck doing this.
} It hasn't timed out though as it's been far, far less than a minute.
}
} I think I'll test and report errno and see what it says...
}
} -Vance
}
}
} } >Another problem which I do not yet understand is that
} } >sometimes the Erlang node will produce the following
} } >messages in the logs:
} } >
} } >===== ALIVE Fri Sep 1 11:32:49 2000
} } >
} } >===== ALIVE Fri Sep 1 11:32:49 2000
} } >
} } >===== ALIVE Fri Sep 1 11:32:49 2000
} }
} }
} } These entries are written to mark that the node is up and running,
} } even though it is not outputting anything to the shell.
} }
} } /Uffe
}
}
More information about the erlang-questions
mailing list