PG9.65版本,创建C-function时,出现coredump 详细过程如下: pg965@SIA1000103209:~> psql psql (9.6.5) Type "help" for help.
postgres=# CREATE OR REPLACE FUNCTION syseval(TEXT) RETURNS TEXT postgres-# AS '/home/pg965/tmp/tmp/testeval.so','syseval' LANGUAGE C STRICT IMMUTABLE; server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request. The connection to the server was lost. Attempting reset: LOG: server process (PID 63417) was terminated by signal 11: Segmentation fault DETAIL: Failed process was running: CREATE OR REPLACE FUNCTION syseval(TEXT) RETURNS TEXT AS '/home/pg965/tmp/tmp/testeval.so','syseval' LANGUAGE C STRICT IMMUTABLE; LOG: terminating any other active server processes WARNING: terminating connection because of crash of another server process DETAIL: The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory. HINT: In a moment you should be able to reconnect to the database and repeat your command. Failed. !> LOG: all server processes terminated; reinitializing LOG: database system was interrupted; last known up at 2018-10-21 14:39:26 CST LOG: database system was not properly shut down; automatic recovery in progress LOG: invalid record length at 0/8F5BA48: wanted 24, got 0 LOG: redo is not required LOG: MultiXact member wraparound protections are now enabled LOG: database system is ready to accept connections LOG: autovacuum launcher started
coredump信息如下: Thread 1 (Thread 0x7f85da97c700 (LWP 72860)): 0 0x00007f85da7a00fe in dlrelocate_object () from /lib64/ld-linux-x86-64.so.2 1 0x00007f85da7a7500 in dlopenworker () from /lib64/ld-linux-x86-64.so.2 2 0x00007f85da7a2e46 in dlcatch_error () from /lib64/ld-linux-x86-64.so.2 3 0x00007f85da7a6dfb in dlopen () from /lib64/ld-linux-x86-64.so.2 4 0x00007f85da182f9b in dlopen_doit () from /lib64/libdl.so.2 5 0x00007f85da7a2e46 in dlcatch_error () from /lib64/ld-linux-x86-64.so.2 6 0x00007f85da18333c in dlerrorrun () from /lib64/libdl.so.2 7 0x00007f85da182f01 in dlopen@@GLIBC_2.2.5 () from /lib64/libdl.so.2 8 0x00000000007dcd0a in internalloadlibrary () 9 0x00000000007dd7d1 in loadexternalfunction () 10 0x00000000005203ac in fmgrcvalidator () 11 0x00000000007e0c1a in OidFunctionCall1Coll () 12 0x00000000005218a7 in ProcedureCreate () 13 0x000000000058f76a in CreateFunction () 14 0x00000000006e95b2 in ProcessUtilitySlow () 15 0x00000000006ea1c2 in standard_ProcessUtility () 16 0x00000000006e64b4 in PortalRunUtility () 17 0x00000000006e74a4 in PortalRunMulti () 18 0x00000000006e7be4 in PortalRun () 19 0x00000000006e42ce in execsimplequery () 20 0x00000000006e5af8 in PostgresMain () 21 0x000000000068366e in ServerLoop () 22 0x0000000000684cae in PostmasterMain () 23 0x000000000060aec3 in main ()
通过分析发现,在加载C-function依赖的.so文件时出错: Missing separate debuginfo for /home/pg965/tmp/tmp/testeval.so Try: zypper install -C "debuginfo(build-id)=6d79dbd0be5e5904fa90dfd2110b54477407402b" Error while mapping shared library sections: `/home/pg965/tmp/tmp/testeval.so': not in executable format: File format not recognized
C-function的创建,真的这么脆弱吗? 在处理外部.so文件时,需要进行文件解析异常判断吧 ~
PG9.65版本,创建C-function时,出现coredump 详细过程如下: pg965@SIA1000103209:~> psql
psql (9.6.5)
Type "help" for help.
postgres=# CREATE OR REPLACE FUNCTION sys_eval(TEXT) RETURNS TEXT
postgres-# AS '/home/pg965/tmp/tmp/testeval.so','sys_eval' LANGUAGE C STRICT IMMUTABLE;
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: LOG: server process (PID 72860) was terminated by signal 11: Segmentation fault
DETAIL: Failed process was running: CREATE OR REPLACE FUNCTION sys_eval(TEXT) RETURNS TEXT
AS '/home/pg965/tmp/tmp/testeval.so','sys_eval' LANGUAGE C STRICT IMMUTABLE;
LOG: terminating any other active server processes
WARNING: terminating connection because of crash of another server process
DETAIL: The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
HINT: In a moment you should be able to reconnect to the database and repeat your command.
FATAL: the database system is in recovery mode
Failed.
!>
!> LOG: all server processes terminated; reinitializing
LOG: database system was interrupted; last known up at 2018-10-21 14:40:04 CST
LOG: database system was not properly shut down; automatic recovery in progress
LOG: invalid record length at 0/8F5BAB8: wanted 24, got 0
LOG: redo is not required
LOG: MultiXact member wraparound protections are now enabled
LOG: database system is ready to accept connections
LOG: autovacuum launcher started
======================= coredump信息如下: Thread 1 (Thread 0x7f85da97c700 (LWP 72860)):
Thread 1 (Thread 0x7f85da97c700 (LWP 72860)):
0 0x00007f85da7a00fe in dlrelocate_object () from /lib64/ld-linux-x86-64.so.2
1 0x00007f85da7a7500 in dlopenworker () from /lib64/ld-linux-x86-64.so.2
2 0x00007f85da7a2e46 in dlcatch_error () from /lib64/ld-linux-x86-64.so.2
3 0x00007f85da7a6dfb in dlopen () from /lib64/ld-linux-x86-64.so.2
4 0x00007f85da182f9b in dlopen_doit () from /lib64/libdl.so.2
5 0x00007f85da7a2e46 in dlcatch_error () from /lib64/ld-linux-x86-64.so.2
6 0x00007f85da18333c in dlerrorrun () from /lib64/libdl.so.2
7 0x00007f85da182f01 in dlopen@@GLIBC_2.2.5 () from /lib64/libdl.so.2
8 0x00000000007dcd0a in internalloadlibrary ()
9 0x00000000007dd7d1 in loadexternalfunction ()
10 0x00000000005203ac in fmgrcvalidator ()
11 0x00000000007e0c1a in OidFunctionCall1Coll ()
12 0x00000000005218a7 in ProcedureCreate ()
13 0x000000000058f76a in CreateFunction ()
14 0x00000000006e95b2 in ProcessUtilitySlow ()
15 0x00000000006ea1c2 in standard_ProcessUtility ()
16 0x00000000006e64b4 in PortalRunUtility ()
17 0x00000000006e74a4 in PortalRunMulti ()
18 0x00000000006e7be4 in PortalRun ()
19 0x00000000006e42ce in execsimplequery ()
20 0x00000000006e5af8 in PostgresMain ()
21 0x000000000068366e in ServerLoop ()
22 0x0000000000684cae in PostmasterMain ()
23 0x000000000060aec3 in main ()
=============>>>>>>>>>>>>> 通过分析发现,在加载C-function依赖的.so文件时出错:
Missing separate debuginfo for /home/pg965/tmp/tmp/testeval.so
Try: zypper install -C "debuginfo(build-id)=6d79dbd0be5e5904fa90dfd2110b54477407402b"
Error while mapping shared library sections:
`/home/pg965/tmp/tmp/testeval.so': not in executable format: File forma
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。