views:

166

answers:

2

I have a project that is being built using CruiseControl.NET. The project contains an 'MSBuild task' that runs the build for the project and also the unit tests. The unit test in turn is just a MSBuild 'exec' task that runs an executable.

The unit test involves some .NET remoting. And when the unit tests are run through the system command prompt, the software's window opens up, tests run and the process exits.

When I force a build through the web dashboard, the build hangs at the point where the unit test starts running. The software's window does not open up, but the executable is running. If the process is killed through the task explorer, the build goes through with a 'Failure' status. This happens when I run ccnet as a windows service.

If I run CCNet directly (not as a windows service) and force a build through the web dashboard, the build and unit tests go through fine as expected. (with the window of the software opening up.)

It looks like there is a deadlock in the case where CCNet is run as a windows service. I am guessing it is related to the standard output/error streams.

  1. Is this is known problem?

  2. What might be the problem going on?

  3. Any suggestions on debugging this?

  4. How can I get around it?

(I am using CCNet version 1.4.4 SP1)

+1  A: 

When CCNet is running as a service it is not going to have access to the display, so don't expect to see anything on the screen in this configuration. The first thing I would check is the permissions - make sure the service runs as an account that has permissions to access whatever resources you need. You also have CCNet log files, which you can find via Dashboard.

On a side note, try TeamCity instead of CCNet, its 10 years ahead.

Grzenio
The account under which the service is an admin account and it has the privileges, but it still does not help.I did not understand 'access to the display'. CCNet is launching an application. This shows up the window of the application when CCNet is run as a simple app and does not show up when CCNet is run as a service. Can you please explain how the 'access to display' comes into effect when CCNet launches the application?And there are no errors/exceptions in the log files that complain of permissions denied.
Poulo
@Poulo, in Windows, for security reasons, services don't have access to what is displayed on the screen. So when ccnet run as service launches your application, it will not show the command window nor create any windows/controls etc. Otherwise the process just works as usual, so it there shouldn't be any issues with this. The only thing I can advice is to use some logger (e.g. log4net) and add extensive logging to your tests to figure out what is happening. Alternatively try Team City (I think its free for small projects).
Grzenio
Thank you. Can you please point me to some useful reading on this. (services launching applications will not create windows/controls) I want to understand how that affects .NET remoting calls made in the application. If I can find out something concrete, then I can change my unit test application to workaround the issue or not use .NET remoting. Its been a while since I have started using CCNet and I have 7 projects in them, so trying out Team City as you suggested would be last on my list.
Poulo
A: 

Maybe this answer will help : http://stackoverflow.com/questions/2799123/delphi-windows-service-cant-download-file-from-internet/2799392#2799392

You should know that when running CCNet as an application (the dosbox) it uses the environment variables and all rights from the logged account. So it may connect to a server, use cached passwords, get registry variables for this account.

BUT when ran as a service, the account is the one you provided : LocalSystem for exampe, where env. varibales are not the same.

So, what you can do is to change the CCNet service account for test. Change it to your user account (with password), and I'm sure it will work better !

TridenT
The account under which the service is an admin account and it has the privileges, but it still does not help.
Poulo