pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dmitriy Sarafannikov <dimon99901@mail.ru>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Andres Freund <andres@anarazel.de>
Cc: pgsql-bugs <pgsql-bugs@postgresql.org>
Subject: Re: [BUGS] Segfault in MemoryContextAlloc
Date: Fri, 11 Mar 2016 16:03:33 +0300
Message-ID: <1457701413.865304335@f395.i.mail.ru> (raw)
In-Reply-To: <31612.1454801878@sss.pgh.pa.us>
References: <1453890275.241158212@f404.i.mail.ru>
	<1453891638.831641165@f352.i.mail.ru>
	<31612.1454801878@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

 
> Both this and the other behavior you reported sure seem like "can't
> happen" situations.  I do have a theory though: I think you are doing
> something that is spawning multiple threads inside the backend, and then
> the backend logic goes nuts because it's expecting to be single-threaded.
> 
> pg_buffercache wouldn't do that, and a quick google search suggests that
> V8 knows nothing of threads either.  Have you got anything else going
> on in there?

I caught another segfault, which is similar to previous.
There are 2 threads and in one of this you can see libv8 functions in backtrace, and then
he was interrupted by signal.

Any ideas?


Core was generated by `postgres: xxxx xxxx x.x.x.x(58804) idle                             '.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  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
584	/build/postgresql-9.4-1wOG_M/postgresql-9.4-9.4.6/build/../src/backend/utils/mmgr/mcxt.c: No such file or directory.

(gdb) bt
#0  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
#1  0x00007f0e3240c4ac in AfterTriggerBeginXact () at /build/postgresql-9.4-1wOG_M/postgresql-9.4-9.4.6/build/../src/backend/commands/trigger.c:3913
#2  0x00007f0e3233bea1 in StartTransaction () at /build/postgresql-9.4-1wOG_M/postgresql-9.4-9.4.6/build/../src/backend/access/transam/xact.c:1848
#3  StartTransactionCommand () at /build/postgresql-9.4-1wOG_M/postgresql-9.4-9.4.6/build/../src/backend/access/transam/xact.c:2534
#4  0x00007f0e32502761 in ProcessCatchupEvent () at /build/postgresql-9.4-1wOG_M/postgresql-9.4-9.4.6/build/../src/backend/storage/ipc/sinval.c:337
#5  0x00007f0e32502a5d in HandleCatchupInterrupt () at /build/postgresql-9.4-1wOG_M/postgresql-9.4-9.4.6/build/../src/backend/storage/ipc/sinval.c:210
#6  0x00007f0e32500c15 in procsignal_sigusr1_handler (postgres_signal_arg=<optimized out>) at /build/postgresql-9.4-1wOG_M/postgresql-9.4-9.4.6/build/../src/backend/storage/ipc/procsignal.c:272
#7  <signal handler called>
#8  sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:84
#9  0x00007f0c0ef0544d in v8::internal::LinuxSemaphore::Wait (this=0x7f0c080008c0) at ../src/platform-linux.cc:880
#10 0x00007f0c0ee235d8 in v8::internal::RuntimeProfiler::WaitForSomeIsolateToEnterJS () at ../src/runtime-profiler.cc:452
#11 0x00007f0c0ee23cf8 in WaitForSomeIsolateToEnterJS () at ../src/runtime-profiler.cc:451
#12 v8::internal::RuntimeProfilerRateLimiter::SuspendIfNecessary (this=this@entry=0x7f0e3468672c) at ../src/runtime-profiler.cc:499
#13 0x00007f0c0ef05690 in v8::internal::SignalSender::Run (this=0x7f0e34686700) at ../src/platform-linux.cc:1160
#14 0x00007f0c0ef053a0 in v8::internal::ThreadEntry (arg=0x7f0e34686700) at ../src/platform-linux.cc:756
#15 0x00007f0e2ef570a4 in start_thread (arg=0x7f0e32820700) at pthread_create.c:309
#16 0x00007f0e305e887d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

(gdb) info threads
  Id   Target Id         Frame 
  2    Thread 0x7f0e329d2740 (LWP 46202) 0x00007f0e305e972b in __libc_recv (fd=13, buf=buf@entry=0x7f0e32a1b140 <PqRecvBuffer>, n=n@entry=8192, flags=-1, flags@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

(gdb) thread 2
[Switching to thread 2 (Thread 0x7f0e329d2740 (LWP 46202))]
#0  0x00007f0e305e972b in __libc_recv (fd=13, buf=buf@entry=0x7f0e32a1b140 <PqRecvBuffer>, n=n@entry=8192, flags=-1, flags@entry=0) at ../sysdeps/unix/sysv/linux/x86_64/recv.c:33
33	../sysdeps/unix/sysv/linux/x86_64/recv.c: No such file or directory.

(gdb) bt
#0  0x00007f0e305e972b in __libc_recv (fd=13, buf=buf@entry=0x7f0e32a1b140 <PqRecvBuffer>, n=n@entry=8192, flags=-1, flags@entry=0) at ../sysdeps/unix/sysv/linux/x86_64/recv.c:33
#1  0x00007f0e3244c525 in recv (__flags=0, __n=8192, __buf=0x7f0e32a1b140 <PqRecvBuffer>, __fd=<optimized out>) at /usr/include/x86_64-linux-gnu/bits/socket2.h:44
#2  secure_read (port=0x7f0e34282fe0, ptr=0x7f0e32a1b140 <PqRecvBuffer>, len=8192) at /build/postgresql-9.4-1wOG_M/postgresql-9.4-9.4.6/build/../src/backend/libpq/be-secure.c:317
#3  0x00007f0e32455e40 in pq_recvbuf () at /build/postgresql-9.4-1wOG_M/postgresql-9.4-9.4.6/build/../src/backend/libpq/pqcomm.c:862
#4  0x00007f0e32456bb5 in pq_getbyte () at /build/postgresql-9.4-1wOG_M/postgresql-9.4-9.4.6/build/../src/backend/libpq/pqcomm.c:905
#5  0x00007f0e3251c551 in SocketBackend (inBuf=0x7ffdb8207e20) at /build/postgresql-9.4-1wOG_M/postgresql-9.4-9.4.6/build/../src/backend/tcop/postgres.c:337
#6  ReadCommand (inBuf=0x7ffdb8207e20) at /build/postgresql-9.4-1wOG_M/postgresql-9.4-9.4.6/build/../src/backend/tcop/postgres.c:510
#7  PostgresMain (argc=<optimized out>, argv=argv@entry=0x7f0e34241380, dbname=0x7f0e34241350 "xxxx", username=<optimized out>)
    at /build/postgresql-9.4-1wOG_M/postgresql-9.4-9.4.6/build/../src/backend/tcop/postgres.c:4033
#8  0x00007f0e322e1b34 in BackendRun (port=0x7f0e34282fe0) at /build/postgresql-9.4-1wOG_M/postgresql-9.4-9.4.6/build/../src/backend/postmaster/postmaster.c:4285
#9  BackendStartup (port=0x7f0e34282fe0) at /build/postgresql-9.4-1wOG_M/postgresql-9.4-9.4.6/build/../src/backend/postmaster/postmaster.c:3948
#10 ServerLoop () at /build/postgresql-9.4-1wOG_M/postgresql-9.4-9.4.6/build/../src/backend/postmaster/postmaster.c:1679
#11 0x00007f0e324c4eab in PostmasterMain (argc=5, argv=<optimized out>) at /build/postgresql-9.4-1wOG_M/postgresql-9.4-9.4.6/build/../src/backend/postmaster/postmaster.c:1287
#12 0x00007f0e322e2cd2 in main (argc=5, argv=0x7f0e34240570) at /build/postgresql-9.4-1wOG_M/postgresql-9.4-9.4.6/build/../src/backend/main/main.c:228


Thanks for advance.

-- 
Best regards,
Dmitriy Sarafannikov

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs


view thread (4+ messages)  latest in thread

Message-ID: <1457701413.865304335@f395.i.mail.ru>
Permalink:  ../1457701413.865304335@f395.i.mail.ru/
Also on:    postgresql.org/message-id/1457701413.865304335@f395.i.mail.ru

 · 

reply

Reply instructions:

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

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: dimon99901@mail.ru, tgl@sss.pgh.pa.us, andres@anarazel.de
  Subject: Re: [BUGS] Segfault in MemoryContextAlloc
  In-Reply-To: <1457701413.865304335@f395.i.mail.ru>
  References: <1453890275.241158212@f404.i.mail.ru> <1453891638.831641165@f352.i.mail.ru> <31612.1454801878@sss.pgh.pa.us> <1457701413.865304335@f395.i.mail.ru>

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

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox