Hi,
>>>>> On Wed, 19 Oct 2005 07:55:10 +0000
>>>>> Emmanuel Dreyfus <manu@...> said:
manu> On Tue, Oct 18, 2005 at 04:52:49PM -0400, Matthew S. Cramer wrote:
> Dead end. They are still crashing.
>
> Not sure what the problem is, but it does not appear to be related to
> too many threads.
manu> What about thread-safety problems?
I noticed that pthread_detach() is not issued. So, the resources of
the threads are not reclaimed. The patch for this problem is attached
in this mail. However, since I think that the mxsync threads are not
created so frequently, I'm not sure how it do for this issue.
Index: sync.c
diff -u -p sync.c.orig sync.c
--- sync.c.orig Sat Oct 15 19:24:04 2005
+++ sync.c Thu Oct 20 09:31:35 2005
@@ -560,19 +560,25 @@ sync_master_restart(void) {
strerror(errno));
exit(EX_OSERR);
}
- if (sync_master6.runs &&
- (error = pthread_create(&tid, NULL, sync_master,
- (void *)&sync_master6)) != 0) {
- syslog(LOG_ERR, "Cannot run MX sync thread for IPv6: %s\n",
- strerror(error));
- exit(EX_OSERR);
+ if (sync_master6.runs) {
+ if ((error = pthread_create(&tid, NULL, sync_master,
+ (void *)&sync_master6)) != 0 ||
+ (error = pthread_detach(tid)) != 0) {
+ syslog(LOG_ERR,
+ "Cannot run MX sync thread for IPv6: %s\n",
+ strerror(error));
+ exit(EX_OSERR);
+ }
}
- if (sync_master4.runs &&
- (error = pthread_create(&tid, NULL, sync_master,
- (void *)&sync_master4)) != 0) {
- syslog(LOG_ERR, "Cannot run MX sync thread for IPv4: %s\n",
- strerror(error));
- exit(EX_OSERR);
+ if (sync_master4.runs) {
+ if ((error = pthread_create(&tid, NULL, sync_master,
+ (void *)&sync_master4)) != 0 ||
+ (error = pthread_detach(tid)) != 0) {
+ syslog(LOG_ERR,
+ "Cannot run MX sync thread for IPv4: %s\n",
+ strerror(error));
+ exit(EX_OSERR);
+ }
}
}
@@ -696,6 +702,12 @@ sync_master(arg)
fclose(stream);
continue;
}
+ if ((error = pthread_detach(tid)) != 0) {
+ syslog(LOG_ERR, "incoming connexion from %s failed, "
+ "pthread_detach failed: %s",
+ peerstr, strerror(error));
+ exit(EX_OSERR); /* XXX: recovery? */
+ }
}
/* NOTREACHED */
@@ -1093,6 +1105,10 @@ sync_sender_start(void) {
if ((error = pthread_create(&tid, NULL,
(void *(*)(void *))sync_sender, NULL)) != 0) {
syslog(LOG_ERR, "pthread_create failed: %s", strerror(error));
+ exit(EX_OSERR);
+ }
+ if ((error = pthread_detach(tid)) != 0) {
+ syslog(LOG_ERR, "pthread_detach failed: %s", strerror(error));
exit(EX_OSERR);
}
return;
Sincerely,
--
Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan
ume@... ume@{,jp.}FreeBSD.org
http://www.imasy.org/~ume/Message
Re: [milter-greylist] sync causing crash
2005-10-20 by Hajimu UMEMOTO
Attachments
- No local attachments were found for this message.