Why does E210002 error occur only when launched svnserve via launchctl?

Why does E210002 error occur only when launched svnserve via launchctl?

When I start svnserve with

$ sudo /usr/local/bin/svnserve -d -r /Volumes/RAID1disk/svn

and run

$ svn commit -m "test1",

svn commit succeeds, but when I start svnserve with

$ sudo launchctl load -w /Library/LaunchDaemons/com.toshiyuki.svnserve.plist

and run

$ svn commit -m "test2",

svn commit fails and displays the following error:

Committing transaction...
svn: E210002: Commit failed (details follow):
svn: E210002: Network connection closed unexpectedly

After the E210002 error, I ran

$ ps aux | grep svnserve

and got the following result.

toshiyuki 67686 0.0 0.0 34252296 700 s000 S+ 10:13AM 0:00.00 grep svnserve
root 35267 0.0 0.0 34302936 592 ?? Ss 10:01AM 0:00.00 /usr/local/bin/svnserve -d -r /Volumes/RAID1disk/svn

From this, I believe that svnserve is launched as the root user from launchctl.

Also, when I ran

$ls -l /volumes/raid1disk/svn

the following result was obtained.

-rw-rw-r-- 1 root wheel 246 7 23 22:31 README.txt
drwxrwxr-x 6 root wheel 192 7 24 06:31 conf
drwxrwxr-x 17 root wheel 544 7 24 10:01 db
-r--rw-r-- 1 root wheel 2 7 23 22:31 format
drwxrwxr-x 11 root wheel 352 7 23 22:31 hooks
drwxrwxr-x 4 root wheel 128 7 23 22:31 locks

so, svnserve has write access to the repository.

If I start svnserve with

$ sudo /usr/local/bin/svnserve -d -r /Volumes/RAID1disk/svn

instead of

$ sudo launchctl load -w

/Library/LaunchDaemons/com.toshiyuki.svnserve.plist

both svn commit and svn chekout always succeed, so I think there is no problem with the svnserve configuration file (/etc/svnserve.conf or the file in /etc/svnserve.conf.d).

I think the plist of launchctl is also correct. because If I start svnserve with

$ sudo launchctl load -w /Library/LaunchDaemons/com.toshiyuki.svnserve.plist

only svn chekout always succeeds (commit fails, though).

The contents of the plist of launchctl file are as follows:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.toshiyuki.svnserve</string>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/local/bin/svnserve</string>
        <string>-d</string>
        <string>-r</string>
        <string>/Volumes/RAID1disk/svn</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>KeepAlive</key>
    <true/>
    <key>StandardErrorPath</key>
    <string>/var/log/svnserve.log</string>
    <key>StandardOutPath</key>
    <string>/var/log/svnserve.log</string>
  <key>UserName</key>
    <string>root</string>
    <key>EnvironmentVariables</key>
    <dict>
        <key>PATH</key>
        <string>/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin</string>
    </dict>
</dict>
</plist>

Also, the execution result of

$ls -l /library/LaunchDaemons/com.toshiyuki.svnserve.plist

is as follows.

-rw-r--r--@ 1 root wheel 929 7 24 10:29 /library/LaunchDaemons/com.toshiyuki.svnserve.plist

But when I start svnserve with

$ sudo launchctl load -w /Library/LaunchDaemons/com.toshiyuki.svnserve.plist

"svn commit" always fails. Why is this?

When I check the /var/log/svn/svnserve.log file,

svnserve: E000048:Address already in use errors occured periodically.

Why does E210002 error occur only when launched svnserve via launchctl?

The standard answer to questions like this is “Because the launchd execution context is different from other contexts — like those created by sudo and a traditional Unix inetd — and the code has noticed that difference.” We have some general info at the top of the launchd.plist man page.

Beyond that, it’s hard to provide detailed answers to questions like this without debugging at the source code level. Fortunately, you have access to the SVN source code (-:

To start, I’d use packet trace to see what’s happening on the ‘wire’ between svn and svnserve. It sounds like svnserve is dropping the connection, or perhaps crashing, but it’s best to look at a packet trace to confirm that.

Once you know that the problem is within svnserve, it’s time to look at its code to see where it’s going wrong.

Alternatively, you could look at the support channels for Subversion to see if someone there has already investigated how to get svnserve running properly on the Mac.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Why does E210002 error occur only when launched svnserve via launchctl?
 
 
Q