使用Httpclient的项目经常内存溢出

YW5588 2018-08-07 01:01:00
项目使用httpclient与别的项目进行接口的调用,最近发现项目经常会莫名其妙的停止服务,错误如下图,希望大牛来给我解惑
...全文
959 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
多半是因为连接用完后没有彻底关闭,
创建http连接连接时用CloseableHttpClient,
CloseableHttpClient httpclient = HttpClients.createDefault();
//关闭连接
httpclient.close();

这样是可以彻底关闭连接的,不过httpclient 版本得4.4.0以上
幽饮烛 2018-08-09
  • 打赏
  • 举报
回复
用 HttpClientUtils的closeQuietly方法
not_easy 2018-08-09
  • 打赏
  • 举报
回复
用http连接池
zhuizhuizhui666 2018-08-08
  • 打赏
  • 举报
回复
之前用过httpclient,close关闭不了,最后用连接池管理的
幽饮烛 2018-08-07
  • 打赏
  • 举报
回复
response 没关闭?
YW5588 2018-08-07
  • 打赏
  • 举报
回复
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007f3f75a8c626, pid=24658, tid=139904928417536
#
# JRE version: OpenJDK Runtime Environment (7.0_45-b15) (build 1.7.0_45-mockbuild_2013_11_22_18_30-b00)
# Java VM: OpenJDK 64-Bit Server VM (24.45-b08 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# J org.apache.http.client.protocol.RequestAddCookies.process(Lorg/apache/http/HttpRequest;Lorg/apache/http/protocol/HttpContext;)V
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# If you would like to submit a bug report, please include
# instructions on how to reproduce the bug and visit:
# http://icedtea.classpath.org/bugzilla
#

--------------- T H R E A D ---------------

Current thread (0x00007f3e74013800): JavaThread "http-bio-18090-exec-21" daemon [_thread_in_Java, id=24756, stack(0x00007f3e277f8000,0x00007f3e278f9000)]

siginfo:si_signo=SIGSEGV: si_errno=0, si_code=1 (SEGV_MAPERR), si_addr=0x00000003eb9c0588

Registers:
RAX=0x00000007c386c1a0, RBX=0x0000000000000002, RCX=0x0000000000000000, RDX=0x0000000000000001
RSP=0x00007f3e278f5d40, RBP=0x0000000000000000, RSI=0x00000007c374db48, RDI=0x00000007c374db44
R8 =0x0000000000000001, R9 =0x0000000000000001, R10=0x000000007d7380b0, R11=0x0000000000000000
R12=0x0000000000000000, R13=0x00000006a068b728, R14=0x000000000000000a, R15=0x00007f3e74013800
RIP=0x00007f3f75a8c626, EFLAGS=0x0000000000010293, CSGSFS=0x0000000000000033, ERR=0x0000000000000004
TRAPNO=0x000000000000000e

Top of Stack: (sp=0x00007f3e278f5d40)
0x00007f3e278f5d40: 0000000000000002 00000006a06897a0
0x00007f3e278f5d50: 000000000000003f 00000006a06898c0
0x00007f3e278f5d60: 00000006ffffffff 00000006a068b790
0x00007f3e278f5d70: 00000006a068b740 d40d1812a068b740
0x00007f3e278f5d80: 00000006a068b790 00000006a068b728
0x00007f3e278f5d90: 0000000600000002 00000006a068a060
0x00007f3e278f5da0: 0000000000000002 00000006a068b740
0x00007f3e278f5db0: 00000006a0666f48 0000000100000000
0x00007f3e278f5dc0: 00007f3e0000000a 0000000000000005
0x00007f3e278f5dd0: 00007f3f757d2530 00000006ecb2f9e0
0x00007f3e278f5de0: fffffffff87047d2 00000006a06865f0
0x00007f3e278f5df0: 0000000000000001 00000006a06898c0
0x00007f3e278f5e00: 0000000000000006 00007f3f757d2530
0x00007f3e278f5e10: 00000006a06897a0 00000006a06898c0
0x00007f3e278f5e20: 00000006a0684c40 00007f3e00000009
0x00007f3e278f5e30: 00000007c036e2f8 0000000000000000
0x00007f3e278f5e40: 00007f3e278f5eb0 00007f3f75006706
0x00007f3e278f5e50: 00007f3f75006706 00000006a06898c0
0x00007f3e278f5e60: 00000006a06897a0 00000006a0684a90
0x00007f3e278f5e70: 00007f3e278f5e70 00000007c37ef8d1
0x00007f3e278f5e80: 00007f3e278f5f18 00000007c37f01d0
0x00007f3e278f5e90: 0000000000000000 00000007c37efa70
0x00007f3e278f5ea0: 00007f3e278f5e58 00007f3e278f5ef8
0x00007f3e278f5eb0: 00007f3e278f5f60 00007f3f750068e1
0x00007f3e278f5ec0: 0000000000000000 0000000000000000
0x00007f3e278f5ed0: 00000006a0689e00 0000000000000000
0x00007f3e278f5ee0: 00000006a0689da0 00000006a0685f50
0x00007f3e278f5ef0: 00000006a0685e70 00000006a0685e70
0x00007f3e278f5f00: 00000006a06898c0 00000006a06897a0
0x00007f3e278f5f10: 00000006a0689b90 00000006a0684c90
0x00007f3e278f5f20: 00007f3e278f5f20 00000007c37f28ef
0x00007f3e278f5f30: 00007f3e278f5fb0 00000007c37f3278

Instructions: (pc=0x00007f3f75a8c626)
0x00007f3f75a8c606: 10 27 00 00 45 3b c6 0f 8d 4b 27 00 00 41 8b d8
0x00007f3f75a8c616: ff c3 45 3b c6 0f 83 96 20 00 00 46 8b 54 87 10
0x00007f3f75a8c626: 47 8b 4c d4 08 41 81 f9 69 9b 6e f8 0f 85 21 30
0x00007f3f75a8c636: 00 00 48 be 48 db 74 c3 07 00 00 00 48 b8 a0 c1

Register to memory mapping:

RAX=0x00000007c386c1a0 is an oop
{instance class}
- klass: {other class}
RBX=0x0000000000000002 is an unknown value
RCX=0x0000000000000000 is an unknown value
RDX=0x0000000000000001 is an unknown value
RSP=0x00007f3e278f5d40 is pointing into the stack for thread: 0x00007f3e74013800
RBP=0x0000000000000000 is an unknown value
RSI=0x00000007c374db48 is an oop
{instance class}
- klass: {other class}
RDI=0x00000007c374db44 is pointing into object: 0x00000007c374db20
[[I
- klass: 'java/lang/Object'[]
- length: 5
R8 =0x0000000000000001 is an unknown value
R9 =0x0000000000000001 is an unknown value
R10=0x000000007d7380b0 is an unknown value
R11=0x0000000000000000 is an unknown value
R12=0x0000000000000000 is an unknown value
R13=
[error occurred during error reporting (printing register info), id 0xb]

Stack: [0x00007f3e277f8000,0x00007f3e278f9000], sp=0x00007f3e278f5d40, free space=1015k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
J org.apache.http.client.protocol.RequestAddCookies.process(Lorg/apache/http/HttpRequest;Lorg/apache/http/protocol/HttpContext;)V

[error occurred during error reporting (printing native stack), id 0xb]

YW5588 2018-08-07
  • 打赏
  • 举报
回复

50,596

社区成员

发帖
与我相关
我的任务
社区描述
Java相关技术讨论
javaspring bootspring cloud 技术论坛(原bbs)
社区管理员
  • Java相关社区
  • 小虚竹
  • 谙忆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧