winsw / winsw

A wrapper executable that can run any executable as a Windows service, in a permissive license.
MIT License
12.01k stars 1.57k forks source link

service startup fails after re/new start of pc #180

Open tripower opened 7 years ago

tripower commented 7 years ago

Hello

sometimes the windows service won't start if the computer has been rebooted or turned on

Windows Event Log: Fehler,10.01.2017 06:41:19,Service Control Manager,7034,Keine,"Dienst ""test service"" wurde unerwartet beendet. Dies ist bereits 1 Mal passiert." Warnung,10.01.2017 06:41:19,test-service,0,Keine,"Child process [2888 - C:\ProgramData\Oracle\Java\javapath\java.exe -Dspring.application.admin.enabled=true -Dcom.sun.management.jmxremote.port=50201 -Dcom.sun.management.jmxremote.authenticate=false ""-Dcom.sun.management.jmxremote.ssl=false "" -Djava.library.path=lib -cp lib/* at.StartSpringBootService at.SpringBootTestServiceApplication ] finished with 1"

but it works if I start it 5 or 10 minutes later

any ideas? the wrapper log is empty :(

kind regards klaus

oleg-nenashev commented 7 years ago

Please provide the service configuration. Does it use remote mapped directories or any other dependencies?

Let me also Google Translate for you: "Error, 10.01.2017 06:41:19, ServiceControl Manager, 7034, None, "service" "testService" "exited unexpectedly, this has already happened 1 time.""

tripower commented 7 years ago

here is the config of the service:

`

test-service Test Service Spring Boot App as a Windows Service %BASE%\ %BASE%\logs rotate C:\ProgramData\Oracle\Java\javapath\java.exe -Dspring.application.admin.enabled=true -Dcom.sun.management.jmxremote.port=50201 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.library.path=lib -cp lib/* at.StartSpringBootService at.SpringBootTestServiceApplication C:\ProgramData\Oracle\Java\javapath\java.exe -cp lib/* at.StopSpringBootService 50201

` and no usage of dependencies but it has to run as admin

tripower commented 7 years ago

could it be a problem that "lib" is a windows symlink? and so not completely initialized at the windows startup?

but if I try libXXX (which doesn't exists) I will find an error at the log so that could not be the failure :(

oleg-nenashev commented 7 years ago

Is there anything in the Windows Event Log? If WinSW fails before logger initialization, it prints errors there.

could it be a problem that "lib" is a windows symlink? and so not completely initialized at the windows startup?

Unlikely. There should be messages in logs before starting the executable

Service configuration would be useful as well (e.g. from the registry): DOMAIN/USER, path to the executable, etc. And WinSW version if you do not use 2.0.1

tripower commented 7 years ago

Hello

there are no differences in the windows event log whatever the windows service wrapper works or not

service config `

`

I use winsw version 1.19 path: C:\Program Files (x86)\testservice

oleg-nenashev commented 7 years ago

Please replace the executable by 2.0.1 and try to reproduce the issue. It has more event logging

tripower commented 7 years ago

ok, I will try it but it will take some time because it's hard to reproduce it

tripower commented 7 years ago

Hello

I use now the new winsw version but it raise an error at logging :(

2017-01-16 15:36:05,060 ERROR - Failed to log event in Windows Event Log. Reason: System.ComponentModel.Win32Exception (0x80004005): Die Schnittstelle ist unbekannt bei System.Diagnostics.EventLogInternal.InternalWriteEvent(UInt32 eventID, UInt16 category, EventLogEntryType type, String[] strings, Byte[] rawData, String currentMachineName) bei System.Diagnostics.EventLogInternal.WriteEntry(String message, EventLogEntryType type, Int32 eventID, Int16 category, Byte[] rawData) bei System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType type) bei winsw.WrapperService.LogEvent(String message, EventLogEntryType type)

oleg-nenashev commented 7 years ago

Sorry, I have missed the update. Translations:

Likely it means that the versions of System.Diagnostics.EventLog is not compatible. On which .NET version do you run the wrapper?

nxtn commented 4 years ago

There is a similar error message in #94. Windows Event Log sometimes doesn't work but hopefully we still have file logging. Not a bug.