Skip to content

panic with "WARNING: Error starting the main Syncthing process: exec: "syncthing.exe": cannot run executable found relative to current directory" when starting v1.21.0-rc.1 in command line in Windows #8499

Closed

Description

@tomasz1986

This happens if you try to start the current RC from the command line in Windows.

R:\syncthing-windows-amd64-v1.21.0-rc.1>syncthing.exe
[monitor] 2022/08/13 15:32:57 INFO: Log output saved to file "C:\Users\User\AppData\Local\Syncthing\syncthing.log"
[monitor] 2022/08/13 15:32:57 WARNING: Error starting the main Syncthing process: exec: "syncthing.exe": cannot run executable found relative to current directory
panic: Error starting the main Syncthing process

goroutine 1 [running]:
main.monitorMain({{{0x0}, {0x0, 0x0}, {0x0, 0x0}, 0x0, 0x0}, 0x0, 0x0, {0x0, ...}, ...})
        github.com/syncthing/syncthing/cmd/syncthing/monitor.go:124 +0x110f
main.serveOptions.Run({{{0x0}, {0x0, 0x0}, {0x0, 0x0}, 0x0, 0x0}, 0x0, 0x0, {0x0, ...}, ...})
        github.com/syncthing/syncthing/cmd/syncthing/main.go:404 +0x798
reflect.Value.call({0x10df7c0?, 0x1a8c660?, 0xf13515?}, {0x10ed8d2, 0x4}, {0xc0001dbb80, 0x0, 0x645948?})
        reflect/value.go:584 +0x8c5
reflect.Value.Call({0x10df7c0?, 0x1a8c660?, 0xfde580?}, {0xc0001dbb80?, 0x10?, 0x1a8caa0?})
        reflect/value.go:368 +0xbc
github.com/alecthomas/kong.callMethod({0x10ed2c7, 0x3}, {0x10df7c0?, 0x1a8c660?, 0x3?}, {0x10df7c0?, 0x1a8c660?, 0x0?}, 0x0?)
        github.com/alecthomas/[email protected]/callbacks.go:95 +0x549
github.com/alecthomas/kong.(*Context).RunNode(0xc000160d80, 0xc0001262d0, {0x0, 0x0, 0x0})
        github.com/alecthomas/[email protected]/context.go:734 +0x5f7
github.com/alecthomas/kong.(*Context).Run(0xf6efe0?, {0x0?, 0x0?, 0x0?})
        github.com/alecthomas/[email protected]/context.go:759 +0x14e
main.main()
        github.com/syncthing/syncthing/cmd/syncthing/main.go:255 +0x3a5

goroutine 6 [chan receive]:
github.com/syncthing/notify.(*recursiveTree).dispatch(0xc00007c7d0)
        github.com/syncthing/[email protected]/tree_recursive.go:125 +0x48
created by github.com/syncthing/notify.newRecursiveTree
        github.com/syncthing/[email protected]/tree_recursive.go:119 +0x165

goroutine 7 [sleep]:
time.Sleep(0x1dcd6500)
        runtime/time.go:195 +0x13c
github.com/syncthing/syncthing/lib/dialer.init.0.func2()
        github.com/syncthing/syncthing/lib/dialer/internal.go:43 +0x1e
created by github.com/syncthing/syncthing/lib/dialer.init.0
        github.com/syncthing/syncthing/lib/dialer/internal.go:42 +0xbe

goroutine 8 [select]:
main.(*autoclosedFile).closerLoop(0xc000247c00)
        github.com/syncthing/syncthing/cmd/syncthing/monitor.go:528 +0x71
created by main.newAutoclosedFile
        github.com/syncthing/syncthing/cmd/syncthing/monitor.go:468 +0x1e5

goroutine 9 [syscall]:
os/signal.signal_recv()
        runtime/sigqueue.go:152 +0x2f
os/signal.loop()
        os/signal/signal_unix.go:23 +0x19
created by os/signal.Notify.func1.1
        os/signal/signal.go:151 +0x2a

The workaround is to use .\syncthing.exe, but this wasn't the case before when compiled with Go 1.18. I personally think it is a big problem, because this requirement is very likely to break custom scripts, especially since using .\ isn't common in batch scripts at all (as it's optional and thus usually omitted).

Activity

  1. added
    bug
    needs-triage
    on Aug 13, 2022
  2. bt90 commented on Aug 13, 2022

    @bt90
    Contributor
  3. tomasz1986 commented on Aug 13, 2022

    @tomasz1986
    MemberAuthor

    Probably, because I've just recompiled with Go 1.18, and the issue is gone.

    Is this restriction absolutely necessary though? Would it be a problem to disable it? It breaks the established workflow, as no command line Windows software behaves like that (or at least I've never encountered anything similar until now). The CMD itself doesn't even add .\ to paths when using TAB autocomplete (in contrary to PowerShell, which does).

    Edit:

    I also want to add that this crashes Syncthing on upgrade from an older version.

    1. Run v1.20.4 from the command line, e.g. syncthing.exe -home=test
    2. Enable upgrade to release candidates, restart, and press the upgrade button in the GUI.
    3. The upgraded executable fails to start with the same panic as described above.
  4. imsodin commented on Aug 13, 2022

    @imsodin
    Member

    That's because of our monitor stuff using exec with arg[0] which is syncthing, and thus being affected by that behaviour change. I'll take care of it.

  5. added a commit that references this issue on Aug 13, 2022
    9c02c70
  6. added
    skip-changelog
    and removed
    needs-triage
    on Aug 13, 2022
  7. added 2 commits that reference this issue on Aug 17, 2022
    de697f7
    27ce4a7
  8. added this to the v1.21.0 milestone on Aug 23, 2022
  9. added
    frozen-due-to-age
    on Aug 15, 2023
  10. locked and limited conversation to collaborators on Aug 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugfrozen-due-to-ageskip-changelog

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions