On Mar 31, 2006, at 12:55 PM, David Binger wrote:
> Okay, I see that the behavior really is different on your FreeBSD
> machines
> than it is on OS X or Linux. We need to figure out how to localize
> those other
> services on FreeBSD. The Durus server, in particular, must not be
> available on a public interface.
Here, just for the hack of it, is one fun way to workaround this...
Simply to check on each request if durus server is up, and restart it
if not, and subsequently reset the connection on each publisher as
needed. This of course bypasses the self-defense auto-shutdown
mechanism...
def process_hit(self, hit):
try:
self.get_connection().abort()
except socket.error:
from sys import exc_info
socket_err_code = exc_info()[1].args[0]
if socket_err_code == 54:
print 'Connection reset by peer... restarting durus
server'
self.site.stop_durus()
self.site.start_durus()
if socket_err_code in (32,54):
print 'Broken pipe... resetting durus connection'
durus_address = self.site.get_durus_address()
if durus_address:
durus_host, durus_port = durus_address
from durus.client_storage import ClientStorage
from durus.connection import Connection
self.connection = Connection(
ClientStorage(port=durus_port, host=durus_host),
cache_size=self.site.get_durus_cache_size() )
qp.pub.publish.Publisher.process_hit(self, hit)