Umbraco scheduledTasks not working - umbraco

I have a scheduled task that I want to run every 5 minutes.
I added the url for my method in umbracoSettings.config and the necessary settings but scheduledTasks doesn't seem to be running.
I tried debugging it by calling the url from the browser and I do hit my break point.
I tried checking the logs but there are no errors being recorded. Is this a bug in umbraco? How can I know that the scheduled task is running?
<scheduledTasks>
<!-- add tasks that should be called with an interval (seconds) -->
<task log="true" alias="task1" interval="300" url="http://localhost:43203/umbraco/api/Integration/Init"/>
</scheduledTasks>
I'm using Umbraco 7.5.8
I never had trouble using scheduledTasks in other versions of Umbraco.

The main issue I've seen with scheduled tasks is when the server that's running can't resolve the address in the task. Sometimes a server can be so locked down it can't actually "see" itself, so it can't get to the URL to run it. If this was the case though, you'd normally see some errors in the Umbraco TraceLog file in /App_Data/Logs/.
If your breakpoint isn't getting hit, you could try adding some logging code to the method you're calling and see if that gets written to the Umbraco log files? That way you should be able to tell if it's being hit or not.

Its working now. if you look at umbracoServer table in the database you will see a column isMaster.
The scheduledTasks is only running on the master server.

Related

Scheduled publication not working in Umbraco

I am using Umbraco 7.5.2, installed on a VM in Azure.
When a Publish At date is set, the page is never published. I have tried the following steps.
Create and publish a page
Unpublish the page
Set the Publish At date to a few minutes in the future and Save&Publish
Verified page is definitely not visible
Wait for the time to roll around, and even a few minutes more
Page is never published.
The following message appears in the logs on save when setting the publish at date, which is normal. But no other messages appear after and the page is never published.
2016-10-25 17:46:20,784 [P4808/D10/T21] INFO Umbraco.Core.Services.ContentService - Content 'Video1' with Id '1312' is awaiting release and could not be published.
I've made a copy of my production Umbraco folder and of the database ON THE SAME VM. That instance works for scheduled publishing.
I'm wondering if anyone can provide some clues as to what the issue could be or where I could look. I'd like to avoid having to migrate my production data to this test site.
Thanks
The problem may be related with different time-zone on azure VM as Umbraco is using server time to proceed inside the code execution. This should be the first thing to check.
In version 7.6.0 (https://our.umbraco.org/contribute/releases/760) it will be possible to set up server timezone and then set up a time with precise offset, so those type of problems shouldn't be seen then.
For me it was a wrong umbracoApplicationUrl path (it has to point to YOURDOMAIN/umbraco) After fixing this url everything started working fine
In addition to Marcin's answer, also check that the server can access itself, as it pings itself to fire the scheduled publishing. If it can't resolve it's own address, the scheduled publish will fail. It doesn't happen often, but I've seen a few VERY locked down installs where the server can't resolve it's own address.

JBoss not responding to valid URLs

I encountered strange behavior of an JBoss AS 7 on linux server. When I deploy war with my application, the server doesn't respond for valid HTTP requests for this app. When I try to GET a valid URL, I can see in logs, that backend functions (e.g. DAO methods) are called, debug logs shows that subsequent tags in my JSF are rendered, I even can see a message Rendering View index.xml, but the response never reaches the client.
When I use a non-existent URL (e.g. index.asd) response is 404 and when I use a wrong page name (e.g. inswxasd.xhtml) the response is 500. Thus it fails only with valid requests.
I tried to connect both remotely (using firefox) and locally (with wget) and I reproduced the problem. The strange thing is that I deploy the war that I already used and then it worked.
EDIT 1:
I've just noticed that when I send a request to, the server process takes 200% of CPU. Additionally it happens for only one application with stack: Hibernate, Spring, JSF 2.0, Primefaces.
EDIT 2:
Here is pastie with jstack output (jstack -l -F <PID>). All threads are blocked.
Additionally I noticed (using top and dumping stack of the JBoss process) that the problem is most probably caused by a thread called http--0.0.0.0-8080-1. Any ideas?
Thanks for help. I reverted the database to previous state, and it started to work. Apparently there was a problem in the data that caused this infinite loop. Now we need to find it, but as it is reproducible, I'll manage.

Service Not Responding - Error 1053

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.

WSS caches old Workflow version

I'm currently developing three workflows that are supposed to handle the status of items in different lists.
Each Workflow is attached to a separate list.
When I'm deploying and debugging in my development Environment, everything works fine.
Except for the case, when an item is created via an incoming mail.
I already figured out, that I have to restart some services and then it'll work, but I'm still not sure wich of the services is caching the workflow.
Afterwards I build a .wsp file which I deploy on a server.
Each time I deploy the solution, I do a retract and delete solution first.
After deployment I'll recreate the workflows on the lists
It seems to me that this has no effect. An older version of the workflow is still triggered, if I create a new instance in the list.
I already restarted the whole server and still no result.
Has anyone an idea what else I could try in order to get this working?
Thanks in advance.
If Timer Service is the one that calls your code, then restart Windows SharePoint Services Timer (OWSTIMER.EXE).
When workflow waits on something, it gets serialized (hydrated). When event happens, OWSTIMER.EXE deserializes (dehydrates) and continues workflow execution.
So timer is the one that wakes workflow up.
So this problem kind of resolved itself.
I was reading an article on Kirk Evanns Blog on an issue with the development of workflows in VS2008 for WSS.
I had not realized that I still had an illeagle reference in my Project properties.
I removed the reference. The second thing I tried was deploying with -upgradesolution rather than doing a retract-delete-add-deploy...
I don't know which of both did the trick, but I can finally see the new workflows kicking in.
Thanks for your help.

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