GithubHelp home page GithubHelp logo

Comments (7)

damdo avatar damdo commented on June 12, 2024 1

Yeah noticed this too.
Thanks for putting up a patch for this @nhanb!

from gokrazy.

nhanb avatar nhanb commented on June 12, 2024

I consistently get this error when running gok update over tailscale (it works fine using direct LAN IP):

Transferred root file system (47 MiB) at 26.01 MiB/s (total: 2s)s
Transferred boot file system (16 MiB) at 26.20 MiB/s (total: 1s)s
Triggering reboot
[update boot file system] 0.00% of 16 MiB, uploading at 0 B/s                 2023/05/18 15:00:50 reboot: Post "https://gokrazy:***@junk/reboot": read tcp 100.95.42.78:45338->100.90.227.60:443: read: connection reset by peer

To be more specific, it got stuck for some time at [update boot file system] 0.00% of 16 MiB, uploading at 0 B/s, then the rest of the log followed. However, the appliance has actually been updated and rebooted correctly.

I'm using latest gok and tailscale 1.40.1 on both machines. My appliance is an amd64 mini pc, if that matters.

from gokrazy.

stapelberg avatar stapelberg commented on June 12, 2024

Not sure yet what the trigger is, but maybe we need to programmatically ignore this error in the updater for now.

Given that you can reproduce it reliably, could you send a PR to ignore this error in the updater? Thanks!

from gokrazy.

nhanb avatar nhanb commented on June 12, 2024

I'll try!

from gokrazy.

nhanb avatar nhanb commented on June 12, 2024

I dug into the gokrazy/* repos and found this snippet which could be a race condition:

gokrazy/update.go

Lines 353 to 362 in a764954

log.Println("Rebooting")
w.Write([]byte("Rebooting...\n"))
rc.Flush()
go func() {
time.Sleep(time.Second) // give the http response some time to be sent
if err := reboot(); err != nil {
log.Println("could not reboot:", err)
}
}()
- the /reboot handler assumes the response always finishes successfully within 1 second before rebooting, which may not always be the case (maybe tailscale just adds enough latency for this bug to surface more easily). If we instead allow the http server to gracefully shut down before rebooting, we might solve this bug without any workaround.

On that note, how do I tell gokrazy/tools to use the gokrazy/gokrazy repo from my local disk instead of github.com/gokrazy/gokrazy? Apparently gokrazy/tools/go.mod does not list gokrazy/gokrazy, so I can't replace it. Consequently, I can't test my local changes to the /reboot handler inside the gokrazy/gokrazy repo.

from gokrazy.

stapelberg avatar stapelberg commented on June 12, 2024

the /reboot handler assumes the response always finishes successfully within 1 second before rebooting, which may not always be the case (maybe tailscale just adds enough latency for this bug to surface more easily).

Hmm. Can you try bumping this to 10s to see if that works around the issue?

On that note, how do I tell gokrazy/tools to use the gokrazy/gokrazy repo from my local disk instead of github.com/gokrazy/gokrazy? Apparently gokrazy/tools/go.mod does not list gokrazy/gokrazy, so I can't replace it. Consequently, I can't test my local changes to the /reboot handler inside the gokrazy/gokrazy repo.

You can just gok add . in your gokrazy/gokrazy working copy, that should set up the replace directive in the corresponding build directory within your gokrazy instance. See also https://gokrazy.org/development/modules/#building-local-code-the-replace-directive

from gokrazy.

nhanb avatar nhanb commented on June 12, 2024

Bumping the wait time to 10s doesn't seem to do anything. I wanted to try gracefully shutting down the http server too, but honestly couldn't figure out how to do that in the gokrazy codebase. I'll sleep on it for now :(

Meanwhile I've pushed gokrazy/tools#55 to simply ignore the error.

from gokrazy.

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.