Node-redis: 2小时后ECONNRESET

创建于 2015-06-11  ·  4评论  ·  资料来源: NodeRedis/node-redis

当前在Ubuntu 12.04容器中的Docker中运行应用程序。 运行docker 1.5和node-redis 0.12.1。 每次2小时后,redis连接都会收到以下错误。
错误:Redis与web-redis01.twec的连接。 com:6379失败-读取ECONNRESET

````
在RedisClient.on_error(/home/node/tjs0006/node_modules/redis/index.js:196:24)

在套接字。(/home/node/tjs0006/node_modules/redis/index.js:106:14)

在Socket.emit(events.js:95:17)

在net.js:441:14

在process._tickCallback(node.js:448:13)```
````

日志来了...

question

所有4条评论

Stream connected web-redis01.twec.com:6379 id 1
Using default parser module: javascript
checking server ready state...
send web-redis01.twec.com:6379 id 1: *1
$4
info

send_command buffered_writes: 0  should_buffer: false
net read web-redis01.twec.com:6379 id 1: $1993
# Server
redis_version:2.8.19
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:a789ed9377dc12b9
redis_mode:standalone
os:Linux 3.13.0-45-generic x86_64
arch_bits:64
multiplexing_api:epoll
gcc_version:4.6.3
process_id:1478
run_id:6edf95e3c651843f8c26ea0e1030717d82419fcd
tcp_port:6379
uptime_in_seconds:9604215
uptime_in_days:111
hz:10
lru_clock:7985573
config_file:/etc/redis/redis.conf

# Clients
connected_clients:521
client_longest_output_list:0
client_biggest_input_buf:817
blocked_clients:108

# Memory
used_memory:668850272
used_memory_human:637.87M
used_memory_rss:715665408
used_memory_peak:4418948960
used_memory_peak_human:4.12G
used_memory_lua:35840
mem_fragmentation_ratio:1.07
mem_allocator:jemalloc-3.6.0

# Persistence
loading:0
rdb_changes_since_last_save:232
rdb_bgsave_in_progress:0
rdb_last_save_time:1434048755
rdb_last_bgsave_status:ok
rdb_last_bgsave_time_sec:8
rdb_current_bgsave_time_sec:-1
aof_enabled:0
aof_rewrite_in_progress:0
aof_rewrite_scheduled:0
aof_last_rewrite_time_sec:-1
aof_current_rewrite_time_sec:-1
aof_last_bgrewrite_status:ok
aof_last_write_status:ok

# Stats
total_connections_received:14731602
total_commands_processed:1397335226
instantaneous_ops_per_sec:60
total_net_input_bytes:111442619264
total_net_output_bytes:166924266821
instantaneous_input_kbps:4.35
instantaneous_output_kbps:0.61
rejected_connections:0
sync_full:0
sync_partial_ok:0
sync_partial_err:0
expired_keys:1320224
evicted_keys:0
keyspace_hits:325125706
keyspace_misses:358675060
pubsub_channels:1
pubsub_patterns:0
latest_fork_usec:61950

# Replication
role:master
connected_slaves:0
master_repl_offset:0
repl_backlog_active:0
repl_backlog_size:1048576
repl_backlog_first_byte_offset:0
repl_backlog_histlen:0

# CPU
used_cpu_sys:45186.85
used_cpu_user:22707.47
used_cpu_sys_children:25963.62
used_cpu_user_children:203823.30

# Keyspace
db0:keys=88916,expires=2405,avg_ttl=29636490


Redis server ready.
send web-redis01.twec.com:6379 id 1: *3
$4
sadd
$25
tjs0006-dev:todaysBatches
$18
batch_514C6E711866

send_command buffered_writes: 0  should_buffer: false
send web-redis01.twec.com:6379 id 1: *3
$3
set
$19
tjs0006-dev:lastRun
$24
2015-06-11T19:02:11.190Z

send_command buffered_writes: 0  should_buffer: false
net read web-redis01.twec.com:6379 id 1: :1

net read web-redis01.twec.com:6379 id 1: +OK

send web-redis01.twec.com:6379 id 1: *3
$5
lpush
$36
tjs0006-dev:batch_514C6E711866:error
$180
{"message":"Non-successful status code (500) returned","location":"RENEW QUEUE:Get Customer","batchId":"batch_514C6E711866","businessDate":"","file":"","cardNumber":"466708132564"}

send_command buffered_writes: 0  should_buffer: false
net read web-redis01.twec.com:6379 id 1: :1

send web-redis01.twec.com:6379 id 1: *4
$6
lrange
$36
tjs0006-dev:batch_514C6E711866:error
$1
0
$2
-1

send_command buffered_writes: 0  should_buffer: false
net read web-redis01.twec.com:6379 id 1: *1
$180
{"message":"Non-successful status code (500) returned","location":"RENEW QUEUE:Get Customer","batchId":"batch_514C6E711866","businessDate":"","file":"","cardNumber":"466708132564"}

send web-redis01.twec.com:6379 id 1: *4
$6
lrange
$38
tjs0006-dev:batch_514C6E711866:warning
$1
0
$2
-1

send_command buffered_writes: 0  should_buffer: false
net read web-redis01.twec.com:6379 id 1: *0

Redis connection to web-redis01.twec.com:6379 failed - read ECONNRESET
Error: Redis connection to web-redis01.twec.com:6379 failed - read ECONNRESET
    at RedisClient.on_error (/home/node/tjs0006/node_modules/redis/index.js:196:24)
    at Socket.<anonymous> (/home/node/tjs0006/node_modules/redis/index.js:106:14)
    at Socket.emit (events.js:95:17)
    at net.js:441:14
    at process._tickCallback (node.js:448:13)
Error: Redis connection to web-redis01.twec.com:6379 failed - read ECONNRESET
    at RedisClient.on_error (/home/node/tjs0006/node_modules/redis/index.js:196:24)
    at Socket.<anonymous> (/home/node/tjs0006/node_modules/redis/index.js:106:14)
    at Socket.emit (events.js:95:17)
    at net.js:441:14
    at process._tickCallback (node.js:448:13)
error: Forever detected script exited with code: 1
error: Script restart attempt #1

我已经测试了其他库并收到了相同的问题。 似乎它不是特定于node-redis的。

@strumwolf :我有完全一样的问题。 你解决了吗?

我也在docker(和rancher)中使用它,这是我的容器的日志:

2016年2月11日17:15:11重新连接正常
2016/02/11 17:15:11客户订阅“测试”
2016年2月11日19:15:32REDIS错误{[错误:Redis与xxx.euw1.cache.amazonaws的连接。 com:6379失败-读取ECONNRESET]代码:“ ECONNRESET”,错误号:“ ECONNRESET”,系统调用:“读取”}
2016年2月11日19:15:32重新连接重新
2016/02/11 19:15:32Redis连接正常
2016/02/11 19:15:32客户订阅“测试”
2016年2月11日21:15:41REDIS错误{[错误:Redis与xxx.euw1.cache.amazonaws的连接。 com:6379失败-读取ECONNRESET]代码:“ ECONNRESET”,错误号:“ ECONNRESET”,系统调用:“读取”}
2016年2月11日21:15:41重新连接
2016年2月11日21:15:41重新连接正常
2016/02/11 21:15:41客户订阅“测试”
2016年2月11日23:15:50REDIS错误{[错误:Redis与xxx.euw1.cache.amazonaws的连接。 com:6379失败-读取ECONNRESET]代码:“ ECONNRESET”,错误:“ ECONNRESET”,系统调用:“读取”}
2016年2月11日23:15:50重新连接
2016年2月11日23:15:50重新连接好

如您所说,每2个小时会有一个ECONNRESET。 重新连接似乎有效,订阅也是如此。 如果我在重新连接后立即推送新消息,则订阅者会收到它。

但是,如果我等待某个时间(处理下一次重新连接),则订阅者将不再处理我推送的消息。 似乎是另一个地方的超时时间...

感谢您的帮助。

@cabrinoob ,我解决了这个问题,但是很久以前我不记得解决方案了。 另外,我不再为他所发行的公司工作,因此无法回头再查。 抱歉。

此页面是否有帮助?
0 / 5 - 0 等级