2
votes

I know there's been similar questions but they don't solve my problem...

After checking out the folders from the repo (which works fine). A method is called from jquery to execute the following in php.

exec ('svn cleanup '.$checkout_dir);
session_write_close(); //Some suggestion that was supposed to help but doesn't
exec ('svn commit -m "SAVE DITAMAP" '.$file);

These would output the following: svn cleanup USER_WORKSPACE/0A8288 svn commit -m "SAVE DITAMAP" USER_WORKSPACE/0A8288/map.ditamap

1) the first line (exec ('svn cleanup')...executes fine. 2) as soon as I call svn commit then my server hangs, and everything goes to hell

The apache error logs show this error: [notice] Child 3424: Waiting 240 more seconds for 4 worker threads to finish.

I'm not using the php_svn module because I couldn't get it to compile on windows.

Does anyone know what is going on here? I can execute the exact same cmd from the terminal windows and it executes just fine.

2
:/ i dont know, i just need it to execute the command, do i need to grab it's output? even if i do a system ($cmd) there's nothing when it freezes - Kayla
this is really calling jquery's exec, right? not php exec(). - mindandmedia
when the user moves a file in themap around, jquery sends a call to php which executes a function that saves these changes to the file, which works, and then i try to call commit and it blows up - Kayla
check my answer (<-- this is a noop) - mindandmedia

2 Answers

2
votes

since i cannot find any documentation on jquery exec(), i assume this is calling php. i copied this from the documentation page:

When calling exec() from within an apache php script, make sure to take care of stdout, stderr and stdin (as in the example below). If you forget this and your shell command produces output the sh and apache deamons may never return (they will normally time out after a few minutes). From the calling web page the script may seem to not return any data.

If you want to start a php process that continues to run independently from apache (with a different parent pid) use nohub. Example:

exec('nohup php process.php > process.out 2> process.err < /dev/null &');

hope it helps

1
votes

Okay, I've found the problem.

It actually didn't have anything to do with the exec running the background, especially because a one file commit doesn't take a lot of time.

The problem was that the commit was expecting a --username and --password that didn't show up, and just caused apache to hang.

To solve this, I changed the svnserve.conf in the folder where I installed svn and changed it to allow non-auth users write access.

I don't think you'd normally want to do this, but my site already authenticates the user name and pass upon logging in.

Alternatively you could