Swabra configuration - Locking processes

Hi,

Is there a way to configure the swabra plugin to kill all processes running under the checkout directory instead of just processes locking files?  This would be really helpful as sometimes the builds we kill that have a tomcat running is talking to an oracle database isn't shutdown due to killing the build.  This makes a subsequent build fail because some process is using an oracle user so when the build runs again it fails because the user is being used.

Thanks,
Jay

11 comments
Comment actions Permalink

Hello, Jason,

Swabra plugin uses SysInternals handle.exe and currently detects processes which have open file handles inside the checkout directory.

What do you mean when saying "all processes running under the checkout directory"?

0
Comment actions Permalink

Hi,

When I say "All running processes under the checkout directory" I mean whatever you set for the checkout directory in TeamCity if any processes are running anywhere in the children directories I'd like to kill them.  Say for example the checkout directory is c:\BuildAgent\work\trunk and I have a directory c:\BuildAgent\work\trunk\projectA\tomcat which as a running instance of tomcat but for some reason someone cancels the build I would like to be able to kill all the processes under c:\BuildAgent\work\trunk recursively either at the end of a build or before the start of our builds to ensure nothing is running and could potentially cause a future build to fail.  Do you know of any tool that I could use which I could execute using the command line runner or ant for this or any plans to add a feature like this?

0
Comment actions Permalink

Jason,

Did you try Swabra "Kill locking processes" option for your case? I suppose that a running instance of tomcat inside the checkout directory actually locks it and will be killed by Swabra if the specified option is turned on.

0
Comment actions Permalink

Can you monitor absolute paths or paths that are outside of the work directory?  Does Swabra run if a build times out or fails in other ways?

Does it work on non-Windows agents?  The help reads as though it only works on Windows.

0
Comment actions Permalink

Hello, Leon,

Does Swabra run if a build times out or fails in other ways?


Swabra runs at the end of the build (if "After build" option selected) regardless of the build status or interrupting.

Can you monitor absolute paths or paths that are outside of the work directory?


Currently it's desined to monitor only paths inside the checkout directory aimed at saving free space, cleaning build "garbage" and detecting changes to VCS-checked-out files inside it.

Does it work on non-Windows agents?  The help reads as though it only works on Windows.


Swabra works for all agents, but locking processes detection works only on Windows agents (senseless for Linux).

What's your case and why you need monitoring paths outside the checkout directory?

0
Comment actions Permalink

Thanks.  Our tests often install Tomcat and JBoss, RPMs and other items onto the agent system.  They run tests from Maven in the work directory to start the server, run the tests and then clean up by stopping and uninstalling the tested components.  In some cases they are leaving orphaned processes on the build agent, which disrupts subsequent tests by starving them of resources or occupying ports that are needed.  Optimally, we'd like the build agent to be configurable for these cleanup steps.

0
Comment actions Permalink

We have the same issue where tomcat may have trouble shutting down thus locking the files under tomcat/logs.

0
Comment actions Permalink

I'm not sure why "locking processes" on Linux is senseless. Weirdness happens and processes may be left behind. Without cleaning out those processes, subsequent builds may fail. Is the handle.exe more or less the same as lsof on Linux / Unix? Seems Swabra could try to clean up processes using lsof / kill. No?

0
Comment actions Permalink

Should this become a feature request?

0
Comment actions Permalink

I'm not sure why "locking processes" on Linux is senseless. Weirdness happens and processes may be left behind. Without cleaning out those processes, subsequent builds may fail

As far as I know file locks are not mandatory in UNIX hence it may happen that some process that actually works with some file is impracticable to detect.

Is the handle.exe more or less the same as lsof on Linux / Unix? Seems Swabra could try to clean up processes using lsof / kill. No?

Yes, these two utilities seem to do similar job.

0
Comment actions Permalink

Feel free to create request issues on our public issue tracker for absolute paths support in swabra and for "locking" processes detection on Unix agents (ex. with the help of lsof)

0

Please sign in to leave a comment.