gaowanliang / gaowanliang/DownloadBot

从源码自行编译的版本在tg中点击按钮报错

Open
#56 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Go
Stars
800
Forks
200
PR merge metrics
No merged PRs in 30d

Description

运行起来之后在tg中点击“正在下载”按钮,无反应
![image](https://user-images.githubusercontent.com/79561519/155080621-1b4f1a39-c8e4-4374-894e-e92938b70698.png)

回到终端中查看发现以下报错:
```
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x38 pc=0x9124d6]

goroutine 49 [running]:
main.GetDiskPercent(0x4040d90b2164c3c0)
/root/DownloadBot/utils.go:590 +0x56
main.formatTellSomething(0xc001306000, 0xfa, 0x13c, 0x0, 0x0, 0xfa, 0x13c)
/root/DownloadBot/Aria2.go:186 +0x13e5
main.activeRefresh.func1(0x0, 0x6018aa59, 0xc00035b4a0, 0xc000076fa0, 0xc0000b69a0)
/root/DownloadBot/Telegram.go:673 +0x94
main.activeRefresh(0x4, 0xc00035b4a0, 0xc000076fa0, 0x3e4b)
/root/DownloadBot/Telegram.go:728 +0x14d
created by main.tgBot
/root/DownloadBot/Telegram.go:899 +0x32ca
```
![image](https://user-images.githubusercontent.com/79561519/155079825-4510f9f2-456c-47b2-8c4c-f8a7194cb3db.png)

点击“正在等待”按钮和“已完成”按钮也没反应
![image](https://user-images.githubusercontent.com/79561519/155247265-d33b6cb4-17e9-410f-918f-561aa973c372.png)
点击“正在等待”按钮时的报错:
```
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x38 pc=0x9124d6]

goroutine 30 [running]:
main.GetDiskPercent(0x4059000000000000)
/root/DownloadBot/utils.go:590 +0x56
main.formatTellSomething(0xc0000c3000, 0xa, 0xd, 0x0, 0x0, 0x0, 0xc0000c3000)
/root/DownloadBot/Aria2.go:186 +0x13e5
main.tgBot(0xc00002a300, 0x2e, 0xc0000294a0)
/root/DownloadBot/Telegram.go:901 +0x312a
created by main.main
/root/DownloadBot/main.go:34 +0x9f
```
点击“已完成”按钮时的报错:
```
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x38 pc=0x9124d6]

goroutine 30 [running]:
main.GetDiskPercent(0x4059000000000000)
/root/DownloadBot/utils.go:590 +0x56
main.formatTellSomething(0xc0000c3000, 0xa, 0xd, 0x0, 0x0, 0x0, 0xc0000c3000)
/root/DownloadBot/Aria2.go:186 +0x13e5
main.tgBot(0xc00002a300, 0x2e, 0xc000029490)
/root/DownloadBot/Telegram.go:908 +0x2ffd
created by main.main
/root/DownloadBot/main.go:34 +0x9f
```
![image](https://user-images.githubusercontent.com/79561519/155247748-792a3b12-156c-4949-8c9a-e3198cd84b95.png)

使用release中的版本点击“正在下载”也会报错:
```
2022/02/23 09:25:02 context deadline exceeded
panic: context deadline exceeded

goroutine 48 [running]:
log.Panic(0xc00012cdd8, 0x1, 0x1)
D:/program_app/go/src/log/log.go:351 +0xac
main.dropErr(...)
D:/program_data/go/DownloadBot/main.go:14
main.formatTellSomething(0x0, 0x0, 0x0, 0xbc6a40, 0x102fee0, 0x0, 0x0)
D:/program_data/go/DownloadBot/Aria2.go:77 +0x8b
main.activeRefresh.func1(0x0, 0x6018aa59, 0xc00048a640, 0xc000066460, 0x0)
D:/program_data/go/DownloadBot/Telegram.go:541 +0x94
main.activeRefresh(0x18, 0xc00048a640, 0xc000066460, 0xd857)
D:/program_data/go/DownloadBot/Telegram.go:596 +0x159
created by main.tgBot
D:/program_data/go/DownloadBot/Telegram.go:767 +0x3207
```
![image](https://user-images.githubusercontent.com/79561519/155247823-aa406df7-f97b-4115-b25c-272c8f56c977.png)

但是点击“等待中”和“已停止”按钮都不会报错,不知道什么原因,源码我是自己git clone源码之后编译的版本,系统是centos7.9,另外能否增加忽略证书错误的功能,我aria2为了适应启用了https的ariang,开启了https,然后在机器人的配置文件中使用“`wss://127.0.0.1:6800/jsonrpc`"连接会报错”`cannot validate certificate for 127.0.0.1 because it doesn't contain any IP SANs`“
![image](https://user-images.githubusercontent.com/79561519/155080446-37be251c-ab9e-4528-a6df-852de79f9c52.png)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.