Program terminated with signal 6, Aborted
Program terminated with signal 6, Aborted,有可能啥原因呢?其中一种原因就是事实上的OOM(虽然/var/log/message中没有标明操作系统kill了进行,应该是进程内部初始化已申请内存时报错了,因为malloc的申请会被OS尽可能延后的分配,所以很有可能已经申请的内存早就OOM了,但是程序还可以运行一段时间,甚至很久,除非设置了lock in memory,比如jdk和oracle、mysql都支持这么做)
但是也不一定,如下:
2022-04-01 06:45:04.269332C mysub zjh@postgres ::1(62148) walsender idle 55006[2022-04-01 06:45:04 UTC] 0 [88793] ERROR: replication slot "mysub" is active for PID 192415 2022-04-01 06:45:34.277434C mysub zjh@postgres ::1(62484) walsender idle 55006[2022-04-01 06:45:34 UTC] 0 [88976] ERROR: replication slot "mysub" is active for PID 192415 2022-04-01 06:48:30.667272C mysub zjh@postgres ::1(63883) walsender startup XX000[2022-04-01 06:46:04 UTC] 0 [89179] PANIC: stuck spinlock detected at InitWalSenderSlot, walsender.c:2415 2022-04-01 06:48:39.594554C @ postmaster 00000[2022-03-29 11:23:45 UTC] 0 [69880] LOG: server process (PID 89179) was terminated by signal 6: Aborted 2022-04-01 06:48:39.594567C @ postmaster 00000[2022-03-29 11:23:45 UTC] 0 [69880] LOG: terminating any other active server processes 2022-04-01 06:48:39.594624C pgbench_sub zjh@postgres ::1(63882) walsender idle 57P02[2022-04-01 05:19:52 UTC] 0 [231421] WARNING: terminating connection because of crash of another server process 2022-04-01 06:48:39.594624C pgbench_sub zjh@postgres ::1(63882) walsender idle 57P02[2022-04-01 05:19:52 UTC] 0 [231421] 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. 2022-04-01 06:48:39.594624C pgbench_sub zjh@postgres ::1(63882) walsender idle 57P02[2022-04-01 05:19:52 UTC] 0 [231421] HINT: In a moment you should be able to reconnect to the database and repeat your command. 2022-04-01 06:48:39.594631C ltsql zjh@postgres [local] client backend idle 57P02[2022-04-01 06:14:36 UTC] 0 [254275] WARNING: terminating connection because of crash of another server process 2022-04-01 06:48:39.594631C ltsql zjh@postgres [local] client backend idle 57P02[2022-04-01 06:14:36 UTC] 0 [254275] 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. 2022-04-01 06:48:39.594631C ltsql zjh@postgres [local] client backend idle 57P02[2022-04-01 06:14:36 UTC] 0 [254275] HINT: In a moment you should be able to reconnect to the database and repeat your command.
在postgresql/lightdb中,是因为默认(通过编译时宏S_LOCK_TEST控制)会限制自旋锁等待的时间,如果超过指定阈值(1ms-1s*1000),就会触发stuck spinlock,然后导致lightdb/postgresql自动重启。