首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >由于另一个服务器进程崩溃而终止连接

由于另一个服务器进程崩溃而终止连接
EN

Server Fault用户
提问于 2015-07-15 20:29:09
回答 1查看 20.8K关注 0票数 5

我有一个java刮板,它产生大约1,500-2,100个线程,每个线程通过jdbc连接到同一个数据库,并进行插入。这些线程非常频繁地插入。

当连接太多时,数据库似乎会崩溃。当所有线程都失去连接时,我总是可以生成210个线程或连接。下面是在服务器端生成的日志消息。

代码语言:javascript
复制
2015-07-15 20:18:37 UTC [10825-21] LOG:  checkpointer process (PID 13435) was terminated by signal 9: Killed
2015-07-15 20:18:37 UTC [10825-22] LOG:  terminating any other active server processes
2015-07-15 20:18:37 UTC [16836-1] user@db WARNING:  terminating connection because of crash of another server process
2015-07-15 20:18:37 UTC [16836-2] user@db 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.
2015-07-15 20:18:37 UTC [16836-3] user@db HINT:  In a moment you should be able to reconnect to the database and repeat your command.

下面是显示在客户端(刮板)端的错误消息。

代码语言:javascript
复制
SEVERE: An I/O error occurred while sending to the backend.
org.postgresql.util.PSQLException: An I/O error occurred while sending to the backend.
    at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:283)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:570)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:420)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:366)
    at SocketBot.run(SocketBot.java:167)
Caused by: java.io.EOFException
    at org.postgresql.core.PGStream.ReceiveChar(PGStream.java:284)
    at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1803)
    at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
    ... 4 more

在postgresql.conf文件中,我设置了最大连接= 2500。但我想这里还有更多的东西需要调整。如果有人想知道的话,我的服务器有512 My内存。

EN

回答 1

Server Fault用户

发布于 2015-07-16 12:14:28

Linux的内存不足杀手可能正在终止进程。这意味着您的服务器配置错误。强烈建议您不要让Linux过多地提交内存,因此它以适当的内存外错误来响应应用程序,而不是几乎随机地杀死进程。PostgreSQL被设计用来处理内存不足的情况,但如果Linux杀死进程而不是报告内存不足的情况,则不能这样做。

要确认这里发生的情况,请使用dmesg命令检查内核消息日志。

请参阅http://www.postgresql.org/docs/current/static/kernel-resources.html#LINUX-MEMORY-OVERCOMMIT

票数 6
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/706047

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档