Giter Club home page Giter Club logo

Comments (6)

xen0n avatar xen0n commented on September 2, 2024 2

详细描述问题的 po 主事鉴

from maimaidx-prober.

xen0n avatar xen0n commented on September 2, 2024 1

正常的话应该不放过任何一个可能的 err 返回,然后尽量在最上层集中处理错误(因为这个简单场景其实不需要专门关心、单独处理每一条路径可能的每一种错误),基本就是接住之后触发重试即可。如果担心 panic 那么也总是可以套一层 goroutine 然后 defer 块里 recover() 检查并同样触发重试。

也就是写 Go 可以方便地静默无视错误了。比方说 Rust 的错误处理你要么写 ?(这意味着你会把 Err 抛到上一层)要么 unwrap()(这会十分扎眼,并且很明显每处这种地方,万一确实错误了进程就会崩溃)。总之要说国服 maimai NET 是错误处理的试金石也没什么问题

from maimaidx-prober.

Diving-Fish avatar Diving-Fish commented on September 2, 2024 1

学到虚脱

from maimaidx-prober.

Kuro96 avatar Kuro96 commented on September 2, 2024

通过git bash运行得到相关报错信息:

$ ./maimaidx-prober-proxy-windows-amd64-1.3.0.exe
2023/07/03 14:53:53 INFO: 您使用的是最新版本。
2023/07/03 14:53:53 INFO: 登录成功
2023/07/03 14:53:53 INFO: 使用此软件则表示您同意共享您在微信公众号舞萌 DX、中二节奏中的数据。
2023/07/03 14:53:53 INFO: 您可以在微信客户端访问微信公众号舞萌 DX、中二节奏的个人信息主页进行分数导入,如需退出请直接关闭程序或按下 Ctrl + C
2023/07/03 14:53:53 INFO: 代理设置已自动修改。
2023/07/03 14:53:53 INFO: 代理已开启到 127.0.0.1:8033
2023/07/03 14:53:58 INFO: 正在导入 Basic 难度……
2023/07/03 14:54:00 INFO: 导入成功
2023/07/03 14:54:00 INFO: 正在导入 Advanced 难度……
2023/07/03 14:54:03 INFO: 导入成功
2023/07/03 14:54:03 INFO: 正在导入 Expert 难度……
2023/07/03 14:54:16 [007] WARN: Error copying to client: readfrom tcp 10.32.19.234:6787->202.89.233.100:443: read tcp 127.0.0.1:8033->127.0.0.1:6786: wsarecv: An existing connection was forcibly closed by the remote host.
2023/07/03 14:54:16 [007] WARN: Error copying to client: readfrom tcp 127.0.0.1:8033->127.0.0.1:6786: write tcp 127.0.0.1:8033->127.0.0.1:6786: wsasend: An existing connection was forcibly closed by the remote host.
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x40 pc=0xe003e6]

goroutine 32 [running]:
main.(*proberAPIClient).commit(0xc000086180, {0xc00066c000, 0xf47ae, 0x110000})
        github.com/Diving-Fish/maimaidx-prober/proxy/cmd/maimaidx-prober-proxy/prober_api.go:54 +0xc6
main.(*proberAPIClient).fetchDataMaimai(0xc000086180, 0xc00025c500, {0xc00000a008, 0x1, 0x1})
        github.com/Diving-Fish/maimaidx-prober/proxy/cmd/maimaidx-prober-proxy/prober_api.go:98 +0x679
created by main.(*proxyContext).handleResponse
        github.com/Diving-Fish/maimaidx-prober/proxy/cmd/maimaidx-prober-proxy/proxy.go:51 +0x5ef

from maimaidx-prober.

Diving-Fish avatar Diving-Fish commented on September 2, 2024

看来还是要整理下代码把错误处理弄一起……有点一坨了

from maimaidx-prober.

Janet-Baker avatar Janet-Baker commented on September 2, 2024

panic位置:

respText, timeoutErr = io.ReadAll(resp.Body)

前面其实已经出问题了:

req, _ := http.NewRequest(http.MethodGet, "https://maimai.wahlap.com/maimai-mobile/record/musicGenre/search/?genre=99&diff="+strconv.Itoa(i), nil)
var err error
net/http: TLS handshake timeout

然而,错误判断却写在了它后面:

if err == nil && resp != nil && timeoutErr == nil {
break
}


当然,由于华立服务器很不稳定,每一次错误的位置和种类也不一定一样……
都来体验一下土豆服务器的快乐吧

from maimaidx-prober.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.