Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

没有生产者的时候会导致内存泄漏。。 #74

Open
dosgo opened this issue Nov 6, 2023 · 5 comments
Open

没有生产者的时候会导致内存泄漏。。 #74

dosgo opened this issue Nov 6, 2023 · 5 comments

Comments

@dosgo
Copy link

dosgo commented Nov 6, 2023

比如报这个错误的时候
The topic 'test' has not produced on any nsqd in the cluster but are present in the lookup data. The program will be retried after 10 seconds .
内容肉眼可见增长。。。

@yunnian
Copy link
Owner

yunnian commented Nov 6, 2023

get,我抽空看下

比如报这个错误的时候 The topic 'test' has not produced on any nsqd in the cluster but are present in the lookup data. The program will be retried after 10 seconds . 内容肉眼可见增长。。。

@dosgo
Copy link
Author

dosgo commented Mar 12, 2024

还有个小问题,如果长期没有数据,消费会假死,只能手动杀进程。。。能修复或者增加个超时退出功能吗

@yunnian
Copy link
Owner

yunnian commented Mar 12, 2024

@dosgo 建议用supervisor部署 ,以下是参考文档:

nsqd 的 stopasgroup 和 killasgroup 设置为true 试下是否还有问题,配置文件参考


[program:nsqadmin]
command=/data/nsq/bin/nsqadmin --lookupd-http-address=127.0.0.1:4161 ; 被监控的进程路径
numprocs=1                    ; 启动几个进程
;directory=/data/nsq                ; 执行前要不要先cd到目录去,一般不用
autostart=true                ; 随着supervisord的启动而启动
autorestart=true              ; 自动重启。。当然要选上了
startretries=10               ; 启动失败时的最多重试次数
exitcodes=0                 ; 正常退出代码(是说退出代码是这个时就不再重启了吗?待确定)
stopsignal=KILL               ; 用来杀死进程的信号
stopwaitsecs=10               ; 发送SIGKILL前的等待时间
redirect_stderr=true          ; 重定向stderr到stdout
stdout_logfile=logfile        ; 指定日志文件
user=root
redirect_stderr=true          ; 重定向stderr到stdout
stdout_logfile=/data/nsq_log/nsqadmin.log        ; 指定日志文件

[program:nsqlookupd]
command=/data/nsq/bin/nsqlookupd ; 被监控的进程路径
numprocs=1                    ; 启动几个进程
;directory=/data/nsq                ; 执行前要不要先cd到目录去,一般不用
autostart=true                ; 随着supervisord的启动而启动
autorestart=true              ; 自动重启。。当然要选上了
startretries=10               ; 启动失败时的最多重试次数
exitcodes=0                 ; 正常退出代码(是说退出代码是这个时就不再重启了吗?待确定)
stopsignal=KILL               ; 用来杀死进程的信号
stopwaitsecs=10               ; 发送SIGKILL前的等待时间
redirect_stderr=true          ; 重定向stderr到stdout
stdout_logfile=logfile        ; 指定日志文件
user=root
redirect_stderr=true          ; 重定向stderr到stdout
stdout_logfile=/data/nsq_log/nsqlookupd.log        ; 指定日志文件

[program:nsqd]
command=/data/nsq/bin/nsqd --lookupd-tcp-address=127.0.0.1:4160 --data-path=/data/nsq_data ; 被监控的进程路径
numprocs=1                    ; 启动几个进程
;directory=/data/nsq                ; 执行前要不要先cd到目录去,一般不用
autostart=true                ; 随着supervisord的启动而启动
autorestart=true              ; 自动重启。。当然要选上了
startretries=10               ; 启动失败时的最多重试次数

exitcodes=0                 ; 正常退出代码(是说退出代码是这个时就不再重启了吗?待确定)
stopsignal=KILL               ; 用来杀死进程的信号
stopwaitsecs=10               ; 发送SIGKILL前的等待时间
redirect_stderr=true          ; 重定向stderr到stdout
stdout_logfile=logfile        ; 指定日志文件
user=root
redirect_stderr=true          ; 重定向stderr到stdout
stdout_logfile=/data/nsq_log/nsqd.log        ; 指定日志文件




[program:nsqadmin]

command=/opt/nsq/bin/nsqadmin --lookupd-http-address=127.0.0.1:4161 ;
numprocs=1                    ; 启动几个进程
;directory=/data/nsq                ; 执行前要不要先cd到目录去,一般不用
autostart=true                ; 随着supervisord的启动而启动
autorestart=true              ; 自动重启。。当然要选上了
startretries=10               ; 启动失败时的最多重试次数
exitcodes=0                 ; 正常退出代码(是说退出代码是这个时就不再重启了吗?待确定)
stopsignal=KILL               ; 用来杀死进程的信号
stopwaitsecs=10               ; 发送SIGKILL前的等待时间
redirect_stderr=true          ; 重定向stderr到stdout
stdout_logfile=logfile        ; 指定日志文件
user=root
redirect_stderr=true          ; 重定向stderr到stdout
stdout_logfile=/opt/nsq/log/nsqadmin.log        ; 指定日志文件

[program:nsqlookupd]
command=/opt/nsq/bin/nsqlookupd --broadcast-address=101.200.220.194;
numprocs=1                    ; 启动几个进程
;directory=/data/nsq                ; 执行前要不要先cd到目录去,一般不用
autostart=true                ; 随着supervisord的启动而启动
autorestart=true              ; 自动重启。。当然要选上了
startretries=10               ; 启动失败时的最多重试次数
exitcodes=0                 ; 正常退出代码(是说退出代码是这个时就不再重启了吗?待确定)
stopsignal=KILL               ; 用来杀死进程的信号
stopwaitsecs=10               ; 发送SIGKILL前的等待时间
redirect_stderr=true          ; 重定向stderr到stdout
stdout_logfile=logfile        ; 指定日志文件
user=root
redirect_stderr=true          ; 重定向stderr到stdout
stdout_logfile=/opt/nsq/log/nsqlookupd.log        ; 指定日志文件

[program:nsqd1]
command=/opt/nsq/bin/nsqd --broadcast-address=101.200.220.194 --max-heartbeat-interval=6m0s --msg-timeout=6m0s --lookupd-tcp-address=127.0.0.1:4160 --data-path=/opt/nsq/data1 --mem-queue-size=0
numprocs=1                    ; 启动几个进程
;directory=/opt/nsq                ; 执行前要不要先cd到目录去,一般不用
autostart=true                ; 随着supervisord的启动而启动
autorestart=true              ; 自动重启。。当然要选上了
startretries=10               ; 启动失败时的最多重试次数
exitcodes=0                 ; 正常退出代码(是说退出代码是这个时就不再重启了吗?待确定)
stopsignal=KILL               ; 用来杀死进程的信号
stopwaitsecs=10               ; 发送SIGKILL前的等待时间
stopasgroup=true ;默认为false,进程被杀死时,是否向这个进程组发送stop信号,包括子进程
killasgroup=true ;默认为false,向进程组发送kill信号,包括子进程
redirect_stderr=true          ; 重定向stderr到stdout
stdout_logfile=logfile        ; 指定日志文件
user=root
redirect_stderr=true          ; 重定向stderr到stdout
stdout_logfile=/opt/nsq/log/nsqd1.log        ; 指定日志文件

[program:nsqd2]
command=/opt/nsq/bin/nsqd --broadcast-address=101.200.220.194 --max-heartbeat-interval=6m0s --msg-timeout=6m0s --lookupd-tcp-address=127.0.0.1:4160 --tcp-address=101.200.220.194:4154 --http-address=101.200.220.194:4155 --data-path=/opt/nsq/data2 --mem-queue-size=0
numprocs=1                    ; 启动几个进程
;directory=/opt/nsq                ; 执行前要不要先cd到目录去,一般不用
autostart=true                ; 随着supervisord的启动而启动
autorestart=true              ; 自动重启。。当然要选上了
stopasgroup=true ;默认为false,进程被杀死时,是否向这个进程组发送stop信号,包括子进程
killasgroup=true ;默认为false,向进程组发送kill信号,包括子进程
startretries=10               ; 启动失败时的最多重试次数
exitcodes=0                 ; 正常退出代码(是说退出代码是这个时就不再重启了吗?待确定)
stopsignal=KILL               ; 用来杀死进程的信号
stopwaitsecs=10               ; 发送SIGKILL前的等待时间
redirect_stderr=true          ; 重定向stderr到stdout
stdout_logfile=logfile        ; 指定日志文件
user=root
redirect_stderr=true          ; 重定向stderr到stdout
stdout_logfile=/opt/nsq/log/nsqd2.log        ; 指定日志文件

@dosgo
Copy link
Author

dosgo commented Mar 13, 2024

进程还在就是消费不了。。。应该是连接问题,反正我内网有时候没人测试第二天就要手动重启,否则就不会消费

@dosgo
Copy link
Author

dosgo commented Mar 13, 2024

谢谢大佬了,我自己研究下找下解决方案

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants