Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[YSQL][SQLsmith] Segmentation fault in quickdie() after <signal handler> #11366

Open
def- opened this issue Feb 4, 2022 · 2 comments
Open

[YSQL][SQLsmith] Segmentation fault in quickdie() after <signal handler> #11366

def- opened this issue Feb 4, 2022 · 2 comments
Assignees
Labels
area/ysql Yugabyte SQL (YSQL) kind/bug This issue is a bug kind/failing-test Tests and testing infra priority/medium Medium priority issue qa_automation Bugs identified via itest-system, LST, Stress automation or causing automation failures

Comments

@def-
Copy link
Contributor

def- commented Feb 4, 2022

Jira Link: DB-835

Description

Found with SQLsmith, crashes in Postgres binary. This might be a problem with the signal handler:

Core was generated by `postgres: yugabyte yugabyte 127.0.0.1(43606) SELECT                           '.
Program terminated with signal 11, Segmentation fault.
#0  pfree (pointer=<optimized out>) at /nfusr/dev-server/dfelsing/code/yugabyte-db/src/postgres/src/backend/utils/mmgr/../../../../../../../src/postgres/src/backend/utils/mmgr/mcxt.c:1113
1113	/nfusr/dev-server/dfelsing/code/yugabyte-db/src/postgres/src/backend/utils/mmgr/../../../../../../../src/postgres/src/backend/utils/mmgr/mcxt.c: No such file or directory.
(gdb) bt
#0  pfree (pointer=<optimized out>) at /nfusr/dev-server/dfelsing/code/yugabyte-db/src/postgres/src/backend/utils/mmgr/../../../../../../../src/postgres/src/backend/utils/mmgr/mcxt.c:1113
#1  errfinish (dummy=<optimized out>) at ../../../../../../../src/postgres/src/backend/utils/error/elog.c:523
#2  0x00000000009313e2 in quickdie (postgres_signal_arg=<optimized out>) at ../../../../../../src/postgres/src/backend/tcop/postgres.c:2672
#3  <signal handler called>
#4  pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:183
#5  0x00007f7d6ead4d18 in wait<boost::asio::detail::conditionally_enabled_mutex::scoped_lock> (this=0x1bc7ab0, lock=...)
    at /opt/yb-build/thirdparty/yugabyte-db-thirdparty-v20211222064126-dd4872fe56-almalinux8-x86_64-clang12-linuxbrew/installed/uninstrumented/include/boost/asio/detail/posix_event.hpp:106
#6  wait (this=0x1bc7aa8, lock=...)
    at /opt/yb-build/thirdparty/yugabyte-db-thirdparty-v20211222064126-dd4872fe56-almalinux8-x86_64-clang12-linuxbrew/installed/uninstrumented/include/boost/asio/detail/conditionally_enabled_event.hpp:89
#7  do_run_one (this=0x1bc7a40, lock=..., this_thread=..., ec=...)
    at /opt/yb-build/thirdparty/yugabyte-db-thirdparty-v20211222064126-dd4872fe56-almalinux8-x86_64-clang12-linuxbrew/installed/uninstrumented/include/boost/asio/detail/impl/scheduler.ipp:409
#8  run (this=0x1bc7a40, ec=...)
    at /opt/yb-build/thirdparty/yugabyte-db-thirdparty-v20211222064126-dd4872fe56-almalinux8-x86_64-clang12-linuxbrew/installed/uninstrumented/include/boost/asio/detail/impl/scheduler.ipp:154
#9  run (this=<optimized out>, ec=...)
    at /opt/yb-build/thirdparty/yugabyte-db-thirdparty-v20211222064126-dd4872fe56-almalinux8-x86_64-clang12-linuxbrew/installed/uninstrumented/include/boost/asio/impl/io_context.ipp:70
#10 yb::rpc::IoThreadPool::Impl::Execute() (this=<optimized out>) at ../../src/yb/rpc/io_thread_pool.cc:76
#11 0x00007f7d6e980245 in operator() (this=0x1b3c950)
    at /opt/yb-build/thirdparty/yugabyte-db-thirdparty-v20211222064126-dd4872fe56-almalinux8-x86_64-clang12-linuxbrew/installed/uninstrumented/libcxx/include/c++/v1/functional:1885
#12 operator() (this=0x1b3c950) at /opt/yb-build/thirdparty/yugabyte-db-thirdparty-v20211222064126-dd4872fe56-almalinux8-x86_64-clang12-linuxbrew/installed/uninstrumented/libcxx/include/c++/v1/functional:2560
#13 yb::Thread::SuperviseThread(void*) (arg=0x1b3c900) at ../../src/yb/util/thread.cc:774
#14 0x00007f7d726e8694 in start_thread (arg=0x7f7d63cc3700) at pthread_create.c:333
#15 0x00007f7d7242a41d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
(gdb) info threads
  Id   Target Id         Frame
  5    LWP 23332         0x00007f7d7242a9f3 in epoll_wait () at ../sysdeps/unix/syscall-template.S:84
  4    LWP 23440         pthread_cond_timedwait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:225
  3    LWP 23324         0x00007f7d72426397 in madvise () at ../sysdeps/unix/syscall-template.S:84
  2    LWP 23259         pthread_cond_timedwait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:225
* 1    LWP 23311         pfree (pointer=<optimized out>) at /nfusr/dev-server/dfelsing/code/yugabyte-db/src/postgres/src/backend/utils/mmgr/../../../../../../../src/postgres/src/backend/utils/mmgr/mcxt.c:1113
(gdb) thread apply all bt
Thread 5 (LWP 23332):
#0  0x00007f7d7242a9f3 in epoll_wait () at ../sysdeps/unix/syscall-template.S:84
#1  0x00007f7d6e4a4bf8 in epoll_poll () from /opt/yb-build/thirdparty/yugabyte-db-thirdparty-v20211222064126-dd4872fe56-almalinux8-x86_64-clang12-linuxbrew/installed/common/lib/libev.so.4
#2  0x00007f7d6e49fc5e in ev_run () from /opt/yb-build/thirdparty/yugabyte-db-thirdparty-v20211222064126-dd4872fe56-almalinux8-x86_64-clang12-linuxbrew/installed/common/lib/libev.so.4
#3  0x00007f7d6eaf746c in run (this=0x1bca508, flags=0) at /opt/yb-build/thirdparty/yugabyte-db-thirdparty-v20211222064126-dd4872fe56-almalinux8-x86_64-clang12-linuxbrew/installed/common/include/ev++.h:211
#4  yb::rpc::Reactor::RunThread() (this=0x1bca480) at ../../src/yb/rpc/reactor.cc:498
#5  0x00007f7d6e980245 in operator() (this=0x1b3cdd0)
    at /opt/yb-build/thirdparty/yugabyte-db-thirdparty-v20211222064126-dd4872fe56-almalinux8-x86_64-clang12-linuxbrew/installed/uninstrumented/libcxx/include/c++/v1/functional:1885
#6  operator() (this=0x1b3cdd0) at /opt/yb-build/thirdparty/yugabyte-db-thirdparty-v20211222064126-dd4872fe56-almalinux8-x86_64-clang12-linuxbrew/installed/uninstrumented/libcxx/include/c++/v1/functional:2560
#7  yb::Thread::SuperviseThread(void*) (arg=0x1b3cd80) at ../../src/yb/util/thread.cc:774
#8  0x00007f7d726e8694 in start_thread (arg=0x7f7d614be700) at pthread_create.c:333
#9  0x00007f7d7242a41d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 4 (LWP 23440):
#0  pthread_cond_timedwait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:225
#1  0x00007f7d72b7b7eb in std::__1::condition_variable::__do_timed_wait(std::__1::unique_lock<std::__1::mutex>&, std::__1::chrono::time_point<std::__1::chrono::system_clock, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > >) () from /opt/yb-build/thirdparty/yugabyte-db-thirdparty-v20211222064126-dd4872fe56-almalinux8-x86_64-clang12-linuxbrew/installed/uninstrumented/libcxx/lib/libc++.so.1
#2  0x00007f7d6e8b25d0 in yb::(anonymous namespace)::LongOperationTrackerHelper::Execute() (this=<optimized out>)
    at /opt/yb-build/thirdparty/yugabyte-db-thirdparty-v20211222064126-dd4872fe56-almalinux8-x86_64-clang12-linuxbrew/installed/uninstrumented/libcxx/include/c++/v1/__mutex_base:465
#3  0x00007f7d6e8b2b3d in __invoke<void (yb::(anonymous namespace)::LongOperationTrackerHelper::*&)(), yb::(anonymous namespace)::LongOperationTrackerHelper *&, void> (__f=<optimized out>,
    __a0=@0x1ca6f38: 0x7f7d6e9b2bf0 <yb::(anonymous namespace)::LongOperationTrackerHelper::Instance()::result>)

    at /opt/yb-build/thirdparty/yugabyte-db-thirdparty-v20211222064126-dd4872fe56-almalinux8-x86_64-clang12-linuxbrew/installed/uninstrumented/libcxx/include/c++/v1/type_traits:3635
#4  __apply_functor<void (yb::(anonymous namespace)::LongOperationTrackerHelper::*)(), std::tuple<yb::(anonymous namespace)::LongOperationTrackerHelper *>, 0, std::tuple<> > (__f=<optimized out>,
    __bound_args=..., __args=<optimized out>)
    at /opt/yb-build/thirdparty/yugabyte-db-thirdparty-v20211222064126-dd4872fe56-almalinux8-x86_64-clang12-linuxbrew/installed/uninstrumented/libcxx/include/c++/v1/functional:2857
#5  operator()<> (this=0x1ca6f28) at /opt/yb-build/thirdparty/yugabyte-db-thirdparty-v20211222064126-dd4872fe56-almalinux8-x86_64-clang12-linuxbrew/installed/uninstrumented/libcxx/include/c++/v1/functional:2890
#6  __invoke<std::__bind<void (yb::(anonymous namespace)::LongOperationTrackerHelper::*)(), yb::(anonymous namespace)::LongOperationTrackerHelper *>> (
    __f=<unknown type in /nfusr/dev-server/dfelsing/code/yugabyte-db/build/release-clang12-linuxbrew-dynamic-ninja/lib/./libyb_util.so, CU 0x15de75, DIE 0x1625ab>)
    at /opt/yb-build/thirdparty/yugabyte-db-thirdparty-v20211222064126-dd4872fe56-almalinux8-x86_64-clang12-linuxbrew/installed/uninstrumented/libcxx/include/c++/v1/type_traits:3694
#7  __thread_execute<std::unique_ptr<std::__thread_struct>, std::__bind<void (yb::(anonymous namespace)::LongOperationTrackerHelper::*)(), yb::(anonymous namespace)::LongOperationTrackerHelper *>> (__t=...)
    at /opt/yb-build/thirdparty/yugabyte-db-thirdparty-v20211222064126-dd4872fe56-almalinux8-x86_64-clang12-linuxbrew/installed/uninstrumented/libcxx/include/c++/v1/thread:280
#8  std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, std::__1::__bind<void (yb::(anonymous namespace)::LongOperationTrackerHelper::*)(), yb::(anonymous namespace)::LongOperationTrackerHelper*> > >(void*) (__vp=0x1ca6f20)
    at /opt/yb-build/thirdparty/yugabyte-db-thirdparty-v20211222064126-dd4872fe56-almalinux8-x86_64-clang12-linuxbrew/installed/uninstrumented/libcxx/include/c++/v1/thread:291
#9  0x00007f7d726e8694 in start_thread (arg=0x7f7d5fcbb700) at pthread_create.c:333
#10 0x00007f7d7242a41d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 3 (LWP 23324):
#0  0x00007f7d72426397 in madvise () at ../sysdeps/unix/syscall-template.S:84
#1  0x00007f7d726e8807 in start_thread (arg=0x7f7d62cc1700) at pthread_create.c:435
#2  0x00007f7d7242a41d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 2 (LWP 23259):
#0  pthread_cond_timedwait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:225
#1  0x00007f7d6e87612d in TimedWait (this=<optimized out>, max_time=...) at ../../src/yb/util/condition_variable.cc:136
#2  yb::ConditionVariable::WaitUntil(yb::MonoTime const&) const (this=0x1b3ce28, wait_timeout_deadline=...) at ../../src/yb/util/condition_variable.cc:88
#3  0x00007f7d6e8764f7 in yb::CountDownLatch::WaitFor(yb::MonoDelta) const (this=0x1b3ce00, delta=...) at ../../src/yb/util/countdown_latch.cc:69
#4  0x00007f7d6e97e2cb in yb::ThreadJoiner::Join() (this=<optimized out>) at ../../src/yb/util/thread.cc:643
#5  0x00007f7d6eafb791 in yb::rpc::Reactor::Join() (this=0x1bca480) at ../../src/yb/rpc/reactor.cc:281
#6  0x00007f7d6eaddae8 in yb::rpc::Messenger::Shutdown() (this=<optimized out>) at ../../src/yb/rpc/messenger.cc:216
#7  0x00007f7d7439dc32 in yb::pggate::PgApiImpl::~PgApiImpl() (this=0x1c8b180) at ../../src/yb/yql/pggate/pggate.cc:268
#8  0x00007f7d7439df7e in yb::pggate::PgApiImpl::~PgApiImpl() (this=0x1c8b180) at ../../src/yb/yql/pggate/pggate.cc:267
#9  0x00007f7d7438f906 in YBCDestroyPgGate () at ../../src/yb/yql/pggate/ybc_pggate.cc:132
#10 0x00000000009313f4 in YBOnPostgresBackendShutdown ()
    at /nfusr/dev-server/dfelsing/code/yugabyte-db/src/postgres/src/backend/utils/misc/../../../../../../../src/postgres/src/backend/utils/misc/pg_yb_utils.c:513
#11 quickdie (postgres_signal_arg=<optimized out>) at ../../../../../../src/postgres/src/backend/tcop/postgres.c:2683
#12 <signal handler called>

#13 0x00007f7d72cfa40f in CreatePrimitiveType<yb::UINT32> () at ../../src/yb/common/ql_type.h:78
#14 yb::QLType::Create(yb::DataType) (data_type=UINT32) at ../../src/yb/common/ql_type.cc:118
#15 0x00007f7d743cb43e in yb::pggate::PgExpr::internal_type() const (this=<optimized out>) at ../../src/yb/yql/pggate/pg_expr.cc:403
#16 0x00007f7d743bf069 in yb::pggate::PgDml::BindColumn(int, yb::pggate::PgExpr*) (this=0x396b980, attr_num=1, attr_value=0x20e77e0) at ../../src/yb/yql/pggate/pg_dml.cc:149
#17 0x00007f7d743bf02a in yb::pggate::PgDml::BindColumn(int, yb::pggate::PgExpr*) (this=0x1f73e00, attr_num=1, attr_value=0x20e77e0) at ../../src/yb/yql/pggate/pg_dml.cc:142
#18 0x00007f7d7439256a in DmlBindColumn (this=<optimized out>, handle=0x66, attr_num=1, attr_value=0x7f7d72c45fe4) at ../../src/yb/yql/pggate/pggate.cc:895
#19 YBCPgDmlBindColumn (handle=0x66, attr_num=1, attr_value=0x7f7d72c45fe4) at ../../src/yb/yql/pggate/ybc_pggate.cc:580
#20 0x00000000005a610d in ybcBindColumn (ybScan=0x4381b38, bind_desc=<optimized out>, attnum=<optimized out>, value=2278, is_null=false, is_hashed=false)
    at ../../../../../../../src/postgres/src/backend/access/yb_access/yb_scan.c:178
#21 0x00000000005a4e29 in ybcBindScanKeys (ybScan=0x4381b38, scan_plan=0x7fffafa869d0) at ../../../../../../../src/postgres/src/backend/access/yb_access/yb_scan.c:852
#22 0x00000000005a4107 in ybcBeginScan (relation=<optimized out>, index=<optimized out>, xs_want_itup=false, nkeys=<optimized out>, key=<optimized out>, pg_scan_plan=0x0)
    at ../../../../../../../src/postgres/src/backend/access/yb_access/yb_scan.c:1325
#23 0x00000000005a6ce4 in ybc_systable_beginscan (relation=0x1f91818, indexId=<optimized out>, indexOK=<optimized out>, snapshot=<optimized out>, nkeys=2, key=0x7fffafa86b60)
    at ../../../../../../../src/postgres/src/backend/access/yb_access/yb_scan.c:1572
#24 0x0000000000541e94 in systable_beginscan (heapRelation=<optimized out>, indexId=<optimized out>, indexOK=<optimized out>, snapshot=<optimized out>, nkeys=<optimized out>, key=0x203b28b08)
    at ../../../../../../../src/postgres/src/backend/access/index/genam.c:345
#25 0x0000000000aabe6a in SearchCatCacheMiss (cache=<optimized out>, nkeys=2, hashValue=1443492981, hashIndex=1141, v1=<optimized out>, v2=<optimized out>, v3=0, v4=0)
    at ../../../../../../../src/postgres/src/backend/utils/cache/catcache.c:1764
#26 0x0000000000aabb35 in SearchCatCacheInternal (cache=0x1d8ea80, nkeys=<optimized out>, v1=<optimized out>, v2=2, v3=0, v4=0) at ../../../../../../../src/postgres/src/backend/utils/cache/catcache.c:1665
#27 0x000000000063ced8 in SearchCatCache2 (cache=0x7fffafa86300, v1=1, v2=140176773111780)
    at /nfusr/dev-server/dfelsing/code/yugabyte-db/src/postgres/src/backend/utils/cache/../../../../../../../src/postgres/src/backend/utils/cache/catcache.c:1541
#28 SearchSysCache2 (cacheId=12, key1=1, key2=140176773111780)
    at /nfusr/dev-server/dfelsing/code/yugabyte-db/src/postgres/src/backend/utils/cache/../../../../../../../src/postgres/src/backend/utils/cache/syscache.c:1626
#29 IsBinaryCoercible (srctype=2278, targettype=3614) at ../../../../../../src/postgres/src/backend/parser/parse_coerce.c:2188
#30 0x00000000006b2a72 in GetDefaultOpClass (type_id=2278, am_id=<optimized out>) at ../../../../../../src/postgres/src/backend/commands/indexcmds.c:2097
#31 0x0000000000acb7f9 in lookup_type_cache (type_id=2278, flags=23) at ../../../../../../../src/postgres/src/backend/utils/cache/typcache.c:416
#32 0x000000000064c216 in get_sort_group_operators (argtype=2278, needLT=false, needEQ=true, needGT=false, ltOpr=0x7fffafa8702c, eqOpr=0x7fffafa87030, gtOpr=0x0, isHashable=0x7fffafa87037)
    at ../../../../../../src/postgres/src/backend/parser/parse_oper.c:211
#33 0x000000000063610b in addTargetToGroupList (pstate=<optimized out>, tle=0x2208d30, grouplist=0x2209010, targetlist=0x2208c60, location=67)
    at ../../../../../../src/postgres/src/backend/parser/parse_clause.c:3453
#34 0x0000000000637a35 in transformDistinctClause (pstate=0x21ddcc8, targetlist=0x21dde28, sortClause=<optimized out>, is_agg=false) at ../../../../../../src/postgres/src/backend/parser/parse_clause.c:2894
#35 0x000000000060237d in transformStmt (pstate=0x21ddcc8, parseTree=0x21ddb38) at ../../../../../../src/postgres/src/backend/parser/analyze.c:1307
#36 0x00000000005ff81e in transformOptionalSelectInto (pstate=0x21ddcc8, parseTree=0x21ddb38) at ../../../../../../src/postgres/src/backend/parser/analyze.c:264
#37 transformTopLevelStmt (pstate=0x21ddcc8, parseTree=0x21ddc48) at ../../../../../../src/postgres/src/backend/parser/analyze.c:214
#38 parse_analyze (parseTree=<optimized out>, sourceText=<optimized out>, paramTypes=0x0, numParams=0, queryEnv=<optimized out>) at ../../../../../../src/postgres/src/backend/parser/analyze.c:120
#39 0x000000000093747c in yb_exec_simple_query_impl (query_string=0x1cb4118) at ../../../../../../src/postgres/src/backend/tcop/postgres.c:698
#40 0x0000000000937dbe in yb_exec_query_wrapper (exec_context=0x1cb4000, restart_data=<optimized out>, functor=0x936e40 <yb_exec_simple_query_impl>, functor_context=0x1cb4118)
    at ../../../../../../src/postgres/src/backend/tcop/postgres.c:4445
#41 0x000000000093469d in PostgresMain (argc=1, argv=<optimized out>, dbname=<optimized out>, username=0x1c97fe8 "yugabyte") at ../../../../../../src/postgres/src/backend/tcop/postgres.c:4479
#42 0x00000000008900ab in BackendRun (port=0x1b301e0) at ../../../../../../src/postgres/src/backend/postmaster/postmaster.c:4470
#43 0x000000000088f7e2 in ServerLoop () at ../../../../../../src/postgres/src/backend/postmaster/postmaster.c:4136
#44 0x000000000088c021 in PostmasterMain (argc=<optimized out>, argv=0x1b466c0) at ../../../../../../src/postgres/src/backend/postmaster/postmaster.c:1417
#45 0x00000000007ac843 in PostgresServerProcessMain (argc=23, argv=0x1b466c0) at ../../../../../../src/postgres/src/backend/main/main.c:234
#46 0x00000000004de432 in main ()

Thread 1 (LWP 23311):
#0  pfree (pointer=<optimized out>) at /nfusr/dev-server/dfelsing/code/yugabyte-db/src/postgres/src/backend/utils/mmgr/../../../../../../../src/postgres/src/backend/utils/mmgr/mcxt.c:1113
#1  errfinish (dummy=<optimized out>) at ../../../../../../../src/postgres/src/backend/utils/error/elog.c:523
#2  0x00000000009313e2 in quickdie (postgres_signal_arg=<optimized out>) at ../../../../../../src/postgres/src/backend/tcop/postgres.c:2672
#3  <signal handler called>
#4  pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:183
#5  0x00007f7d6ead4d18 in yb::rpc::IoThreadPool::Impl::Execute() (this=<optimized out>)
    at /opt/yb-build/thirdparty/yugabyte-db-thirdparty-v20211222064126-dd4872fe56-almalinux8-x86_64-clang12-linuxbrew/installed/uninstrumented/include/boost/asio/detail/posix_event.hpp:106
#6  0x00007f7d6e980245 in operator() (this=0x1b3c950)
    at /opt/yb-build/thirdparty/yugabyte-db-thirdparty-v20211222064126-dd4872fe56-almalinux8-x86_64-clang12-linuxbrew/installed/uninstrumented/libcxx/include/c++/v1/functional:1885
#7  operator() (this=0x1b3c950) at /opt/yb-build/thirdparty/yugabyte-db-thirdparty-v20211222064126-dd4872fe56-almalinux8-x86_64-clang12-linuxbrew/installed/uninstrumented/libcxx/include/c++/v1/functional:2560
#8  yb::Thread::SuperviseThread(void*) (arg=0x1b3c900) at ../../src/yb/util/thread.cc:774
#9  0x00007f7d726e8694 in start_thread (arg=0x7f7d63cc3700) at pthread_create.c:333
#10 0x00007f7d7242a41d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Can't reproduce, but the query was:

CREATE TABLE public.yb_charn_in_key (
    f1 character(4) NOT NULL
);
COPY public.yb_charn_in_key (f1) FROM stdin;
 abc
ab
abc
a
abcd
\.
ALTER TABLE ONLY public.yb_charn_in_key
    ADD CONSTRAINT yb_charn_in_key_pkey PRIMARY KEY (f1);

select distinct
  pg_catalog.pg_current_wal_flush_lsn() as c0,
  pg_catalog.pg_stat_reset() as c1,
  subq_0.c1 as c2,
  4 as c3
from
  (select
        ref_0.f1 as c0,
        51 as c1,
        ref_0.f1 as c2,
        ref_0.f1 as c3
      from
        public.yb_charn_in_key as ref_0
      where false) as subq_0
where false;

Code state: 24ec10d (Release build)
Coredump: core.23259.zip

@def- def- added kind/bug This issue is a bug area/ysql Yugabyte SQL (YSQL) labels Feb 4, 2022
@def-
Copy link
Contributor Author

def- commented Feb 9, 2022

There are many instances of this inside quickdie(), with different looking stacks, so something is going very wrong with our signal handling:

#0  0x0000000000000000 in ?? ()
#1  0x00007f1c11a5ea84 in operator() (this=<optimized out>, __ptr=<optimized out>) at /opt/yb-build/thirdparty/yugabyte-db-thirdparty-v20211222064126-dd4872fe56-almalinux8-x86_64-clang12-linuxbrew/installed/uninstrumented/libcxx/include/c++/v1/memory:1423
#2  clear_and_dispose<std::default_delete<yb::pggate::PgMemctx::Registrable> > (this=0x212e828, disposer=...) at /opt/yb-build/thirdparty/yugabyte-db-thirdparty-v20211222064126-dd4872fe56-almalinux8-x86_64-clang12-linuxbrew/installed/uninstrumented/include/boost/intrusive/list.hpp:754
#3  yb::pggate::PgMemctx::Clear() (this=0x212e7f8) at ../../src/yb/yql/pggate/pg_memctx.cc:80
#4  0x00007f1c11a5e881 in yb::pggate::PgMemctx::~PgMemctx() (this=0x212e7f8) at ../../src/yb/yql/pggate/pg_memctx.cc:29
#5  0x00007f1c11a60017 in __release_shared (this=0x212e7e0) at /opt/yb-build/thirdparty/yugabyte-db-thirdparty-v20211222064126-dd4872fe56-almalinux8-x86_64-clang12-linuxbrew/installed/uninstrumented/libcxx/include/c++/v1/memory:2501
#6  __release_shared (this=0x212e7e0) at /opt/yb-build/thirdparty/yugabyte-db-thirdparty-v20211222064126-dd4872fe56-almalinux8-x86_64-clang12-linuxbrew/installed/uninstrumented/libcxx/include/c++/v1/memory:2543
#7  ~shared_ptr (this=0x2497f08) at /opt/yb-build/thirdparty/yugabyte-db-thirdparty-v20211222064126-dd4872fe56-almalinux8-x86_64-clang12-linuxbrew/installed/uninstrumented/libcxx/include/c++/v1/memory:3233
#8  ~pair (this=0x2497f00) at /opt/yb-build/thirdparty/yugabyte-db-thirdparty-v20211222064126-dd4872fe56-almalinux8-x86_64-clang12-linuxbrew/installed/uninstrumented/libcxx/include/c++/v1/utility:297
#9  destroy<std::pair<yb::pggate::PgMemctx *const, std::shared_ptr<yb::pggate::PgMemctx> >, void, void> (__p=0x2497f00) at /opt/yb-build/thirdparty/yugabyte-db-thirdparty-v20211222064126-dd4872fe56-almalinux8-x86_64-clang12-linuxbrew/installed/uninstrumented/libcxx/include/c++/v1/__memory/allocator_traits.h:317
#10 __deallocate_node (__np=0x2497ef0, this=<optimized out>) at /opt/yb-build/thirdparty/yugabyte-db-thirdparty-v20211222064126-dd4872fe56-almalinux8-x86_64-clang12-linuxbrew/installed/uninstrumented/libcxx/include/c++/v1/__hash_table:1580
#11 clear (this=<optimized out>) at /opt/yb-build/thirdparty/yugabyte-db-thirdparty-v20211222064126-dd4872fe56-almalinux8-x86_64-clang12-linuxbrew/installed/uninstrumented/libcxx/include/c++/v1/__hash_table:1826
#12 clear (this=<optimized out>) at /opt/yb-build/thirdparty/yugabyte-db-thirdparty-v20211222064126-dd4872fe56-almalinux8-x86_64-clang12-linuxbrew/installed/uninstrumented/libcxx/include/c++/v1/unordered_map:1274
#13 yb::pggate::ClearGlobalPgMemctxMap() () at ../../src/yb/yql/pggate/pg_memctx.cc:99
#14 0x00007f1c11a0d90b in YBCDestroyPgGate () at ../../src/yb/yql/pggate/ybc_pggate.cc:133
#15 0x0000000000931484 in YBOnPostgresBackendShutdown () at /nfusr/dev-server/dfelsing/code/yugabyte-db/src/postgres/src/backend/utils/misc/../../../../../../../src/postgres/src/backend/utils/misc/pg_yb_utils.c:513
#16 quickdie (postgres_signal_arg=<optimized out>) at ../../../../../../src/postgres/src/backend/tcop/postgres.c:2683
#17 <signal handler called>
#18 Destroy<google::protobuf::RepeatedPtrField<yb::PgsqlExpressionPB>::TypeHandler> (this=0x3bf65e8) at /opt/yb-build/thirdparty/yugabyte-db-thirdparty-v20211222064126-dd4872fe56-almalinux8-x86_64-clang12-linuxbrew/installed/uninstrumented/include/google/protobuf/repeated_field.h:1472
#19 ~RepeatedPtrField (this=0x3bf65e8) at /opt/yb-build/thirdparty/yugabyte-db-thirdparty-v20211222064126-dd4872fe56-almalinux8-x86_64-clang12-linuxbrew/installed/uninstrumented/include/google/protobuf/repeated_field.h:1934
#20 yb::PgsqlReadRequestPB::~PgsqlReadRequestPB() (this=0x3bf65a0) at src/yb/common/pgsql_protocol.pb.cc:6552
#21 0x00007f1c0c3e4f1e in yb::PgsqlReadRequestPB::~PgsqlReadRequestPB() (this=0x3bf65a0) at src/yb/common/pgsql_protocol.pb.cc:6549
#22 0x00007f1c0c3ee6e1 in yb::PgsqlReadRequestPB::SharedDtor() (this=0x3bf66c0) at src/yb/common/pgsql_protocol.pb.cc:6563
#23 0x00007f1c0c3e4d71 in yb::PgsqlReadRequestPB::~PgsqlReadRequestPB() (this=0x3bf66c0) at src/yb/common/pgsql_protocol.pb.cc:6551
#24 0x00007f1c0c3e4f1e in yb::PgsqlReadRequestPB::~PgsqlReadRequestPB() (this=0x3bf66c0) at src/yb/common/pgsql_protocol.pb.cc:6549
#25 0x00007f1c0d99b5fe in operator() (this=<optimized out>, __ptr=0x0) at /opt/yb-build/thirdparty/yugabyte-db-thirdparty-v20211222064126-dd4872fe56-almalinux8-x86_64-clang12-linuxbrew/installed/uninstrumented/libcxx/include/c++/v1/memory:1423
#26 reset (this=0x2f88680, __p=0x0) at /opt/yb-build/thirdparty/yugabyte-db-thirdparty-v20211222064126-dd4872fe56-almalinux8-x86_64-clang12-linuxbrew/installed/uninstrumented/libcxx/include/c++/v1/memory:1684
#27 ~unique_ptr (this=0x2f88680) at /opt/yb-build/thirdparty/yugabyte-db-thirdparty-v20211222064126-dd4872fe56-almalinux8-x86_64-clang12-linuxbrew/installed/uninstrumented/libcxx/include/c++/v1/memory:1638
#28 ~YBPgsqlReadOp (this=0x2f88630) at ../../src/yb/client/yb_op.h:515
#29 yb::client::YBPgsqlReadOp::~YBPgsqlReadOp() (this=0x2f88630) at ../../src/yb/client/yb_op.h:515
#30 0x00007f1c11a4cc1d in ~__vector_base (this=0x2ef40a0) at /opt/yb-build/thirdparty/yugabyte-db-thirdparty-v20211222064126-dd4872fe56-almalinux8-x86_64-clang12-linuxbrew/installed/uninstrumented/libcxx/include/c++/v1/memory:2501
#31 ~vector (this=0x2ef40a0) at /opt/yb-build/thirdparty/yugabyte-db-thirdparty-v20211222064126-dd4872fe56-almalinux8-x86_64-clang12-linuxbrew/installed/uninstrumented/libcxx/include/c++/v1/vector:557
#32 yb::pggate::PgDocOp::~PgDocOp() (this=0x2ef4018) at ../../src/yb/yql/pggate/pg_doc_op.cc:156
#33 0x00007f1c11a3c1d9 in __release_shared (this=0x2ef4000) at /opt/yb-build/thirdparty/yugabyte-db-thirdparty-v20211222064126-dd4872fe56-almalinux8-x86_64-clang12-linuxbrew/installed/uninstrumented/libcxx/include/c++/v1/memory:2501
#34 __release_shared (this=0x2ef4000) at /opt/yb-build/thirdparty/yugabyte-db-thirdparty-v20211222064126-dd4872fe56-almalinux8-x86_64-clang12-linuxbrew/installed/uninstrumented/libcxx/include/c++/v1/memory:2543
#35 ~shared_ptr (this=0x2770730) at /opt/yb-build/thirdparty/yugabyte-db-thirdparty-v20211222064126-dd4872fe56-almalinux8-x86_64-clang12-linuxbrew/installed/uninstrumented/libcxx/include/c++/v1/memory:3233
#36 yb::pggate::PgDml::~PgDml() (this=0x2770600) at ../../src/yb/yql/pggate/pg_dml.cc:63
#37 0x00007f1c11a45d0e in ~PgDmlRead (this=0x2770600) at ../../src/yb/yql/pggate/pg_dml_read.cc:80
#38 ~PgSelect (this=0x2770600) at ../../src/yb/yql/pggate/pg_select.cc:37
#39 yb::pggate::PgSelect::~PgSelect() (this=0x2770600) at ../../src/yb/yql/pggate/pg_select.cc:36
#40 0x00007f1c11a5ea84 in operator() (this=<optimized out>, __ptr=<optimized out>) at /opt/yb-build/thirdparty/yugabyte-db-thirdparty-v20211222064126-dd4872fe56-almalinux8-x86_64-clang12-linuxbrew/installed/uninstrumented/libcxx/include/c++/v1/memory:1423
#41 clear_and_dispose<std::default_delete<yb::pggate::PgMemctx::Registrable> > (this=0x212e828, disposer=...) at /opt/yb-build/thirdparty/yugabyte-db-thirdparty-v20211222064126-dd4872fe56-almalinux8-x86_64-clang12-linuxbrew/installed/uninstrumented/include/boost/intrusive/list.hpp:754
#42 yb::pggate::PgMemctx::Clear() (this=0x212e7f8) at ../../src/yb/yql/pggate/pg_memctx.cc:80
#43 0x00007f1c11a0ddf3 in YBCPgResetMemctx (memctx=0x212e7f8) at ../../src/yb/yql/pggate/pg_memctx.cc:63
#44 0x0000000000b0db5c in MemoryContextReset (context=0x2246000) at ../../../../../../../src/postgres/src/backend/utils/mmgr/mcxt.c:206
#45 0x0000000000932ea8 in PostgresMain (argc=1, argv=<optimized out>, dbname=<optimized out>, username=0x2229fe8 "yugabyte") at ../../../../../../src/postgres/src/backend/tcop/postgres.c:4946
#46 0x000000000089013b in BackendRun (port=0x20c21e0) at ../../../../../../src/postgres/src/backend/postmaster/postmaster.c:4470
#47 0x000000000088f872 in ServerLoop () at ../../../../../../src/postgres/src/backend/postmaster/postmaster.c:4136
#48 0x000000000088c0b1 in PostmasterMain (argc=<optimized out>, argv=0x20d86c0) at ../../../../../../src/postgres/src/backend/postmaster/postmaster.c:1417
#49 0x00000000007ac8d3 in PostgresServerProcessMain (argc=23, argv=0x20d86c0) at ../../../../../../src/postgres/src/backend/main/main.c:234
#50 0x00000000004de432 in main ()

@yugabyte-ci yugabyte-ci added the priority/medium Medium priority issue label Jun 8, 2022
@kripasreenivasan kripasreenivasan added the qa_automation Bugs identified via itest-system, LST, Stress automation or causing automation failures label Sep 13, 2022
@yugabyte-ci yugabyte-ci added the kind/failing-test Tests and testing infra label Oct 12, 2022
@d-uspenskiy
Copy link
Contributor

It looks like a duplicate of #12884

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ysql Yugabyte SQL (YSQL) kind/bug This issue is a bug kind/failing-test Tests and testing infra priority/medium Medium priority issue qa_automation Bugs identified via itest-system, LST, Stress automation or causing automation failures
Projects
None yet
Development

No branches or pull requests

5 participants