Skip to content

Trying to launch Syncthing when already running resets cert.pem to 0 bytes #10053

@tomasz1986

Description

@tomasz1986

What happened?

  1. Start Syncthing.
  2. Try to start Syncthing again using the same --config (or --home) directory.
  3. The new instance fails to start with the following error:
[start] 2025/04/12 01:58:55.751711 main.go:432: INFO: syncthing v2.0.0-beta.6 "Hafnium Hornet" (go1.24.2 windows-amd64) builder@github.syncthing.net 2025-04-07 09:43:08 UTC [stnoupgrade]
[start] 2025/04/12 01:58:55.751711 utils.go:64: INFO: Generating ECDSA key and certificate for syncthing...
[start] 2025/04/12 01:58:55.753718 main.go:440: WARNING: Failed to load/generate certificate: save cert: write R:\test\syncthing\syncthing1\cert.pem: The process cannot access the file because another process has locked a portion of the file.
[monitor] 2025/04/12 01:58:55.755224 monitor.go:199: INFO: Syncthing exited: exit status 1
  1. Despite that, the cert.pem file has been wiped out and has a size of 0 bytes.

Tested under Windows 10 x64.

Ref 1: 7762e39
Ref 2: https://forum.syncthing.net/t/syncthing-device-id-keeps-switching/24147

Syncthing version

v1.29.4 and beta v2

Platform & operating system

Windows

Browser version

No response

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA problem with current functionality, as opposed to missing functionality (enhancement)

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions