Comments (2)
To isolate the problem and understand startup behavior, I started with the simplest code: a no-op program
package main
func main() {}
and registered it as a service:
sc.exe create TestSvc binPath= "C:\Test\service.exe"
Trying to start this "service" fails immediately with the 1053 message, even for the SYSTEM account. The message is misleading, but technically correct: The service really did not respond to the request in a timely fashion. Not because a timeout was encountered, but because it exited prematurely. Lesson learned: the message can indicate a timeout, OR premature exit.
To keep the program running the simplest way possible, I start an infinite loop:
package main
func main() {
for {}
}
This behaves as expected: it starts, hogs a CPU thread and ultimately gets killed after 30 seconds. I get a 1053 message again, this time because of the timeout. The key is: This also works with a virtual account "NT SERVICE\TestSvc".
Now I include the package, but don't actually use it. I'm only interested in its side effects.
package main
import _ "github.com/kardianos/service"
func main() {
for {}
}
Now I get the initially described behavior: it runs with the SYSTEM account (until it times out, but that's not important here), but fails immediately with any other account.
My conclusion: The package and/or some of its dependencies have side effects that cause a premature panic when run as a non-system account, before main() is even encountered.
from service.
This is probably a symptom of golang/go/issues/44921 and would be fixed by #362. Workaround:
go get github.com/kardianos/service@804642397ef740ab10846edc26f61fd134d74379
from service.
Related Issues (20)
- Windows reboot success, but boot fail HOT 2
- In Ubuntu 22.04 start error,but Ubuntu 20.04 start is ok HOT 1
- Linux Systemd Script 'RestartSec' is hard-coded
- The service did not respond to the start or control request in a timely fashion.HELP!!!!! HOT 11
- [SOS] Service is not getting started after updating the OS to macOS 14 HOT 1
- Windows service get user home is error ? HOT 2
- Will the service main process be forcibly killed by the system when it changes?
- I set the PIDFIle path in the service, but it seems that the pidFile is not generated. Do I need to maintain this file myself?
- PIDFile process wrong
- pidFile should not use double quotes
- win11 install service access is denied
- Missing rcvar field on FreeBSD
- Example of using s.install() HOT 2
- systemd service file is created with wrong permissions HOT 2
- What is the status of project?
- macos M2 install err: launchctl" failed with stderr: Load failed: 5: Input/output
- How can I set syslog facility HOT 1
- MacOS: incorrect status when calling Service.Status without root privilege.
- some default values for `KeyValue` is not working HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from service.