我使用Azure PostgreSQL服务器在托管在Azure App Service上的应用程序中存储数据。
昨天,应用程序开始抛出连接关闭和管道破裂的异常。
乍一看,它看起来像是数据源的wait_time属性的一个问题,它比数据库更长。
然而,当我查看数据库并查看日志时,我发现了以下日志。我最感兴趣的是这个问题的原因与档案,它会是相关的,我的连接是“放弃”,所以应用停止工作?
2020-07-11 22:43:42 UTC-5f0866f0.f0-LOG: checkpoint complete (240): wrote 16 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=2.046 s, sync=0.031 s, total=2.390 s; sync files=13, longest=0.005 s, average=0.001 s; distance=77 kB, estimate=14627 kB
2020-07-11 22:47:06 UTC-5f0a416a.891c-LOG: connection received: host=127.0.0.1 port=49431 pid=35100
2020-07-11 22:47:06 UTC-5f0a416a.891c-LOG: connection authorized: user=azure_superuserdatabase=azure_sys SSL enabled (protocol=TLSv1.2, cipher=ECDHE-RSA-AES256-GCM-SHA384, compression=off)
2020-07-11 22:48:07 UTC-5f0a41a7.8924-LOG: connection received: host=127.0.0.1 port=49689 pid=35108
2020-07-11 22:48:07 UTC-5f0a41a7.8924-LOG: connection authorized: user=azure_superuserdatabase=postgres SSL enabled (protocol=TLSv1.2, cipher=ECDHE-RSA-AES256-GCM-SHA384, compression=off)
2020-07-11 22:48:09 UTC-5f0866f0.f0-LOG: checkpoint starting: immediate force wait
2020-07-11 22:48:10 UTC-5f0866f0.f0-LOG: checkpoint complete (240): wrote 30 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.046 s, sync=0.046 s, total=0.437 s; sync files=13, longest=0.009 s, average=0.003 s; distance=163 kB, estimate=13180 kB
2020-07-11 22:48:10 UTC-5f0866ee.68-LOG: received immediate shutdown request
2020-07-11 22:48:10 UTC-5f0a3f41.8914-WARNING: terminating connection because of crash of another server process
2020-07-11 22:48:10 UTC-5f0a3f41.8914-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.
2020-07-11 22:48:10 UTC-5f0a3f41.8914-HINT: In a moment you should be able to reconnect to the database and repeat your command.
2020-07-11 22:48:10 UTC-5f0a3f35.8918-WARNING: terminating connection because of crash of another server process
2020-07-11 22:48:10 UTC-5f0a3f35.8918-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.
2020-07-11 22:48:10 UTC-5f0a3f35.8918-HINT: In a moment you should be able to reconnect to the database and repeat your command.
2020-07-11 22:48:10 UTC-5f0a3f2b.8784-WARNING: terminating connection because of crash of another server process
2020-07-11 22:48:10 UTC-5f0a3f2b.8784-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.
2020-07-11 22:48:10 UTC-5f0a3f2b.8784-HINT: In a moment you should be able to reconnect to the database and repeat your command.
2020-07-11 22:48:10 UTC-5f0a3f0d.8780-WARNING: terminating connection because of crash of another server process
2020-07-11 22:48:10 UTC-5f0a3f0d.8780-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.
2020-07-11 22:48:10 UTC-5f0a3f0d.8780-HINT: In a moment you should be able to reconnect to the database and repeat your command.
2020-07-11 22:48:10 UTC-5f0a3ef1.8778-WARNING: terminating connection because of crash of another server process
2020-07-11 22:48:10 UTC-5f0a3ef1.8778-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.
2020-07-11 22:48:10 UTC-5f0a3ef1.8778-HINT: In a moment you should be able to reconnect to the database and repeat your command.
2020-07-11 22:48:10 UTC-5f0a3ee7.8770-WARNING: terminating connection because of crash of another server process
2020-07-11 22:48:10 UTC-5f0a3ee7.8770-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.
2020-07-11 22:48:10 UTC-5f0a3ee7.8770-HINT: In a moment you should be able to reconnect to the database and repeat your command.
2020-07-11 22:48:10 UTC-5f0a3eda.8774-WARNING: terminating connection because of crash of another server process
2020-07-11 22:48:10 UTC-5f0a3eda.8774-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.
2020-07-11 22:48:10 UTC-5f0a3eda.8774-HINT: In a moment you should be able to reconnect to the database and repeat your command.
2020-07-11 22:48:10 UTC-5f0a3ece.8730-WARNING: terminating connection because of crash of another server process
2020-07-11 22:48:10 UTC-5f0a3ece.8730-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.
2020-07-11 22:48:10 UTC-5f0a3ece.8730-HINT: In a moment you should be able to reconnect to the database and repeat your command.
2020-07-11 22:48:10 UTC-5f0a3ec6.872c-WARNING: terminating connection because of crash of another server process
2020-07-11 22:48:10 UTC-5f0a3ec6.872c-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.
2020-07-11 22:48:10 UTC-5f0a3ec6.872c-HINT: In a moment you should be able to reconnect to the database and repeat your command.
2020-07-11 22:48:10 UTC-5f0a3ea9.8728-WARNING: terminating connection because of crash of another server process
2020-07-11 22:48:10 UTC-5f0a3ea9.8728-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.
2020-07-11 22:48:10 UTC-5f0a3ea9.8728-HINT: In a moment you should be able to reconnect to the database and repeat your command.
2020-07-11 22:48:10 UTC-5f0a1412.7acc-WARNING: terminating connection because of crash of another server process
2020-07-11 22:48:10 UTC-5f0a1412.7acc-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.
2020-07-11 22:48:10 UTC-5f0a1412.7acc-HINT: In a moment you should be able to reconnect to the database and repeat your command.
2020-07-11 22:48:10 UTC-5f09f8a7.72a8-WARNING: terminating connection because of crash of another server process
2020-07-11 22:48:10 UTC-5f09f8a7.72a8-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.
2020-07-11 22:48:10 UTC-5f09f8a7.72a8-HINT: In a moment you should be able to reconnect to the database and repeat your command.
2020-07-11 22:48:10 UTC-5f0866f2.7c-WARNING: terminating connection because of crash of another server process
2020-07-11 22:48:10 UTC-5f0866f2.7c-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.
2020-07-11 22:48:10 UTC-5f0866f2.7c-HINT: In a moment you should be able to reconnect to the database and repeat your command.
2020-07-11 22:48:10 UTC-5f0866ee.68-LOG: src/port/kill.c(84): Process (272) exited OOB of pgkill.
2020-07-11 22:48:10 UTC-5f0866f1.fc-WARNING: terminating connection because of crash of another server process
2020-07-11 22:48:10 UTC-5f0866f1.fc-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.
2020-07-11 22:48:10 UTC-5f0866f1.fc-HINT: In a moment you should be able to reconnect to the database and repeat your command.
2020-07-11 22:48:10 UTC-5f0866ee.68-LOG: archiver process (PID 256) exited with exit code 1
2020-07-11 22:48:11 UTC-5f0866ee.68-LOG: database system is shut down发布于 2020-07-13 06:31:11
答案在开始时是正确的:
2020-07-11 22:48:10 UTC-5f0866ee.68-LOG: received immediate shutdown request立即关闭会使服务器崩溃,尽可能快地杀死所有进程,并使数据库集群处于不干净的状态。这样的集群将需要在重新启动时恢复崩溃。
如果您想要不终止客户端连接的关闭,请使用“智能”关闭模式:这将等到最后一个客户端连接结束后才关闭服务器。
如果不是你让服务器崩溃了,你就得调查是谁或者是什么原因造成的。这可能是一个高可用性的软件疯了。
https://dba.stackexchange.com/questions/270811
复制相似问题