pthread_setschedparam: Resource temporarily unavailable
We are using 2.6.28.8 and xenomai 2.4.7 on a AMCC PowerPC 460EX platform and getting
the following message.
Xenomai Posix skin init: pthread_setschedparam: Resource temporarily unavailable
It takes quite a while for this to happen. The /proc/xenomai/heap value for used keeps increasing.
Once the "used" gets very close to "size" the user space xenomai applications can no longer run.
I have isolated the problem to opening and closing shared memory areas.
shmfd = shm_open(RTL_SHM_NAME, O_CREAT | O_RDWR, 0777); if (shmfd == -1) {
printf("Gp Share mem Open, Err: %d Msg: (%s)\n", errno,
strerror(errno));
return -1; } ftruncate(shmfd,MAKE_PAGESIZE(sizeof(struct SHM)));
pshm = mmap(NULL,MAKE_PAGESIZE(sizeof(struct SHM)),PROT_READ |
PROT_WRITE,MAP_SHARED, shmfd,0);
munmap(pshm, MAKE_PAGESIZE(sizeof(struct SHM))); close(shmfd); shm_unlink(RTL_SHM_NAME);
The above calls are in a shared library that an applications call.
**********************************************************
Outbound scan for Spam or Virus by Barracuda at Delta Tau
**********************************************************
Quoted 26 lines · Henry Bausley
We are using 2.6.28.8 and xenomai 2.4.7 on a AMCC PowerPC 460EX platform and getting
the following message.Xenomai Posix skin init:
pthread_setschedparam: Resource temporarily unavailableIt takes quite a while for this to happen. The
/proc/xenomai/heapvalue for used keeps increasing.
Once the "used" gets very close to "size" the user space xenomai applications can no longer run.
I have isolated the problem to opening and closing shared memory areas.shmfd =
shm_open(RTL_SHM_NAME, O_CREAT | O_RDWR, 0777); if (shmfd == -1) {
printf("Gp Share mem Open, Err: %d Msg: (%s)\n", errno,strerror(errno)); return -1;}
ftruncate(shmfd,MAKE_PAGESIZE(sizeof(struct SHM)));pshm = mmap(NULL,MAKE_PAGESIZE(sizeof(struct SHM)),PROT_READ |
PROT_WRITE,MAP_SHARED, shmfd,0);
Quoted 6 lines
munmap(pshm, MAKE_PAGESIZE(sizeof(struct SHM))); close(shmfd); shm_unlink(RTL_SHM_NAME);The above calls are in a shared library that an applications call.
Well, I am surprised, since I received no answer after trying and help you with your last issue, I assumed you had stopped using Xenomai shared memories.
Do you reproduce this issue with Xenomai 2.4.8?
Signature · 1 line
Gilles.
Yes I reproduced this issue with Xenomai 2.4.8.
----- Original Message ----- From: "Gilles Chanteperdrix" <[email protected]>
To: "Henry Bausley" <[email protected]>
Cc: <[email protected]>
Sent: Thursday, August 13, 2009 10:33 AM
Subject: Re: [Xenomai-help] pthread_setschedparam: Resource temporarily unavailable
Quoted 32 lines
Quoted 31 lines · Henry Bausley
We are using 2.6.28.8 and xenomai 2.4.7 on a AMCC PowerPC 460EX platform and getting
the following message.Xenomai Posix skin init:
pthread_setschedparam: Resource temporarily unavailableIt takes quite a while for this to happen. The
/proc/xenomai/heapvalue for used keeps increasing.
Once the "used" gets very close to "size" the user space xenomai applications can no longer run.
I have isolated the problem to opening and closing shared memory areas.shmfd =
shm_open(RTL_SHM_NAME, O_CREAT | O_RDWR, 0777); if (shmfd == -1) {
printf("Gp Share mem Open, Err: %d Msg: (%s)\n", errno,strerror(errno)); return -1;}
ftruncate(shmfd,MAKE_PAGESIZE(sizeof(struct SHM)));pshm = mmap(NULL,MAKE_PAGESIZE(sizeof(struct SHM)),PROT_READ |
PROT_WRITE,MAP_SHARED, shmfd,0);munmap(pshm, MAKE_PAGESIZE(sizeof(struct SHM))); close(shmfd); shm_unlink(RTL_SHM_NAME);
Quoted 11 lines
Quoted 1 line
The above calls are in a shared library that an applications call.
Well, I am surprised, since I received no answer after trying and help you with your last issue, I assumed you had stopped using Xenomai shared memories.
Do you reproduce this issue with Xenomai 2.4.8?
Signature · 1 line
Gilles.
**********************************************************
Outbound scan for Spam or Virus by Barracuda at Delta Tau
**********************************************************
I used the defaults that came up for my 2.6.28.8 kernel I-pipe 2.4-05. I'll rebuild the kernel with 2.6
[email protected]# dmesg | grep pipe ; dmesg | grep 2.4.8 ; uname -a ; /opt/ppmac/tune/test ; cat /proc/xenomai/heap ; /opt/ppmac/tune/test ; cat /proc/xenomai/heap I-pipe 2.4-05: pipeline enabled. I-pipe: Domain Xenomai registered. Xenomai: real-time nucleus v2.4.8 (Lords Of Karma) loaded. Linux powerpmac 2.6.28.8 #1 Mon Aug 17 11:51:01 PDT 2009 ppc GNU/Linux size=4161536:used=23120:pagesz=512 (main heap) size=32256:used=0:pagesz=512 (stack pool) size=4161536:used=23152:pagesz=512 (main heap) size=32256:used=0:pagesz=512 (stack pool) [email protected]#
scripts/prepare-kernel.sh --linux=../linux-2.6.28.8/ --arch=powerpc
Quoted 58 lines · Gilles Chanteperdrix
Quoted 5 lines · wrote:
Yes I can reproduce this on xenomai 2.4.8. Every time I call the functions below I lose 32 bytes.
In my real application I actually have 6 different shared memory segments so I lose 192 bytes every time
the app runs.There is no such leak on my test platforms, and it reminds me of a problem with automatic process cleanup which was fixed in the powerpc I-pipe patch some time ago. So, are you sure you are indeed running the latest I-pipe patch for powerpc which comes with xenomai 2.4.8?
My test program is the following:
#include <
stdio.h>
#include <stdlib.h>#include <
unistd.h>
#include <sys/mman.h>
#include <sys/fcntl.h>#define
SHM_NAME"/foo"
#define SIZE 128 * 1024int main(void)
{ int shmfd = shm_open(SHM_NAME, O_CREAT | O_RDWR, 0777); void *pshm; int rc; if (shmfd == -1) { perror("shm_open"); exit(EXIT_FAILURE); } rc = ftruncate(shmfd, SIZE); if (rc == 1) { perror("ftruncate"); exit(EXIT_FAILURE); } pshm = mmap(NULL, SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, shmfd, 0); if (pshm == MAP_FAILED) { perror("mmap"); exit(EXIT_FAILURE); } rc = munmap(pshm, SIZE); if (rc == -1) { perror("munmap"); exit(EXIT_FAILURE); } rc = close(shmfd); if (rc == -1) { perror("close"); exit(EXIT_FAILURE);
Quoted 9 lines
}
rc = shm_unlink(SHM_NAME);
if (rc == -1) {
perror("shm_unlink");
exit(EXIT_FAILURE);
}
}**********************************************************
Outbound scan for Spam or Virus by Barracuda at Delta Tau
**********************************************************
Quoted 2 lines · Henry Bausley
I used the defaults that came up for my 2.6.28.8 kernel I-pipe 2.4-05. I'll rebuild the kernel with 2.6
Ok. Forget it, I can reproduce it. I simply forgot to enable Xenomai posix skin shared memories in the kernel configuration. The bug does not happen on head though, only on 2.4. And this with the same version of the I-pipe.
Signature · 1 line
Gilles.
Quoted 8 lines · Gilles Chanteperdrix
Quoted 2 lines · Henry Bausley
I used the defaults that came up for my 2.6.28.8 kernel I-pipe 2.4-05. I'll rebuild the kernel with 2.6
Ok. Forget it, I can reproduce it. I simply forgot to enable Xenomai posix skin shared memories in the kernel configuration. The bug does not happen on head though, only on 2.4. And this with the same version of the I-pipe.
It should be fixed in the repository. Here is the patch:
ksrc/skins/posix/syscall.c +2 -0
@@ -2717,6 +2717,8 @@ static int __munmap_epilogue(struct pt_regs *regs)xnlock_put_irqrestore (&pse51_assoc_lock, s); err =munmap (umap->kaddr, len); +if (!err) +xnfree (umap);return !err ?0 : -thread_get_errno (); }
Signature · 1 line
Gilles.
Thank you the memory leak is gone.
Quoted 19 lines · Gilles Chanteperdrix
Quoted 8 lines · Gilles Chanteperdrix
Quoted 2 lines · Henry Bausley
I used the defaults that came up for my 2.6.28.8 kernel I-pipe 2.4-05. I'll rebuild the kernel with 2.6
Ok. Forget it, I can reproduce it. I simply forgot to enable Xenomai posix skin shared memories in the kernel configuration. The bug does not happen on head though, only on 2.4. And this with the same version of the I-pipe.
It should be fixed in the repository. Here is the patch:
ksrc/skins/posix/syscall.c +0
-0
ksrc/skins/posix/syscall.c static int __munmap_epilogue(struct pt_regs *regs) · line 2724
Quoted 8 lines
ksrc/skins/posix/syscall.c +2
-0@@ -2717,6 +2717,8 @@ static int __munmap_epilogue(struct pt_regs *regs)xnlock_put_irqrestore (&pse51_assoc_lock, s); err =munmap (umap->kaddr, len); +if (!err) +xnfree (umap);return !err ?0 : -thread_get_errno (); }
**********************************************************
Outbound scan for Spam or Virus by Barracuda at Delta Tau
**********************************************************