When Syncing source code starts, errors will interrupt the application program

The first question,When the source code starts, some errors will interrupt the application’s permission. I would like to understand the principle of error interrupt programs and how to solve them. The source code is as follows, the close() method

func (a *App) wait(errChan <-chan error) {
	err := <-errChan
	a.handleMainServiceError(err)

	done := make(chan struct{})
	go func() {
		a.ll.Close()
		close(done)
	}()
	select {
	case <-done:
	case <-time.After(10 * time.Second):
		l.Warnln("Database failed to stop within 10s")
	}

	l.Infoln("Exiting")

	close(a.stopped)
}

second question,The error log is as follows, which can also interrupt the application. Please analyze the cause of the problem and how to solve it。

[BIKPY] 2023/11/06 10:47:41 INFO: New NAT port mapping: external TCP address 10.10.20.107:46565 to local address [::]:22000.
[BIKPY] 2023/11/06 10:47:41 INFO: Detected 1 NAT service
[BIKPY] 2023/11/06 10:47:41 INFO: quic://0.0.0.0:22000 detected NAT type: Symmetric NAT
[BIKPY] 2023/11/06 10:48:35 INFO: QUIC listener ([::]:22000) shutting down
[BIKPY] 2023/11/06 10:48:35 INFO: Relay listener (dynamic+https://relays.syncthing.net/endpoint) shutting down
[BIKPY] 2023/11/06 10:48:35 INFO: Lost primary connection to JJPORRB at 192.162.68.119:22000-192.162.68.201:22000/tcp-client/TLS1.3-TLS_AES_128_GCM_SHA256/LAN-P10-5SKT2TS8BGM38OT3VPREOA962A: Syncthing is being stopped (0 remain)
[BIKPY] 2023/11/06 10:48:35 INFO: Connection to JJPORRB at 192.162.68.119:22000-192.168.50.201:22000/tcp-client/TLS1.3-TLS_AES_128_GCM_SHA256/LAN-P10-5SKT2TS8BGM38OT3VPREOA962A closed: Syncthing is being stopped
[BIKPY] 2023/11/06 10:48:35 INFO: TCP listener ([::]:22000) shutting down
[BIKPY] 2023/11/06 10:48:35 INFO: Exiting

Syncthing exits when it receives a SIGTERM signal, which appears to be what happened in the second log trace. That might be sent by for example systemd if told to shut down or restart the service.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.