Thanks for your feedback. Initially I saw the 'Bus error' and assumed this
was coming out of the cherrypy 'bus' feature, but its totally unrelated to
that. The 'Bus error' I mentioned is just a plain old hard crash of python
My recursion was blowing past the default stack size settings of python.
Using threading.stack_size and sys.setrecursionlimit, I can get my app to
run for longer, but its all just pointing to the fact that I need to
rethink my basic use of recursion here. I'm going to have a play with
stackless python, it seems to offer a bunch of advantages for what Im
trying to do, including more efficient use of the stack (from what I've
read so far).
Ideally I'd get to a solution where my cherrypy server and python runtime
are totally isolated from terminal errors in my app logic, but thats
probably some way down the track.
On Wednesday, October 17, 2012 11:26:49 PM UTC+11, Sylvain Hellegouarch
> Hi Eddie,
> > wrote:
>> Hi all,
>> I'm quite new to cherrypy, I've been playing around with it over the last
>> few weeks and enjoying the simple and minimal approach taken with the
>> framework. Ive been using it for a small project of mine, which is
>> primarily for running a turn based strategy game engine, and an AI for
>> playing that game.
>> I've run into a problem that Im having trouble investigating further. I'm
>> basically just getting a 'Bus error' message in my console output, and
>> everything dies at that point. The code that runs to produce the failure is
>> a recursive method, and obviously thats not ideal to be running during a
>> request. But my profiling and tracing suggests its only being called ~100
>> times before cherrypy falls over, and its only to a max depth of 2.
> I've never come across a "Bus error" issue like you've had. Could you
> provide more context? What is your app, hence the bus, doing at the point
> where it dies?
>> So ive got a couple of questions that can help me deal with the issue.
>> First of all, I was looking for a nice example of async request handling.
>> The best hints so far are either the BackgroundTask or Monitor documented
>> http://docs.cherrypy.org/stable/refman/process/plugins/index.html#mon... really like to see an example to get my head around how to use these),
>> or the wiki article http://tools.cherrypy.org/wiki/BackgroundTaskQueue.
>> Is this how I should proceed to shift the load of my game AI out of a
>> straight synchronous request handler?
> If you don't mind threads and having everything within your main Python
> process, those are great. If you want something more distributed you could
> look at writing a plugin interfacing celery  or something similar.
> You could get some inspiration from some recipes I wrote .
>  http://celeryproject.org/
> - Sylvain