MetaCubeX / mihomo

A simple Python Pydantic model for Honkai: Star Rail parsed data from the Mihomo API.
https://wiki.metacubex.one
MIT License
16.01k stars 2.6k forks source link

[Bug] 间歇性出现内核崩溃,提示"panic: connection already exists" #705

Closed dycwuxing closed 10 months ago

dycwuxing commented 1 year ago

Verify steps

Clash version

alpha-630a17c

What OS are you seeing the problem on?

Linux

Clash config

OpenClash 调试日志

生成时间: 2023-08-27 17:18:56
插件版本: v0.45.121-beta
隐私提示: 上传此日志前请注意检查、屏蔽公网IP、节点、密码等相关敏感信息

#===================== 系统信息 =====================#

主机型号: QEMU Standard PC (Q35 + ICH9, 2009)
固件版本: iStoreOS 21.02.3 2023040712
LuCI版本: git-22.258.47264-284140f
内核版本: 5.4.188
处理器架构: x86_64

#此项有值时,如不使用IPv6,建议到网络-接口-lan的设置中禁用IPV6的DHCP
IPV6-DHCP: server

DNS劫持: 停用
#DNS劫持为Dnsmasq时,此项结果应仅有配置文件的DNS监听地址
Dnsmasq转发设置: 

#===================== 依赖检查 =====================#

dnsmasq-full: 已安装
coreutils: 已安装
coreutils-nohup: 已安装
bash: 已安装
curl: 已安装
ca-certificates: 已安装
ipset: 已安装
ip-full: 已安装
libcap: 已安装
libcap-bin: 已安装
ruby: 已安装
ruby-yaml: 已安装
ruby-psych: 已安装
ruby-pstore: 已安装
kmod-tun(TUN模式): 已安装
luci-compat(Luci >= 19.07): 已安装
kmod-inet-diag(PROCESS-NAME): 已安装
unzip: 已安装
iptables-mod-tproxy: 已安装
kmod-ipt-tproxy: 已安装
iptables-mod-extra: 已安装
kmod-ipt-extra: 已安装
kmod-ipt-nat: 已安装

#===================== 内核检查 =====================#

运行状态: 运行中
运行内核:Meta
进程pid: 28218
运行权限: 28218: cap_dac_override,cap_net_bind_service,cap_net_admin,cap_net_raw,cap_sys_ptrace,cap_sys_resource=eip
运行用户: nobody
已选择的架构: linux-amd64

#下方无法显示内核版本号时请确认您的内核版本是否正确或者有无权限
Tun内核版本: 
Tun内核文件: 不存在
Tun内核运行权限: 否

Dev内核版本: 
Dev内核文件: 不存在
Dev内核运行权限: 否

Meta内核版本: alpha-630a17c
Meta内核文件: 存在
Meta内核运行权限: 正常

#===================== 插件设置 =====================#

当前配置文件: /etc/openclash/config/myclash.yaml
启动配置文件: /etc/openclash/myclash.yaml
运行模式: redir-host
默认代理模式: rule
UDP流量转发(tproxy): 启用
自定义DNS: 停用
IPV6代理: 启用
IPV6-DNS解析: 启用
禁用Dnsmasq缓存: 停用
自定义规则: 启用
仅允许内网: 启用
仅代理命中规则流量: 停用
仅允许常用端口流量: 停用
绕过中国大陆IP: 停用
路由本机代理: 启用

#启动异常时建议关闭此项后重试
混合节点: 停用
保留配置: 停用

#启动异常时建议关闭此项后重试
第三方规则: 停用
#===================== 配置文件 =====================#

redir-port: 7892
tproxy-port: 7895
port: 7890
socks-port: 7891
mixed-port: 7893
mode: rule
log-level: silent
allow-lan: true
external-controller: 0.0.0.0:9090
bind-address: "*"
ipv6: true
geodata-mode: true
geodata-loader: memconservative
geox-url:
  geosite: https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geosite.dat
  geoip: https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geoip.dat
  mmdb: https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/Country.mmdb
unified-delay: true
tcp-concurrent: true
profile:
  store-selected: true
  store-fake-ip: true
find-process-mode: always
dns:
  enable: true
  ipv6: true
  ipv6-timeout: 300
  enhanced-mode: redir-host
  use-hosts: true
  listen: 0.0.0.0:7874
  max-ttl: 10
  default-nameserver:
  - tls://94.140.14.14:853
  - tls://223.5.5.5:853
  nameserver:
  - https://1.1.1.1/dns-query
  - https://dns.twnic.tw/dns-query
  - https://doh.dns.sb/dns-query
  - https://dns.quad9.net/dns-query
  fallback:
  - https://1.1.1.1/dns-query
  - https://dns.twnic.tw/dns-query
  - https://doh.dns.sb/dns-query
  - https://dns.quad9.net/dns-query
  fallback-filter:
    geoip: true
    geoip-code: CN
    geosite:
    - geolocation-!cn
    ipcidr:
    - 240.0.0.0/4
    - 0.0.0.0/32
    domain:
    - "+.github.com"
    - "+.githubusercontent.com"
  proxy-server-nameserver:
  - https://doh.pub/dns-query
  - https://dns.alidns.com/dns-query
  nameserver-policy:
    rule-set:DIY_China:
    - https://doh.pub/dns-query
    - https://dns.alidns.com/dns-query
    rule-set:DIY_office:
    - https://doh.pub/dns-query
    - https://dns.alidns.com/dns-query
    rule-set:DIY_speedtest:
    - 223.5.5.5
    - 114.114.114.114
    - https://1.1.1.1/dns-query
    - https://dns.twnic.tw/dns-query
    - https://doh.dns.sb/dns-query
    - https://dns.quad9.net/dns-query
    rule-set:AppStore:
    - https://doh.pub/dns-query
    - https://dns.alidns.com/dns-query
    rule-set:AppleTV:
    - https://doh.pub/dns-query
    - https://dns.alidns.com/dns-query
    rule-set:Apple_Classical:
    - https://doh.pub/dns-query
    - https://dns.alidns.com/dns-query
    rule-set:BiliBili:
    - https://doh.pub/dns-query
    - https://dns.alidns.com/dns-query
    rule-set:Download:
    - https://doh.pub/dns-query
    - https://dns.alidns.com/dns-query
    rule-set:Himalaya:
    - https://doh.pub/dns-query
    - https://dns.alidns.com/dns-query
    rule-set:JianShu:
    - https://doh.pub/dns-query
    - https://dns.alidns.com/dns-query
    rule-set:NetEaseMusic:
    - https://doh.pub/dns-query
    - https://dns.alidns.com/dns-query
    rule-set:PrivateTracker:
    - https://doh.pub/dns-query
    - https://dns.alidns.com/dns-query
    rule-set:PayPal:
    - https://doh.pub/dns-query
    - https://dns.alidns.com/dns-query
    rule-set:SteamCN:
    - https://doh.pub/dns-query
    - https://dns.alidns.com/dns-query
    rule-set:SyncnextDirect:
    - https://doh.pub/dns-query
    - https://dns.alidns.com/dns-query
    rule-set:WeChat:
    - https://doh.pub/dns-query
    - https://dns.alidns.com/dns-query
    rule-set:XiaoMi:
    - https://doh.pub/dns-query
    - https://dns.alidns.com/dns-query
    rule-set:Zhihu:
    - https://doh.pub/dns-query
    - https://dns.alidns.com/dns-query
    rule-set:ChinaMax_Classical:
    - https://doh.pub/dns-query
    - https://dns.alidns.com/dns-query
    rule-set:ChinaIpV6:
    - https://doh.pub/dns-query
    - https://dns.alidns.com/dns-query
    GEOIP:CN:
    - https://doh.pub/dns-query
    - https://dns.alidns.com/dns-query
sniffer:
  enable: true
  force-dns-mapping: true
  parse-pure-ip: true
  force-domain:
  - "+"
  skip-domain:
  - Mijia Cloud
  - "+.io.mi.com"
  - "+.mina.mi.com"
  - "+.xiaomi.com"
  - "+.wechat.com"
  - "+.weixin.com"
  - "+.weixin.qq.com"
  - "+.wxapp.tc.qq.com"
  - "+.jd.com"
  - "+.jingxi.com"
  - "+.aliyundrive.net"
  - "+.pstatp.com"
  - "+.bilibili.com"
  sniff:
    TLS:
    HTTP:
      ports:
      - 80
      - 8080-8880
      override-destination: true

Clash log

2023-08-27 12:54:33 守护程序:检测到 Clash 内核崩溃,重启中...
    github.com/Dreamacro/clash/common/batch/batch.go:43 +0xc8
created by github.com/Dreamacro/clash/common/batch.(*Batch[...]).Go in goroutine 4454433
    github.com/Dreamacro/clash/common/batch/batch.go:52 +0x112
github.com/Dreamacro/clash/common/batch.(*Batch[...]).Go.func1()
    github.com/Dreamacro/clash/adapter/provider/healthcheck.go:210 +0x1ee
github.com/Dreamacro/clash/adapter/provider.(*HealthCheck).execute.func1()
    github.com/Dreamacro/clash/adapter/adapter.go:248 +0x2e5
github.com/Dreamacro/clash/adapter.(*Proxy).URLTest(0xc002875600, {0x15e0940?, 0xc0063a19d0}, {0xc000044ee8, 0x14}, {0x0?, 0x0, 0x11c8ac0?}, 0x0)
    github.com/Dreamacro/clash/adapter/adapter.go:67
github.com/Dreamacro/clash/adapter.(*Proxy).DialContext(...)
    github.com/Dreamacro/clash/adapter/outbound/hysteria.go:56 +0x1b2
github.com/Dreamacro/clash/adapter/outbound.(*Hysteria).DialContext(0xc00248d968, {0x15e0940?, 0xc0063a19d0}, 0x0?, {0x0, 0x0, 0x0})
    github.com/Dreamacro/clash/transport/hysteria/core/client.go:202 +0x7a
github.com/Dreamacro/clash/transport/hysteria/core.(*Client).DialTCP(0xc0064a4e00, {0xc003ec4640?, 0xc000329d40?}, {0x15dcb50, 0xc002346200})
    github.com/Dreamacro/clash/transport/hysteria/core/client.go:172 +0xf8
github.com/Dreamacro/clash/transport/hysteria/core.(*Client).openStreamWithReconnect(0xc0064a4e00, {0x15dcb50, 0xc002346200})
    github.com/Dreamacro/clash/transport/hysteria/core/client.go:78 +0x9a
github.com/Dreamacro/clash/transport/hysteria/core.(*Client).connectToServer(0xc0064a4e00, {0x15dcb50?, 0xc002346200?})
    github.com/Dreamacro/clash/transport/hysteria/transport/client.go:82 +0x205
github.com/Dreamacro/clash/transport/hysteria/transport.(*ClientTransport).QUICDial(0x0?, {0xc0081582d0, 0x3}, {0xc00818d040?, 0xffff?}, {0xc008158280, 0xb}, 0xc006708730?, 0x410405?, {0x15d59b8, ...}, ...)
    github.com/metacubex/quic-go@v0.38.1-0.20230821081539-517fdb17fb28/transport.go:154
github.com/metacubex/quic-go.(*Transport).Dial(...)
    github.com/metacubex/quic-go@v0.38.1-0.20230821081539-517fdb17fb28/transport.go:167 +0x95
github.com/metacubex/quic-go.(*Transport).dial(0xc000366ff0, {0x15e07e8, 0x2537fc0}, {0x15d5828, 0xc007273680}, {0x15d5828?, 0xc007273680?}, 0xc008158280?, 0xb?, 0x0)
    github.com/metacubex/quic-go@v0.38.1-0.20230821081539-517fdb17fb28/transport.go:189 +0x4d
github.com/metacubex/quic-go.(*Transport).init(0xc000366ff0, 0x5?)
    sync/once.go:65
sync.(*Once).Do(...)
    sync/once.go:74 +0xbf
sync.(*Once).doSlow(0xc007bb6360?, 0xc0099e1440?)
    github.com/metacubex/quic-go@v0.38.1-0.20230821081539-517fdb17fb28/transport.go:222 +0x332
github.com/metacubex/quic-go.(*Transport).init.func1()
    github.com/metacubex/quic-go@v0.38.1-0.20230821081539-517fdb17fb28/multiplexer.go:59 +0x165
github.com/metacubex/quic-go.(*connMultiplexer).AddConn(0xc0012bf6c0, {0x7f9b6f694490?, 0xc000f05930?})
goroutine 4454399 [running]:
panic: connection already exists
2023-08-27 04:00:09 OpenClash 启动成功,请等待服务器上线!
2023-08-27 04:00:09 第九步: 添加计划任务,启动进程守护程序...
2023-08-27 04:00:09 第八步: 重启 Dnsmasq 程序...
2023-08-27 04:00:09 提示:开始添加自定义防火墙规则...
2023-08-27 04:00:08 提示:正在根据防火墙端口转发和防火墙通信规则添加端口绕过规则...
2023-08-27 04:00:07 提示:IPv6 代理模式为 TProxy...
2023-08-27 04:00:07 提示:DNS 劫持未开启...
2023-08-27 04:00:07 第七步: 设置防火墙规则...
2023-08-27 04:00:07 第六步: 等待主程序下载外部文件...
...

Description

间歇性出现内核崩溃,提示"panic: connection already exists" clash检测到内核崩溃自动重启后,可正常运行,到17:00未再次出现,目前可正常使用

dycwuxing commented 1 year ago
image
dycwuxing commented 1 year ago

更新内核到"alpha-d6b80ac" 问题依旧,这次观察了下:早上重启后内存150MB左右,到中午看的时候内存到500MB左右,后来再看就崩了,应该是内存泄露了?

2023-09-03 16:41:06 守护程序:检测到 Clash 内核崩溃,重启中... github.com/Dreamacro/clash/common/batch/batch.go:43 +0xc8 created by github.com/Dreamacro/clash/common/batch.(Batch[...]).Go in goroutine 8399117 github.com/Dreamacro/clash/common/batch/batch.go:52 +0x112 github.com/Dreamacro/clash/common/batch.(Batch[...]).Go.func1() github.com/Dreamacro/clash/adapter/provider/healthcheck.go:210 +0x1ee github.com/Dreamacro/clash/adapter/provider.(HealthCheck).execute.func1() github.com/Dreamacro/clash/adapter/adapter.go:248 +0x2e5 github.com/Dreamacro/clash/adapter.(Proxy).URLTest(0xc00de36580, {0x16003a0?, 0xc000023960}, {0xc0000f6f00, 0x14}, {0x0?, 0x0, 0x2?}, 0x0) github.com/Dreamacro/clash/adapter/adapter.go:67 github.com/Dreamacro/clash/adapter.(Proxy).DialContext(...) github.com/Dreamacro/clash/adapter/outbound/hysteria.go:56 +0x1b2 github.com/Dreamacro/clash/adapter/outbound.(Hysteria).DialContext(0xc00761d080, {0x16003a0?, 0xc000023960}, 0x0?, {0x0, 0x0, 0x0}) github.com/Dreamacro/clash/transport/hysteria/core/client.go:202 +0x7a github.com/Dreamacro/clash/transport/hysteria/core.(Client).DialTCP(0xc00d5ad200, {0xc0053109b0?, 0xc00476d320?}, {0x15fc390, 0xc008a1aca0}) github.com/Dreamacro/clash/transport/hysteria/core/client.go:172 +0xf8 github.com/Dreamacro/clash/transport/hysteria/core.(Client).openStreamWithReconnect(0xc00d5ad200, {0x15fc390, 0xc008a1aca0}) github.com/Dreamacro/clash/transport/hysteria/core/client.go:78 +0x9a github.com/Dreamacro/clash/transport/hysteria/core.(Client).connectToServer(0xc00d5ad200, {0x15fc390?, 0xc008a1aca0?}) github.com/Dreamacro/clash/transport/hysteria/transport/client.go:82 +0x205 github.com/Dreamacro/clash/transport/hysteria/transport.(ClientTransport).QUICDial(0x7e0570?, {0xc003c7d680, 0x3}, {0xc0109abec0?, 0xffff?}, {0xc003c7d630, 0xb}, 0xc000c37730?, 0x410405?, {0x15f51e0, ...}, ...) github.com/metacubex/quic-go@v0.38.1-0.20230821081539-517fdb17fb28/transport.go:154 github.com/metacubex/quic-go.(Transport).Dial(...) github.com/metacubex/quic-go@v0.38.1-0.20230821081539-517fdb17fb28/transport.go:167 +0x95 github.com/metacubex/quic-go.(Transport).dial(0xc0048bcd20, {0x1600248, 0x2573260}, {0x15f5028, 0xc0111358f0}, {0x15f5028?, 0xc0111358f0?}, 0xc003c7d630?, 0xb?, 0x0) github.com/metacubex/quic-go@v0.38.1-0.20230821081539-517fdb17fb28/transport.go:189 +0x4d github.com/metacubex/quic-go.(Transport).init(0xc0048bcd20, 0x5?) sync/once.go:65 sync.(Once).Do(...) sync/once.go:74 +0xbf sync.(Once).doSlow(0xc00352e5a0?, 0xc01113a6c0?) github.com/metacubex/quic-go@v0.38.1-0.20230821081539-517fdb17fb28/transport.go:222 +0x332 github.com/metacubex/quic-go.(Transport).init.func1() github.com/metacubex/quic-go@v0.38.1-0.20230821081539-517fdb17fb28/multiplexer.go:59 +0x165 github.com/metacubex/quic-go.(*connMultiplexer).AddConn(0xc0000493a0, {0x7f280c25d8b8?, 0xc006272000?}) goroutine 8399177 [running]: panic: connection already exists 2023-09-03 04:00:09 OpenClash 启动成功,请等待服务器上线! 2023-09-03 04:00:09 第九步: 添加计划任务,启动进程守护程序... 2023-09-03 04:00:08 第八步: 重启 Dnsmasq 程序... 2023-09-03 04:00:08 提示:开始添加自定义防火墙规则... 2023-09-03 04:00:08 提示:正在根据防火墙端口转发和防火墙通信规则添加端口绕过规则... 2023-09-03 04:00:07 提示:IPv6 代理模式为 TProxy... 2023-09-03 04:00:07 提示:DNS 劫持未开启... 2023-09-03 04:00:07 第七步: 设置防火墙规则... 2023-09-03 04:00:07 第六步: 等待主程序下载外部文件... 2023-09-03 04:00:04 第五步: 检查内核启动状态... 2023-09-03 04:00:03 提示:检测到配置了 Meta 内核专属功能,调用 Meta 内核启动... 2023-09-03 04:00:03 第四步: 启动主程序... 2023-09-03 04:00:03 提示:开始运行自定义覆写脚本... 2023-09-03 04:00:02 第三步: 修改配置文件... 2023-09-03 04:00:02 提示:由于文件【 /etc/openclash/config/myclash.yaml 】被修改,暂停快速启动... 2023-09-03 04:00:02 第二步: 组件运行前检查... 2023-09-03 04:00:02 第一步: 获取配置... 2023-09-03 04:00:02 OpenClash 开始启动... 2023-09-03 04:00:02 第六步:删除 OpenClash 残留文件... 2023-09-03 04:00:01 第五步: 重启 Dnsmasq 程序... 2023-09-03 04:00:01 第四步: 关闭 Clash 主程序... 2023-09-03 04:00:01 第三步: 关闭 OpenClash 守护程序... 2023-09-03 04:00:00 第二步: 删除 OpenClash 防火墙规则... 2023-09-03 04:00:00 第一步: 备份当前策略组状态... 2023-09-03 04:00:00 OpenClash 开始关闭... 2023-09-03 04:00:00 OpenClash 重新启动中... 2023-09-03 01:59:50 OpenClash 启动成功,请等待服务器上线! 2023-09-03 01:59:50 第九步: 添加计划任务,启动进程守护程序... 2023-09-03 01:59:49 第八步: 重启 Dnsmasq 程序... 2023-09-03 01:59:49 提示:开始添加自定义防火墙规则... 2023-09-03 01:59:49 提示:正在根据防火墙端口转发和防火墙通信规则添加端口绕过规则... 2023-09-03 01:59:48 提示:IPv6 代理模式为 TProxy... 2023-09-03 01:59:48 提示:DNS 劫持未开启... 2023-09-03 01:59:48 第七步: 设置防火墙规则... 2023-09-03 01:59:48 第六步: 等待主程序下载外部文件... ...

dycwuxing commented 1 year ago

heap.zip

dycwuxing commented 1 year ago

更新alpha-7286391和上一个版本后内存还是会不停的涨,但是提示有变化 提示"protocol error: received DATA before a HEADERS frame" image

dycwuxing commented 1 year ago

heap.zip传过了,大佬们啥时候能给看看啊?现在最新内核"21fb5f7.gz",不到4个小时,就会爆内存崩一次

Skyxim commented 1 year ago

@dycwuxing alpha 已经更新过多次 quic-go 可以尝试最新版本是否存在崩溃

snakem982 commented 10 months ago

这个是因为quic基础包 中的一个文件会panic https://github.com/quic-go/quic-go/blob/master/multiplexer.go 具体代码如下

func (m *connMultiplexer) AddConn(c indexableConn) {
    m.mutex.Lock()
    defer m.mutex.Unlock()

    connIndex := m.index(c.LocalAddr())
    p, ok := m.conns[connIndex]
    if ok {
        // Panics if we're already listening on this connection.
        // This is a safeguard because we're introducing a breaking API change, see
        // https://github.com/quic-go/quic-go/issues/3727 for details.
        // We'll remove this at a later time, when most users of the library have made the switch.
        panic("connection already exists") // TODO: write a nice message
    }
    m.conns[connIndex] = p
}

有能力就自己编译下,删除panic就好了

dycwuxing commented 10 months ago

我没有这个能力:(