Project

General

Profile

Actions

Bug #12290

closed

Updated by herwinw (Herwin Quarantainenet) about 9 years ago

And of course the backtrace can be improved when installing the debugging symbols for libc

/lib/i386-linux-gnu/i686/cmov/libpthread.so.0(pthread_setname_np+0x50) [0xf73e0ed0] ../nptl/sysdeps/unix/sysv/linux/pthread_setname.c:49

The exact source can be downloaded from https://packages.debian.org/jessie/libc6 (keep in mind that the original source and the packages have to be downloaded separately, and be combined.

Updated by herwinw (Herwin Quarantainenet) about 9 years ago

And since it's pretty easy to get the relevant source on a running debian system:

int 
pthread_setname_np (th, name)
     pthread_t th;
     const char *name;
{
  const struct pthread *pd = (const struct pthread *) th;
...
#define FMT "/proc/self/task/%u/comm" 
  char fname[sizeof (FMT) + 8];
  sprintf (fname, FMT, (unsigned int) pd->tid);

Line 49 is the last line, and this is indeed the first part where a member of td is queried.

Updated by herwinw (Herwin Quarantainenet) about 9 years ago

And this is the simplest solution I could think of. It throws an exception, which is a better way to react than a segfault. Making it actually work would of course be even better.

Updated by herwinw (Herwin Quarantainenet) about 9 years ago

That still segfaulted when using self.name = nil. Version 2 attached.

Updated by nobu (Nobuyoshi Nakada) about 9 years ago

  • Status changed from Open to Closed

Applied in changeset r54598.


thread.c: must be initialized to set name

  • thread.c (get_initialized_threadptr): extract ensuring that the
    thread is initialized.
  • thread.c (rb_thread_setname): thread must be initialized to set
    the name. [ruby-core:74963] [Bug ]

Updated by nobu (Nobuyoshi Nakada) about 9 years ago

  • Description updated (diff)
  • Backport changed from 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN to 2.1: DONTNEED, 2.2: DONTNEED, 2.3: REQUIRED

Updated by nagachika (Tomoyuki Chikanaga) about 9 years ago

  • Backport changed from 2.1: DONTNEED, 2.2: DONTNEED, 2.3: REQUIRED to 2.1: DONTNEED, 2.2: DONTNEED, 2.3: DONE

ruby_2_3 r54607 merged revision(s) 54598,54600.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0