swanchain / go-computing-provider

A golang implementation of computing provider
MIT License
11 stars 15 forks source link

Unable to POST the final job completion result #59

Closed aa66609 closed 2 months ago

aa66609 commented 2 months ago

image level=error msg="Failed send a request, error: Post "http://172.23.23.XX:9085/api/v1/computing/cp/docker/receive/ubi": context deadline exceeded (Client.Timeout exceeded while awaiting headers)" func=func4 file="main.go:633"

WARN ubi-bench ubi-bench/main.go:113 Post "http://172.23.23.XX:9085/api/v1/computing/cp/docker/receive/ubi": context deadline exceeded (Client.Timeout exceeded while awaiting headers)

image I found that in the log, there is no reception of the api: api/v1/computing/cp/docker/receive/ubi (POST)

I use frp server as my swan public ip (34.80.XX.XX:9085) , and the local machine is frp client to connect. The public ip (34.80.XX.XX:9085) is used to receive jobs and heartbeat checks, but after the job is completed, the api of the final reporting job is /v1/computing/cp/docker/receive/ubi (POST) uses my client’s IP (172.23.23.XX:9085), causing timeout

For the final reporting job's completed, need to use the config MultiAddress = "/ip4/34.80.XX.X/tcp/9085" (34.80.XX.XX:9085) to POST the api: /v1/computing/cp/docker/receive/ubi Otherwise, I ran all day, took many jobs and completed them, but in the end none of them reported success.

sonic-chain commented 2 months ago

Submit the proof using the public IP address, modify the branch reference https://github.com/swanchain/go-computing-provider/tree/fix-localip-timeout, pull the branch code, compile the cp binary and replace it.

aa66609 commented 2 months ago

solve my frp problem

internal/computing/ubi.go

image

multiAddressSplit := strings.Split(conf.GetConfig().API.MultiAddress, "/") receiveUrl := fmt.Sprintf("http://%s:%s/api/v1/computing/cp/docker/receive/ubi", multiAddressSplit[2], multiAddressSplit[4])`

sonic-chain commented 2 months ago

I also used public IP to solve this problem. Thank you for your reply.