I'm currently running both servers as seperate daemons rather than using apache with mod-ssl. Don't ask me why it just ended up that way. Anyway I've had this problem before I installed apache-ssl so I'm pretty sure it's not the fact that I'm running both that's causing it.
I can clear the semophores by shutting down the servers and issueing this command:
ipcs -s -t | cut -f 1 -d " " | egrep "^[0-9]+$" | xargs ipcrm sem
but I'd like to hear if anyone else has had this kind of issue and if anyone has come up with a solution. I'd prefer to get it to run without me having to restart the servers every few days.