AW: Python Embedding Questions

Gerald Klix Gerald.Klix at klix.ch
Tue Aug 1 11:31:16 EDT 2006


Hi Sean,
perhaps it may help if you try Python 2.4.3 instead of 2.4.2. The release
notes (http://www.python.org/download/releases/2.4.3/NEWS.txt)
mention a lot of fixed bugs, including a segfault, that is similar to yours.
Also all defects, that the folks at coverty (http://scan.coverity.com/)
discovered
with their static analysis tools, were fixed.
 
Some answers:
ad 1) I don't know, I did it twice and had similar problems as you.
ad 2) AFAIK some games embed python, perhaps someone with more experience
can proviode more explanation.
 
HTH,
Gerald

  _____  

Von: python-list-bounces+gerald.klix=klix.ch at python.org
[mailto:python-list-bounces+gerald.klix=klix.ch at python.org] Im Auftrag von
Sean Ryan
Gesendet: Dienstag, 1. August 2006 15:47
An: python-list at python.org
Betreff: Python Embedding Questions


Hi Guys,

I have a couple of questions (and some concerns) about embedded python
within my application.

The application is a multi-threaded relatively complex c++ middleware
Solaris 9 based application.  A decision was made some time ago to provide
some scripting capabilities and python was selected as the scripting
language.  As such,  an interpreter was embedded within the application and
threading was managed using PyEval_SaveThread, PyEval_RestoreThread and
friends.  

The application switches between python and c++ many, many times during the
execution of one business request - typically the flow will be

c++ -> python -> c++ -> python -> c++ -> python etc (roughly 60 - 40 split
in terms of coverage)

Originally python2.2.1 was embedded within the application - we now have a
business case (performance being a primary driver) to move to python2.4(.2).


We are having some stability issues (random core dumps), and in an attempt
to track down the root cause I executed some stress tests under a purify
environment and noticed the following :

Python2.4.2 trips quite a few ABR (array bounds read) and FMR (free memory
read) violations - python2.2.1  less so.
     purify notes the following as the innermost frames for a FMR.
     frame_dealloc  [frameobject.c:76]
     PyEval_EvalCodeEx [ceval.c:2596]
     fast_function  [ceval.c:3161]

Is this a known issue with embedded python?

I can trigger a similar crash with python 2.2.1 in a stress test
environment.

At this stage, I am getting very concerned about our implementation of
embedded python and wondered :

1.  Is our use of python as an embedded language commonplace?  
2.  Does anyone have names of commerical applications that use python in
this way
3.  Are we switching between python and c++ code too frequently (as many as
40 times in the execution of 1 request)
4.  Are there any consultants / contractors that we could engage to aid
debugging our application / implementation.
5.  Are the warnings that purify is raising related to loss of stability in
the application 
6.  Is python the correct choice for an embedded application (I am aware of
the GIL issue)

We need to make a concise decision very quickly regarding our use of python,
and as such would appreciate the community's honest opinion.

Best regards,
Sean





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20060801/1a1f5ead/attachment.html>


More information about the Python-list mailing list