If you have time, please respond.
On Monday, March 2, 2015 at 2:04:46 PM UTC+2, Paul Royik wrote:
>
> I made a research and found no suspicious imports.
> I give you contents of mathsite.timeout module for further research:
>
> exceptions.py
> class TimeoutException(Exception):
> pass
>
> manager.py
> from mathsite.timeout.timeout import MyManager
> import os
> def get_manager():
> sockpath = os.path.join(os.path.dirname(__file__),
> 'task-queue-manager.sock')
> if True:
> return
> try:
> m = MyManager(address=sockpath, authkey='abracadabra')
> m.connect()
> return m.Maths()
> except:
> return None
>
> task-queue-manager.py
> import os
>
> from mathsite.timeout.timeout import MyManager
>
> sockpath = os.path.join(os.path.dirname(__file__),
> 'task-queue-manager.sock')
>
> try:
> os.unlink(sockpath)
> except OSError:
> pass
>
> m = MyManager(address=sockpath, authkey='abracadabra')
> s = m.get_server()
> s.serve_forever()
>
> timeout.py
> import multiprocessing
> import os
> import signal
> from multiprocessing.managers import BaseManager
> from mathsite.timeout.exceptions import TimeoutException
>
>
> class RunableProcessing(multiprocessing.Process):
> def __init__(self, func, *args, **kwargs):
> self.queue = multiprocessing.Manager().Queue(maxsize=1)
> args = (func,) + args
> multiprocessing.Process.__init__(self, target=self.run_func,
> args=args, kwargs=kwargs)
>
> def run_func(self, func, *args, **kwargs):
> try:
> result = func(*args, **kwargs)
> self.queue.put((True, result))
> except Exception as e:
> self.queue.put((False, e))
>
> def done(self):
> return self.queue.full()
>
> def result(self):
> return self.queue.get()
>
> def timeout(seconds, function, *args, **kwargs):
> proc = RunableProcessing(function, *args, **kwargs)
> proc.start()
> proc.join(seconds)
> if proc.is_alive():
> proc.terminate()
> proc.join(1)
> if proc.is_alive():
> try:
> os.kill(proc.pid, signal.SIGKILL)
> except Exception:
> pass
> proc.join(1)
> raise TimeoutException
> success, result = proc.result()
> if success:
> return result
> else:
> raise result
>
> class MathClass(object):
> def run(self, seconds, func, *args, **kwargs):
> return timeout(seconds, func, *args, **kwargs)
>
> class MyManager(BaseManager):
> pass
>
> MyManager.register('Maths', MathClass)
>
> utils.py
>
> import time
> import subprocess
> from mathsite.timeout.exce
> ...
--
You received this message because you are subscribed to the Google Groups
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.