RequestHandler: replace atexit call by finaliser
RequestHandler: replace atexit call by finaliser

This fixes a problem where, because RequestHandler instances registered
themselves with atexit, they would always live until program exit.

Having replaced the atexit call with the more usual __del__ finaliser, I
found that this __del__ would never run: the queue-handling thread
instantiated by RequestHandler holds references to self.  Having also
replaced that ref by a weakref, we did get the finaliser to run.

Finally, to make sure we don't block on Queue.get() forever (in which
case the thread still doesn't die), this also adds a timeout to that.

Signed-off-by: Yung-Chin Oei <e4c1ab9da74060df152545062ee274845648ed6c@yungchin.nl>

wikimedia/operations-debs-python-pykafka,thedrow/samsa,benauthor/pykafka,wikimedia/operations-debs-python-pykafka,wikimedia/operations-debs-python-pykafka,benauthor/pykafka,yungchin/pykafka,benauthor/pykafka,yungchin/pykafka,thedrow/samsa,thedrow/samsa