All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: Perrine Martignoni <perrmart@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] Problem with pthread_setschedparam
Date: Wed, 9 May 2007 22:37:50 +0200	[thread overview]
Message-ID: <17986.12574.488256.997900@domain.hid> (raw)
In-Reply-To: <7289437c0705090735n58b4a0fbm7e31c8571efb7514@domain.hid>

Perrine Martignoni wrote:
 > On 5/9/07, Perrine Martignoni <perrmart@domain.hid> wrote:
 > >  On 5/9/07, Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org> wrote:
 > > >
 > > > Noren, Andrew wrote:
 > > > > Hi Gilles,
 > > > >
 > > > > I too have encountered this issue with the POSIX skin.
 > > > > I think it may have to do with the order in which the posix skin hooks
 > > > > are run on thread deletion.
 > > > >
 > > > > In ksrc/skins/posix/syscall.c
 > > > > xnpod_remove_hook(XNHOOK_THREAD_DELETE, &__shadow_delete_hook);
 > > > >
 > > > > and ksrc/skins/posix/thread.c
 > > > > xnpod_add_hook(XNHOOK_THREAD_DELETE, thread_delete_hook);
 > > > >
 > > > > The thread_delete_hook seems to run first causing the thread data to
 > > > be
 > > > > destroyed before __shadow_delete_hook has a chance to run.
 > > > >
 > > > > This results in __shadow_delete_hook failing in various cases.
 > > > >
 > > > > An example of an error case linked with this would be the failure to
 > > > > remove the thread key from the hash bucket after application
 > > > exit.  The
 > > > > next run of an application can then result in pthread_setschedparam
 > > > > failing to create a shadow since it likely finds an id in the hash
 > > > > bucket already.
 > > >
 > > > Hi,
 > > >
 > > > thanks for pointing this out, I see other skins use xnfreesafe in their
 > > > thread deletion hook instead of xnfree. The attached patch fixes this.
 > > >
 > > > Perrine, could you apply this patch and check that it solves your issue
 > > > ?
 > >
 > > I'll do that as soon as I can.
 > > Thanks
 > >
 >
 > I have applied the patch.
 > It doesn't solve the problem but I have more information :
 > 
 > 
 > pthread_create returned 11
 > 
 > __pthread_shadow: -11
 > 
 > Xenomai Posix skin init: pthread_setschedparam: Resource temporarily
 > unavailable

Ok, I could reproduce the problem. The issue is most likely an access to
the thread memory after it has been freed which breaks the allocator
linked list of free pages by replacing a link to a next free page by a
NULL pointer. xnheap_alloc interprets this NULL pointer as the end of the
linked list and hence considers that it is out of memory.

-- 


					    Gilles Chanteperdrix.


  reply	other threads:[~2007-05-09 20:37 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.51.1178704831.10156.xenomai@xenomai.org>
2007-05-09 12:49 ` [Xenomai-help] Problem with pthread_setschedparam Noren, Andrew
2007-05-09 13:32   ` Gilles Chanteperdrix
2007-05-09 13:43     ` Perrine Martignoni
2007-05-09 14:35       ` Perrine Martignoni
2007-05-09 20:37         ` Gilles Chanteperdrix [this message]
2007-05-09 21:23           ` Gilles Chanteperdrix
2007-05-09 22:02             ` Philippe Gerum
     [not found]               ` <17986.20728.617772.991566@domain.hid>
     [not found]                 ` <1178784303.11688.108.camel@domain.hid>
2007-05-10  8:34                   ` Gilles Chanteperdrix
2007-05-10  8:41                     ` Gilles Chanteperdrix
2007-05-10  8:58                     ` Daniel Schnell
2007-05-10  9:12                       ` Gilles Chanteperdrix
2007-05-14  9:17                         ` Daniel Schnell
2007-05-14  9:49                           ` Wolfgang Grandegger
2007-05-14  9:56                             ` Daniel Schnell
2007-05-18  9:58                               ` Wolfgang Grandegger
2007-05-10  9:26                     ` Philippe Gerum
2007-05-10  9:33                       ` Gilles Chanteperdrix
2007-05-10 11:41                         ` Perrine Martignoni
2007-05-10 12:06                           ` Gilles Chanteperdrix
2007-05-10 12:47                             ` Perrine Martignoni
2007-05-10 12:53                               ` Gilles Chanteperdrix
2007-05-10 14:40                         ` Philippe Gerum
2007-05-10 14:53                           ` Gilles Chanteperdrix
2007-05-10 15:21                             ` Philippe Gerum
2007-05-10 15:45                               ` Gilles Chanteperdrix
2007-05-11  7:56                                 ` Perrine Martignoni
2007-05-11  8:17                                   ` Gilles Chanteperdrix
2007-05-11  8:24                                     ` Perrine Martignoni
2007-05-11  8:30                                       ` Perrine Martignoni
2007-05-11  8:50                                 ` Philippe Gerum
2007-05-09  8:55 Perrine Martignoni
2007-05-09  9:05 ` Gilles Chanteperdrix
2007-05-09  9:32 ` Gilles Chanteperdrix
2007-05-09 11:31   ` Perrine Martignoni
2007-05-09 12:34     ` Gilles Chanteperdrix

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=17986.12574.488256.997900@domain.hid \
    --to=gilles.chanteperdrix@xenomai.org \
    --cc=perrmart@domain.hid \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.