Hi,

I had some issues using the SVN version of WhiteTank on small FreeBSD systems. One of them was that it was running out of memory and so client programs stayed blocked trying to get a shared memory segment at initialization. The patch joined to this mail should prevent that.
diff -ru ../openais-whitetank-9.old/lib/util.c ./lib/util.c
--- ./lib/util.c        2009-04-10 15:40:20.000000000 +0200
+++ ./lib/util.c        2009-04-10 15:44:21.000000000 +0200
@@ -317,16 +317,27 @@
                shmkey = random();
                ipc_segment->shmid = shmget (shmkey, sizeof (struct 
shared_memory),
                        IPC_CREAT|IPC_EXCL|0666);
-       } while (ipc_segment->shmid == -1);
+       } while (ipc_segment->shmid == -1 && errno != ENOSPC && errno != 
ENOMEM);
+
+       if (ipc_segment->shmid == -1 && (errno == ENOSPC || errno == ENOMEM)) {
+               close(request_fd);
+               return -1;
+       }
+
 
        /*
         * Allocate a semaphore segment
         */
        do {
                semkey = random();
-               ipc_segment->semid = semget (semkey, 3, 
IPC_CREAT|IPC_EXCL|0666);
-               ipc_segment->euid = geteuid ();
-       } while (ipc_segment->semid == -1);
+               if ((ipc_segment->semid = semget (semkey, 3, 
IPC_CREAT|IPC_EXCL|0666)) != -1)
+                       ipc_segment->euid = geteuid ();
+       } while (ipc_segment->semid == -1 && errno != ENOSPC && errno != 
ENOMEM);
+
+       if (ipc_segment->semid == -1 && (errno == ENOSPC || errno == ENOMEM)) {
+               close(request_fd);
+               return -1;
+       }
 
        /*
         * Attach to shared memory segment

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to