Re[2]: [BUGS] Re: [BUGS] Segfault in MemoryContextAlloc

From: Dmitriy Sarafannikov <dimon99901(at)mail(dot)ru>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andres Freund <andres(at)anarazel(dot)de>, pgsql-bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re[2]: [BUGS] Re: [BUGS] Segfault in MemoryContextAlloc
Date: 2016-03-11 15:10:32
Message-ID: 1457709032.586784536@f131.i.mail.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

> Uh, well:
>
> > (gdb) info threads
> > Id Target Id Frame
> > 2 Thread 0x7f0e329d2740 (LWP 46202) 0x00007f0e305e972b in __libc_recv (fd=13, buf=buf(at)entry=0x7f0e32a1b140 <PqRecvBuffer>, n=n(at)entry=8192, flags=-1, flags(at)entry=0)
> > at ../sysdeps/unix/sysv/linux/x86_64/recv.c:33
> > * 1 Thread 0x7f0e32820700 (LWP 46918) MemoryContextAlloc (context=0x0, size=120) at /build/postgresql-9.4-1wOG_M/postgresql-9.4-9.4.6/build/../src/backend/utils/mmgr/mcxt.c:584
>
> There's not enough information here to disclose what it is that's creating
> a second thread, but you need to find that and make it stop.

Thanks for the answer.

I create new local connection (not via connection pool)

postgres=# select 1;
?column?
----------
1
(1 row)

gdb shows 1 thread

(gdb) info thread
Id Target Id Frame
* 1 Thread 0x7f0e329d2740 (LWP 84804) "postgres" 0x00007f0e305e96cd in __libc_recv (fd=13, buf=buf(at)entry=0x7f0e32a1b140 <PqRecvBuffer>, n=n(at)entry=8192, flags=-1, flags(at)entry=0)
at ../sysdeps/unix/sysv/linux/x86_64/recv.c:29

After that i execute something on plv8

postgres=# do $$ plv8.elog(NOTICE, 'bla-bla-bla') $$ language plv8;
NOTICE: bla-bla-bla
DO

And then gdb shows 2 threads:

(gdb) info thread
Id Target Id Frame
2 Thread 0x7f0e32827700 (LWP 85903) "SignalSender" sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:85
* 1 Thread 0x7f0e329d2740 (LWP 84804) "postgres" 0x00007f0e305e972b in __libc_recv (fd=13, buf=buf(at)entry=0x7f0e32a1b140 <PqRecvBuffer>, n=n(at)entry=8192, flags=-1, flags(at)entry=0)
at ../sysdeps/unix/sysv/linux/x86_64/recv.c:33

(gdb) thread 2
[Switching to thread 2 (Thread 0x7f0e32827700 (LWP 85903))]
#0 sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:85
85 ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S: No such file or directory.
(gdb) bt
#0 sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:85
#1 0x00007f0c0ed0544d in v8::internal::LinuxSemaphore::Wait (this=0x7f0c080008c0) at ../src/platform-linux.cc:880
#2 0x00007f0c0ec235d8 in v8::internal::RuntimeProfiler::WaitForSomeIsolateToEnterJS () at ../src/runtime-profiler.cc:452
#3 0x00007f0c0ec23cf8 in WaitForSomeIsolateToEnterJS () at ../src/runtime-profiler.cc:451
#4 v8::internal::RuntimeProfilerRateLimiter::SuspendIfNecessary (this=this(at)entry=0x7f0e342642dc) at ../src/runtime-profiler.cc:499
#5 0x00007f0c0ed05690 in v8::internal::SignalSender::Run (this=0x7f0e342642b0) at ../src/platform-linux.cc:1160
#6 0x00007f0c0ed053a0 in v8::internal::ThreadEntry (arg=0x7f0e342642b0) at ../src/platform-linux.cc:756
#7 0x00007f0e2ef570a4 in start_thread (arg=0x7f0e32827700) at pthread_create.c:309
#8 0x00007f0e305e887d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

It turns out that plv8 creates thread.

--
Best regards,
Dmitriy Sarafannikov

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2016-03-11 15:51:08 Re: Re[2]: [BUGS] Re: [BUGS] Segfault in MemoryContextAlloc
Previous Message Tom Lane 2016-03-11 14:42:07 Re: Re: [BUGS] Segfault in MemoryContextAlloc