Commit Graph

202 Commits

Author SHA1 Message Date
R. Tyler Croy f56c0f5233 Merge pull request #32 from Fantomas42/django1.4_and_future
Compatibility with Django >= 1.4
2012-06-13 14:56:42 -07:00
Fantomas42 a2e8f79655 removing references to AdminMediaHandler, because of incompatibilities with django1.4 and future removal in django1.5 2012-06-06 10:54:51 +02:00
K. Noah 5fc950550f removing osx cruft 2011-04-12 12:01:20 -07:00
K. Noah 51b1551c05 updated scripts as to what I have working in prod plus mods for rtylers comments 2011-04-12 12:01:16 -07:00
noah 59a2afb66b adding rc-scripts for fedora 2011-04-12 12:01:08 -07:00
R. Tyler Croy a7d455bb32 Increment the version counter!
Change-Id: I11b01075ac3065acfb6c5604799871d39e5a34b8
2011-04-12 11:59:32 -07:00
R. Tyler Croy 778ec46d08 Removing logging calls from signal handlers
Seeing an issue in production where this signal handler is being handled
in a way that causes the eventlet hub to *not* be able to properly switch back
to its runloop properly.

My hunch is that this is happening due to the use of the threadpool and signal
handlers being forced to execute on the primary thread. That said, no repro
case whatsoever. HEISENBUG!

Change-Id: Id303e3755d89d7e2aab06dde17719fef843b01a2
2011-04-11 10:18:40 -07:00
R. Tyler Croy cae56173cd Move the spawning source code up a level in the directory
That pesky src/ dir has always bothered me

Change-Id: I242538c34db43301fde056c3c16015a3d39b9efe
2011-03-12 21:16:41 -08:00
R. Tyler Croy 9e1221d906 Cleanup some superfluous whitespace
Change-Id: I27a0513f5f901650293d6d2bb1dd3b9761f8a743
2011-03-03 11:03:57 -08:00
R. Tyler Croy 4230fb548e Allow --threads=1 to use a threadpool of size 1 instead of making `-t 0` and `-t 1` synonymous
I'm hoping there aren't too many people relying on this behavior >_>

Change-Id: Ia8871ff4f831dbd3a22c6a364e9f2bbe3b1a0125
2011-03-03 11:02:25 -08:00
R. Tyler Croy f53e2cbb54 Prefer simplejson over json in the child too
Change-Id: Ie04bf15f891758625205983cb094f07583616d7b
2011-03-03 11:01:59 -08:00
R. Tyler Croy d66ee49a2f Bump the version of Spawning to 0.9.6
Change-Id: I6b8977af2473898c5bb1b048b9882c863a596150
2011-03-03 11:01:39 -08:00
R. Tyler Croy 42ae95cd5e Monkey-patch prior to importing standard lib modules to prevent unnecessary blockage
In production environments, I've seen a some threading.Lock acquire calls
killing the controller. I believe this patch should resolve that issue:

    A child intends to die, starting replacement before it dies
    Controller.spawn_children(number=1)
    Traceback (most recent call last):
    File "/usr/local/bin/spawning", line 8, in <module>
        load_entry_point('Spawning==0.9.5', 'console_scripts', 'spawning')()
    File "/usr/local/lib/python2.6/site-packages/spawning/spawning_controller.py", line 501, in main
        start_controller(sock, factory, factory_args)
    File "/usr/local/lib/python2.6/site-packages/spawning/spawning_controller.py", line 278, in start_controller
        c.run()
    File "/usr/local/lib/python2.6/site-packages/spawning/spawning_controller.py", line 236, in run
        self.runloop()
    File "/usr/local/lib/python2.6/site-packages/spawning/spawning_controller.py", line 158, in runloop
        eventlet.sleep(0.1)
    File "/usr/local/lib/python2.6/site-packages/eventlet/greenthread.py", line 30, in sleep
        hub.switch()
    File "/usr/local/lib/python2.6/site-packages/eventlet/hubs/hub.py", line 177, in switch
        return self.greenlet.switch()
    File "/usr/local/lib/python2.6/site-packages/eventlet/hubs/hub.py", line 226, in run
        self.wait(sleep_time)
    File "/usr/local/lib/python2.6/site-packages/eventlet/hubs/poll.py", line 84, in wait
        presult = self.do_poll(seconds)
    File "/usr/local/lib/python2.6/site-packages/eventlet/hubs/epolls.py", line 55, in do_poll
        return self.poll.poll(seconds)
    File "/usr/local/lib/python2.6/site-packages/spawning/spawning_controller.py", line 212, in handle_deadlychild
    File "/usr/local/lib/python2.6/site-packages/eventlet/hubs/poll.py", line 84, in wait
        presult = self.do_poll(seconds)
    File "/usr/local/lib/python2.6/site-packages/eventlet/hubs/epolls.py", line 55, in do_poll
        return self.poll.poll(seconds)
    File "/usr/local/lib/python2.6/site-packages/spawning/spawning_controller.py", line 212, in handle_deadlychild
        self.spawn_children(number=1)
    File "/usr/local/lib/python2.6/site-packages/spawning/spawning_controller.py", line 121, in spawn_children
        self.log.debug('Controller.spawn_children(number=%d)' % number)
    File "/usr/local/lib/python2.6/logging/__init__.py", line 1044, in debug
        self._log(DEBUG, msg, args, **kwargs)
    File "/usr/local/lib/python2.6/logging/__init__.py", line 1173, in _log
        self.handle(record)
    File "/usr/local/lib/python2.6/logging/__init__.py", line 1183, in handle
        self.callHandlers(record)
    File "/usr/local/lib/python2.6/logging/__init__.py", line 1220, in callHandlers
        hdlr.handle(record)
    File "/usr/local/lib/python2.6/logging/__init__.py", line 681, in handle
        self.release()
    File "/usr/local/lib/python2.6/logging/__init__.py", line 635, in release
        self.lock.release()
    File "/usr/local/lib/python2.6/threading.py", line 142, in release
        self.__block.release()
    File "/usr/local/lib/python2.6/site-packages/eventlet/semaphore.py", line 80, in release
        def release(self, blocking=True):
    File "/usr/local/lib/python2.6/site-packages/spawning/spawning_controller.py", line 211, in handle_deadlychild
        self.log.debug('A child intends to die, starting replacement before it dies')
    File "/usr/local/lib/python2.6/logging/__init__.py", line 1044, in debug
        self._log(DEBUG, msg, args, **kwargs)
    File "/usr/local/lib/python2.6/logging/__init__.py", line 1173, in _log
        self.handle(record)
    File "/usr/local/lib/python2.6/logging/__init__.py", line 1183, in handle
        self.callHandlers(record)
    File "/usr/local/lib/python2.6/logging/__init__.py", line 1220, in callHandlers
        hdlr.handle(record)
    File "/usr/local/lib/python2.6/logging/__init__.py", line 677, in handle
        self.acquire()
    File "/usr/local/lib/python2.6/logging/__init__.py", line 628, in acquire
        self.lock.acquire()
    File "/usr/local/lib/python2.6/threading.py", line 123, in acquire
        rc = self.__block.acquire(blocking)
    File "/usr/local/lib/python2.6/site-packages/eventlet/semaphore.py", line 71, in acquire
        hubs.get_hub().switch()
    File "/usr/local/lib/python2.6/site-packages/eventlet/hubs/hub.py", line 162, in switch
        assert cur is not self.greenlet, 'Cannot switch to MAINLOOP from MAINLOOP'
    AssertionError: Cannot switch to MAINLOOP from MAINLOOP

Change-Id: I18a63313279963ba51a18ee221137660be473c8f
2011-03-02 10:08:15 -08:00
R. Tyler Croy ef1bfe5e48 Default to importing simplejson if we can find it (a bit faster)
Change-Id: Ie247fce87521ae2ea415546b32e28bdef280e6ea
2011-03-02 09:55:02 -08:00
R. Tyler Croy e0bb4b35f2 Prepare for 0.9.5 release with an updated changelog
Change-Id: Icc3a0e8d1dabd0f72dea886813a3ae5fd6aca534
2010-10-06 11:11:53 -07:00
Ryan Williams 847e76a471 Controller starts a new batch of children immediately when reloading. This fixes #21
Tweaked css a little bit in the status page after looking at a lot of inactive children.
2010-10-04 14:25:31 -07:00
Ryan Williams 87d03b40ed Rudimentary log file analyzer, intended as much as a library as a command-line tool. 2010-10-04 14:25:31 -07:00
Ryan Williams b8cae31100 A few tweaks to the status page so that we can continue to see child status while the child is finishing up its requests. 2010-10-04 14:25:31 -07:00
Ryan Williams 4d04e6578e Adds status health page to the Spawning controller. This status page
listens on a different port and provides information about the state
of the child processes in HTML and JSON formats.
2010-10-04 14:25:31 -07:00
Ryan Williams d31de6f961 Fixes rtyler/spawning#3, SIGHUP to parent causes it to die under load, when it should be restarting gracefully.
The bug was caused by the os.close() in kill_children, which causes the controller to reuse pipe filenos which causes problems when the children take a while to close.  The solution is to only close the pipe when the child actually exits (which is already in the code).
2010-09-25 16:30:11 -07:00
Steve 'Ashcrow' Milner a4bd03d0cc move coverage to use URLInterceptor and allow both interceptors to be stackable 2010-09-17 23:00:39 -04:00
Steve 'Ashcrow' Milner c0f54fb49a changed util to a module and added /_sysinfo as a possible interceptor 2010-09-17 22:42:24 -04:00
R. Tyler Croy 1cc76a1be2 Prevent negative --threads sizes, disable changing of tpool size for 1-thread as well as 0-threads
Change-Id: I06e8656b9b0e7f248711c701685b52b0458a5846
2010-09-12 17:37:24 -07:00
R. Tyler Croy 03f52026bf When using monkey-patching (--threads=0) prevent the setting the tpool size to zero
This will prevent the ability to use eventlet.tpool or eventlet.db_pool later
on

Thanks to rdw@ for pointing out the issue

Change-Id: I1013dd3df1516dc99db37d8e54ff69a9a964bd2d
2010-09-12 17:00:33 -07:00
R. Tyler Ballance f055eee57a Fix the command name for the readme
Change-Id: I2ced8b40f2367c849327faa8825ab3152b2eba59
2010-08-23 13:59:11 -07:00
R. Tyler Ballance 2e606c9b8b Create the news entries for 0.9.4
Change-Id: I381edec203516e89d3dfd34270b19f81c2c9410d
2010-08-23 13:46:59 -07:00
R. Tyler Ballance 3a8604a839 Use eventlet 0.9.12 which corrects an issue on some 2.6 installs
Change-Id: I5725d1dea484935aa21ac9498171603c36d40c5f
2010-08-23 13:38:30 -07:00
R. Tyler Ballance 04ec7edfaf Bump eventlet dependency
Change-Id: I7394a92601273c9be45a0fe42868a02b87554c2a
2010-08-17 21:57:51 -07:00
R. Tyler Ballance 6c0cbc4f18 Fix pipe leakage courtesy of rdw@
closes issue #13

Change-Id: If482f27c9d37b67b49f4720e1f99e57c7686526b
2010-08-17 21:55:27 -07:00
R. Tyler Ballance d1f734cafa Prevent proxying string returns when using eventlet.tpool
Honestly you probably shouldn't return strings from the wsgi
app but just in case..

Change-Id: Id7a4604645009235961a7f88b0bea72e2eeeb27d
2010-08-17 21:45:50 -07:00
Ryan Williams 1a05c5c701 Improve thread performance by passing through literals directly instead of wrapping them in Proxy objects. 2010-08-14 14:22:25 -07:00
Steve 'Ashcrow' Milner 7f23437038 allow setup.py to be executed 2010-07-18 21:13:26 -04:00
Steve 'Ashcrow' Milner d58a8c2fbd moved version to module so --version can be used 2010-07-18 21:12:54 -04:00
R. Tyler Ballance 1a508cf2bc Re-connect --watch to the child so it will properly die when the reloader sends SIGHUP
Change-Id: I7ed07d5555054da019bd7a367e6c507e50e4c708
2010-07-17 17:05:30 -07:00
R. Tyler Ballance 624c55ff83 Prevent hard-failure if our config doesn't have the 'dev' key
Change-Id: Ia5f7bcad3587c254c0d121d13d8ddcac3a53236d
2010-07-17 16:57:47 -07:00
R. Tyler Ballance 29a2ccaf3f Change --no-backdoor to --backdoor, making backdoor starting optional, not default
This should resolve issue 12

Change-Id: If88cacec33c17186d5135ae3b8b9758f9a709176
2010-07-17 16:44:43 -07:00
Ryan Williams d96e9657b5 Removed ExecuteInThreadpool which fixes #11, and also removes the necessity to have the entire response in memory. This is also more compatible with websockets. 2010-07-08 13:27:30 -07:00
Donovan Preston ae8d80c173 Hook up the reloader again, this time to the --reload=dev command line option. svn reloader not hooked up at the moment. 2010-06-22 11:31:40 -07:00
Matt Good 535d30b194 Fix crash during SIGHUP, and children launched after KeyboardInterrupt
During kill_children() the parent process can receive SIGUSR1 from the
child process it just terminated. This triggers it to launch a new child
which modifies self.child_pipes in the middle of iteration.

Signed-off-by: R. Tyler Ballance <tyler@monkeypox.org>
2010-05-22 16:15:25 -07:00
R. Tyler Ballance af3a1a80f6 Add a backdoor bound to localhost
Change-Id: Iab22ff0ca35d8a9d7e28ad18b40a9df78905081a
2010-05-02 09:13:35 -07:00
R. Tyler Ballance a2f42ecc39 Bump release candidate
Change-Id: Id6c19488dfb00643a0c9102663a3b00847363dc3
2010-05-02 09:13:35 -07:00
R. Tyler Ballance 9fac09370b Rename spawn -> spawning
http://github.com/rtyler/Spawning/issues#issue/8

Change-Id: Ia2459a9cbdff26a0f74994ed40d46d97fac77270
2010-05-02 09:13:32 -07:00
R. Tyler Ballance 353c023d4f Prune more stale code
Change-Id: I73cf7c5af589e731fb4db56ac18481e7643552ed
2010-04-11 13:19:34 -07:00
R. Tyler Ballance c5845f13da Restructure some of the spawning_controller code
The `watch_memory` function is no longer referenced, moved the controller
code ou into its own function to reduce the indent levels inside of `main()`

Change-Id: Ice650dec754290500219c3cc3bf0997aa5c22fa3
2010-04-11 13:05:04 -07:00
R. Tyler Ballance 271147a4cd Minor import cleanup
Change-Id: I9acfebcd3d7b8eba4888e97b96b46b032b80ad39
2010-04-11 12:56:22 -07:00
R. Tyler Ballance 6e0a3cc088 Use eventlet.patcher instead of eventlet.util for monkey-patching
Change-Id: I31542fa2e77614068a0d36eda9345fd24ef307c1
2010-04-11 12:55:18 -07:00
R. Tyler Ballance 596efb9485 Prevent raising KeyError when calling setproctitle
When using a third party tool, like paster, the "argv_str" key may
not exist.

http://github.com/rtyler/Spawning/issues#issue/2

Change-Id: Ia7953f9c7fc8951d9761ed1c4f72350035cb4c07
2010-04-11 12:06:32 -07:00
R. Tyler Ballance d980e56a56 Add the --make-pidfile argument as Spawning will not dump it's own PID
http://github.com/rtyler/Spawning/issues#issue/7

Change-Id: I03af9e1bed44cf5b680c4239ec1281026cd1abf1
2010-04-11 12:00:15 -07:00
R. Tyler Ballance 3be33e225f Remove the remainder of the deprecated API calls
http://github.com/rtyler/Spawning/issues#issue/6

Change-Id: I005aebfbb90384eff216761771dc2669d31ef856
2010-04-11 11:54:48 -07:00
R. Tyler Ballance 0ea35556d2 Update eventlet calls to reflect recent changes in the eventlet API
Change-Id: Ic0bbb9077880666281037b10741dfb51daac54f2
2010-04-11 02:23:56 -07:00