Service Not Responding - Error 1053 - windows-services

The program starts correctly if I double-click it or if I debug it from VS2010, but it doesn't respond when I try running it from Services.msc. It used to work just fine, but I tried to un-register and then re-register the service to fix a different bug and now I get the following error:
Could not start the PFAdapterMng service on Local Computer.
Error 1053: The service did not respond to the start or control request in a timely fashion.
I tried putting logs at the beginning of main(), and I found out that the service stops responding before it even gets there.
I've tried using Procmon to figure out if there's some registry key missing, but I couldn't find any problems through Procmon.
I've also tried re-registering the service to try to fix it, since re-registering the service was what caused the error in the first place. It doesn't seem to fix anything either.
I've stepped through the program with the parameters -UnregServer and -Service to ensure that the program was being unregistered and registered successfully, and it looks like it's being registered as a service correctly.
Is this because of some error in the registry? I don't see how or why my program stops responding before it even gets to main().
What else could I try to do to debug this problem?
UPDATE:
So, I tried un-registering the service after trying to run it, and it seemed to work fine. I look in services.msc, and I still see that the application is a service. In the past, before I got error 1053, it would just disappear after the first time. I tried un-registering it again, and I got a message box:
Service could not be deleted
So I decided to run the application with the parameter -UnregServer inside of Visual Studio 2010 to figure out what the error is. The function DeleteService() is failing with the error:
ERROR_SERVICE_MARKED_FOR_DELETE
The service is not removed until all open handles to the service have been closed. I stepped through the calls to the CloseServiceHandle() function and it seems like the handles were closed successfully. The service is also not removed if the service is running. I checked Process Manager, and the service was not running. Is the service not being removed because the service stopped responding earlier?
I tried restarting my computer and it was gone. Still, I don't understand why I have to restart my computer when the service used to un-register without the need of a restart before I was getting error 1053. Unless of course I can't un-register the service because the service was not stopped because it stopped responding.
I'll keep trying some more things, but I'm running out of ideas.
UPDATE2:
I tried rebuilding the original application, which I know worked as a service. This means the problem is not related to any of my code. Something is messed up with the Services Control Manager. I don't understand why I only get this error with this application. I have another application which communicates with this application which also needs to be registered as a service. I have no problems with that application. It works perfectly.
But for some reason, this application just stopped responding all of a sudden. I don't know what I changed or broke to cause the service to hang before it even gets to my main() function. The only thing I can think of now to fix the problem is to reformat the server, which is not an option.
Thanks,
Krzys

I feel stupid.
I've been using Remote Desktop Connection to connect to this server. Well, the service is starting and erroring out. The reason I didn't see any errors or message boxes was because they were appearing on the console session. I was not connected to the console session. I connected to the server using:
mstsc.exe /admin
And now I can see where the program stops responding.
Feels great to waste 10 hours though.

Related

SonarQube Service Starts, Runs and then Stops?

I have a Windows 2012 R2 server and I managed to install the SonarQube 5.4 server as a Windows Service. I also set up a user so the service can actually start without the infamous "It started then stopped" error a lot of people seem to get. Before installing the server as a windows service, I checked that it worked using StartSonar.bat and it did work just fine, so I was confident when I made it into a service.
But when I try to access http://localhost:9000 there is nothing there, and it appears that shortly after starting the service it stops without any message at all. I can't tell if this is because I try to access the site (which gives me ERR_EMPTY_RESPONSEin Google Chrome) or if it just closes down after a short while.
Anyone got any insight?
I'm a beginner. I came across the same issue and fixed it.
Ensure that the database is running.
My log file (located at sonarqube_home_dir/logs/sonar.log) included the following statement.
Caused by: org.h2.jdbc.JdbcSQLException: Wrong user name or password [28000-176]
Since I'm using the default database, I commented below lines
#sonar.jdbc.username=***
#sonar.jdbc.password=***
at sonarqube_home_dir/conf/sonar.properties.
This must happen due to many reasons like connection problems, permission problems so First, you have to see the logs. /sonarqube-7.6/logs$ tailf sonar.log. then you can find the reason. Once I had the same problem so I did like that. my error is something Directory does not exist: lib/jdbc/mysql
org.sonar.process.MessageException: Directory does not exist: lib/jdbc/mysql reason is I uninstall MySQL and remove all folders name contains "MySQL".
just check whether port 9001 already in used, stop it if already in used.

Reason for Error Timeout in CouchDB

I'm using CouchDB for my iOS application.
Following is my Application flow,
When my application is launched for the first time it replicates the remote database using xyz:a...#mmm.iriscouch.com/databasename.
if the replication is successful, everything works as expected, but sometimes the replication is not successful. In that case I'm getting the following error with log
1> OTHER: {'EXIT',{error,timeout,#Ref<0.0.0.506>}}
and it doesn't replicate until i remove the application and freshly reinstall the application on the device/simulator.
is there any callback/delegate to handle this?
Somehow when I try synching with empty DB then I never get Error time out, once I have content in DB I get the error!
Also it is hard to replicate on simulator, whereas on iPad occurrence is 90%.
i have placed the sample project in git hub
https://github.com/interactiveblueprints/CouchDBSyncTest (for couchDB username password, please read readme.txt)
this sample code is just modification of PhotoLocations. An example application (https://github.com/couchbaselabs/iOS-Demo-PhotoLocations), But changed as per my requirement.
I have also attached the error logs in
http://dl.dropbox.com/u/35814355/ErrorLog.rtf
Waiting for reply,
Krishna.
I have tried with your sample and updated the "Couchbase.framework" to the latest one, from https://github.com/couchbaselabs/CouchCocoa and now the problem seems to be solved, may be this was a bug in previous version. now it seems the DB tries to restart by itself. and the replication feels more smoother and faster.

TFS 2010 Build: Sporadic failure in the process

We have a situation where our builds have stopped executing in a stable manner.
At a rate of about one every three we receive either TF215096 or TF215097 errors & the Build fails.
If we then restart the Build controller, it works again - until next time.
The errors we get are:
TF215096: An error occurred while connecting to controller vstfs:///Build/Controller/1: There was no endpoint listening at ht*p://XXXX that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
TF215096: An error occurred while connecting to controller XXX - Controller: Could not connect to ht*p://XXX. TCP error code 10061: No connection could be made because the target machine actively refused it 192.168.XXX.XXX:XXX.
TF215097: An error occurred while initializing a build for build definition \XXX: Team Foundation services are not available from server ht*p://XXX. Technical information (for administrator): The underlying connection was closed: A connection that was expected to be kept alive was closed by the server.
TF215097: An error occurred while initializing a build for build definition \YYY: An error occurred while receiving the HTTP response to ht*p://XXX. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details.
Server logs provide with little info, at least we 've found nothing that helps us resolve the situation. Various searches in the Net were also not productive.
Does anybody had these/similar issues? Any ideas on how/where to look for a resolution?
Thank you very much in advance for any input!
Yeah it does sound like you have some connectivity issues. You can try enabling SOAP tracing on both the build machine and the server (if possible) to see if there is any error. If it still does not give you any new information, contact Microsoft by filing a Connect Bug to get help.
I am not sure if it will help you but I have ran into similar issues with build agents and ended up just deleting and re-creating the agent. You may try deleting your controller/agent and adding it back in. A brute-force solution but a good starting point. If that doesn't resolve the issue at least you can eliminate the controller/agent as the issue and take a look at network/server related issues.
Today is a happy day, since we managed to get to the bottom of the matter. Sorry #Duat that I'm taking away the 'answer' checkmark - but it turned out that the problem was quite different from what you (and anybody else) has predicted.
In my last update I was about to forward the matter to MS, when we realized that our Firewall was misbehaving in the name resolution. So we assumed this was the culprit & awaited for this to resolve. After this was resolved, we STILL had the same issues and we went again re-examining the situation.
We isolated the problem within our Build Process, more specific with a custom code activity included in our build solution.
I had implemented a code activity that would kick in at the final steps of every build. This activity was about gathering BuildDetails about the running build & add them as a new line in a 'BuildLog.xls'. Implementation made use of Microsoft.Office.Interop.Excel.This excel sheet resides in another server (NOT on the Servers where the controller/agents reside).
During development of this activity I was faced with issues like this, but after I was done no instances of EXCEL were left hanging. So I thought this was done & dealt with.
With try & error, we observed that when this activity wouldn't ran, no problems would occur.
With this activity running, the very first build after a build-controller reset would succeed, any next build had a certain chance to fail. Once any build failed, no other would succeed until another build-controller reset.
I have only a general understanding of what the problem was (Excel-call is DCOM, TFS services are WCF : How on earth would they interfere?! Why would this sometimes succeed and sometimes fail?! ).
The provided diagnostics were no help either, in fact they mislead us into a loop that continued for months.
If I ever find the time, I 'd like to cleanly reproduce the error & make a Server Fault question out of it...
After removal of this activity it works! I now searched in SO & found this, where J.Saunders comments: "In general, you should never use Office Interop from a server environment". It's ironic that once you get to the bottom of any difficult issue, the whole universe seems to have known about it except you...

JNotify not functioning when used as a Windows Service

I am trying to use JNotify to monitor directory changes. My app works as it is supposed to running as a simple java app but when I modified the code to utilize WinRun4J to run my app as a windows service, the service loads and starts fine, the listener is created but the code gets hung at the JNotify.addWatch call. No exception is thrown. Thanks.
Figured out issue. JNotify uses a dll. I added the location of the dll to the 'path' environment variable and it works fine. Sorry for wasting anyone's time.

Starting a windows service fails with error 1053

I have a windows service that is failing to start, giving an error "Error 1053: The service did not respond to the start or control request in a timely fashion".
Running the service in my debugger works fine, and if I double click on the the service .exe on the remote machine a console window pops up and continues to run without problem - I can even see log messages showing me that the program is processing everything the way it should be.
The service had been running fine previously, though this is my first time, personally, trying to deploy it with the most recent changes made to the program. I've evaluated those changes and cant figure out how they might cause this problem, particuarly since everything runs fine when not started as a service.
The StartRoutine() method of the service impelmentation is empty, so should be returning in a "timely fashion".
I've checked the event logs on the computer, and it doesn't give any additional information other than it didn't hear back from the service in the 30 second requisite time frame.
Since it works on my machine, and as a double-clicked executable, how would I go about figuring out why it fails as a service?
Oh, and it's .NET 2.0, so it shouldn't be affected by the 1.1 framework bug that exhibited this symptom (http://support.microsoft.com/kb/839174)
The box is a windows server 2003 R2 machine running SP2.
This is a misleading error. It's probably an unhandled exception.
Empty your OnStart() handler then try this in your constructor...
public MainService()
{
InitializeComponent();
try
{
// All your initialization code goes here.
// For instance, my exception was caused by the lack of registry permissions
;
}
catch (Exception ex)
{
EventLog.WriteEntry("Application", ex.ToString(), EventLogEntryType.Error);
}
}
Now check the EventLog on your system for your Application Error.
Could be a number of things and it might help to get a stack trace on the machine exhibiting the problem. There are a number of ways to do this but the point is that you have to see where this is failing in the code.
You can do this with remote debugging, but a simple thing might be to just log to the event logger, or file log if you have that. Literally, putting "WriteLine("At class::function()") throughout portions of the code to see if you've made it there.
This will at least get you looking in the right direction (which ultimately is the code).
Update:
See Microsoft's How to Debug Windows Services article for details in troubleshooting startup problems using WinDbg.
This related question details nice ways to debug services that are written in .NET.
I agree with Scott, the easiest way to find out what's happening is to put some traces in the start-up code (maybe it doesn't even come to your start-up code).
If this doesn't help, you can post your code here so others can take a look.
perhaps lacking some dependence, try this :
- deregister your service
- register again
If fail at register means that lack an module.
If the StartRoutine is empty, you are probably starting it somewhere else.
IIRC you need to fire off a worker thread, and then return from StartRoutine.
One of the problems which may lead to this error is if windows service which needs to be deployed consists of some error i.e it may be simple authorization error or anything as in my case I have referenced some folders and files for logging which were not existing, but when provided the right path of those file and folders it solved my problem.
I ran through every post on this particular subject and none of the responses solved the problem, so I'm adding this response in case this helps someone else. Admittedly this only applies to a new service, not this specific case.
I was writing a File listening service. As a console app, it worked perfectly. When I ran it as a service, I got the same error as above. What I didn't know (and many of the MSDN articles about services conveniently leave out) is that you need to have your class executed from within ServiceBase.Run( YourClassName());. Otherwise, your app executes and immediately terminates and because it terminated, you get the error above even if no error or exception occurred. Here is a link to an article about this. It actually discusses setting up your app for dual use - Console app and service: Create a combo command line / Windows service app
I had that issue and the source of my problem was config file. I edited it in notepad and notepad added one special character which cause service not to run properly because config file was ruined. I saw that special character in notepadd++ and after delete it, service started to run successfully as previous did.
In my case, the correct .NET framework was not installed on the server that I was installing the Windows service on.
One other reason is If you copy the DLL in 'debug' mode to installation folder this issue will come.What you need to do is Run the project in 'Release' mode copy the DLL or directly form Release folder rather than Debug folder,,and copy that DLL in to installation folder,it will work.You can see the reduction in size of DLL ,it will not contain any debug symbols and like that

Resources