[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: SVN hangs when being executed by CruiseControl

From: Sean Carey <scarey_at_ruckus.com>
Date: 2004-08-17 01:23:23 CEST

If this is true ,, wouldnt it happen all the time. This is freezing
randomly. Plus I should give you a background on the SVN server.

Its Solaris

We are using svn+ssh
and Its accessing a private key. It never asks for a password. I can put
a username and password into the config if you think it will help. Also
,, here is the code to the bootstrapper. Anyone see anything wrong??

package net.sourceforge.cruisecontrol.bootstrappers;
import net.sourceforge.cruisecontrol.Bootstrapper;
import net.sourceforge.cruisecontrol.CruiseControlException;
import net.sourceforge.cruisecontrol.util.Commandline;
import net.sourceforge.cruisecontrol.util.StreamPumper;
import org.apache.log4j.Logger;

import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * The SVNBootstrapper will handle updating a single file from Subversion
 * before the build begins.
 *
 * @see subversion.tigris.org
 * @author Etienne Studer
 */
public class SVNBootstrapper implements Bootstrapper {
    private static final Logger LOG =
Logger.getLogger(SVNBootstrapper.class);

    /** Configuration parameters */
    private String fileName;
    private String localWorkingCopy;
    private String userName;
    private String password;

    /**
     * Sets the file to update from the Subversion repository.
     */
    public void setFile(String fileName) {
        this.fileName = fileName;
    }

    /**
     * Sets the local working copy to use when making calls to Subversion.
     *
     * @param localWorkingCopy String indicating the relative or
absolute path
     * to the local working copy of the Subversion
     * repository on which to execute the
update command.
     */
    public void setLocalWorkingCopy(String localWorkingCopy) {
        this.localWorkingCopy = localWorkingCopy;
    }

    /**
     * Sets the username for authentication.
     */
    public void setUsername(String userName) {
        this.userName = userName;
    }

    /**
     * Sets the password for authentication.
     */
    public void setPassword(String password) {
        this.password = password;
    }

    /**
     * This method validates that at least the filename or the local working
     * copy location has been specified.
     *
     * @throws CruiseControlException Thrown when the repository
location and
     * the local working copy location
are both
     * null
     */
    public void validate() throws CruiseControlException {
        if (fileName == null && localWorkingCopy == null) {
            throw new CruiseControlException(
                "At least 'filename' or 'localWorkingCopy' is a "
                    + "required attribute on the Subversion bootstrapper
task");
        }

        if (localWorkingCopy != null) {
            File workingDir = new File(localWorkingCopy);
            if (!workingDir.exists() || !workingDir.isDirectory()) {
                throw new CruiseControlException(
                    "'localWorkingCopy' must be an existing " +
"directory.");

            }
        }
    }

    /**
     * Update the specified file from the subversion repository.
     */
    public void bootstrap() {
        try {
            Commandline commandLine = buildUpdateCommand();
            execUpdateCommand(commandLine);
        } catch (Exception e) {
            LOG.error("Error executing svn update command", e);
        }
    }

    /**
     * Generates the command line for the svn update command.
     *
     * For example:
     *
     * 'svn update --non-interactive filename'
     */
    Commandline buildUpdateCommand() throws CruiseControlException {
        Commandline command = new Commandline();
        command.setExecutable("svn");

        if (localWorkingCopy != null) {
            command.setWorkingDirectory(localWorkingCopy);
        }

        command.createArgument().setValue("update");
        command.createArgument().setValue("--non-interactive");
        if (userName != null) {
            command.createArgument().setValue("--username");
            command.createArgument().setValue(userName);
        }
        if (password != null) {
            command.createArgument().setValue("--password");
            command.createArgument().setValue(password);
        }
        if (fileName != null) {
            command.createArgument().setValue(fileName);
        }

        LOG.debug("SVNBootstrapper: Executing command = " + command);

        return command;
    }

    private void execUpdateCommand(Commandline command)
        throws IOException, InterruptedException {
           
        Process p = command.execute();

        logErrorStream(p);
        logOutStream(p);

        p.waitFor();
        p.getInputStream().close();
        p.getOutputStream().close();
        p.getErrorStream().close();
    }

    private void logErrorStream(Process p) {
        StreamPumper errorPumper =
            new StreamPumper(p.getErrorStream(), new
PrintWriter(System.err, true));
        new Thread(errorPumper).start();
    }

    private void logOutStream(Process p) {
        StreamPumper outPumper =
            new StreamPumper(p.getInputStream(), new
PrintWriter(System.out, true));
        new Thread(outPumper).start();
    }
}

Ray Johnson wrote:

>I'll bet you $1 it's hanging because it is asking for credentials & your
>account when your running in the automation is different (or different
>enough) that it doesn't know the credentials. Bets off if your already
>using --username & --password. :)
>
>-----Original Message-----
>From: kfogel@newton.ch.collab.net [mailto:kfogel@newton.ch.collab.net]
>On Behalf Of kfogel@collab.net
>Sent: Monday, August 16, 2004 12:12 PM
>To: Sean Carey
>Cc: users@subversion.tigris.org
>Subject: Re: SVN hangs when being executed by CruiseControl
>
>Sean Carey <scarey@ruckus.com> writes:
>
>
>>I still havent gotten a reply on this issue and am really hoping
>>someone has had a similar experience. Any advice would be appreciated
>>
>>
>
>Does CruiseControl log the 'svn.exe' invocations anywhere? Can you get
>access to those logs?
>
>-Karl
>
>
>
>
>
>
>>Sean Carey wrote:
>>
>>
>>
>>>Hi
>>>I am using a continuos integration system called CruiseControl. At
>>>least 1-2 times a day CruiseControl stop working because SVN.exe
>>>hangs after cruisecontrol executes it. I can never really catch it
>>>at the right time to find the problem. I end up having to CTRL-C my
>>>way out, and I sometimes get a locking error after that saying to
>>>run SVN Cleanup. I am wondering some things:
>>>
>>>1) If my SVN server is slow or has a lot of traffic on it,, can
>>>svn.exe hang waiting for the SVN UPDATE to execute.
>>>2) Can someone point me in the right direction to troubleshooting
>>>
>>>
>this?
>
>
>>>Regards
>>>
>>>Sean Carey
>>>
>>>
>>>--------------------------------------------------------------------
>>>- To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
>>>For additional commands, e-mail: users-help@subversion.tigris.org
>>>
>>>
>>>
>>>
>>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
>>For additional commands, e-mail: users-help@subversion.tigris.org
>>
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
>For additional commands, e-mail: users-help@subversion.tigris.org
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
>For additional commands, e-mail: users-help@subversion.tigris.org
>
>
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Tue Aug 17 01:24:00 2004

This is an archived mail posted to the Subversion Users mailing list.