Ticket #29 (closed defect: fixed)

Opened 6 years ago

Last modified 6 years ago

Segfault when importing json on Linux

Reported by: tclarke Owned by:
Priority: major Milestone:
Component: zoo-kernel Version:
Keywords: Cc:


zoo-project svn 229 Ubuntu 11.04 x86_64 with kernel 2.6.38-8 (up-to-date stable patches on ticket submission date) Python 2.7.1+ (r271:86832) from Ubuntu packages

Attached is the zcfg. When foo.py contains:

def Foo(conf,inputs,outputs):

outputsResult?value?=inputsa?value? return 3

everything works fine. When adding: input json to the beginning of the file, zoo returns a SEGFAULT exception. JSON module works fine in standalone python. Execution tested with:

./zoo_loader.cgi "request=execute&service=WPS&version=1&identifier=Foo&DataInputs?=a=foo"

Attachments (2)

Foo.zcfg (786 bytes) - added by tclarke 6 years ago.
finalize.patch (316 bytes) - added by djay 6 years ago.
Remove Py_Finalyze call after executing the Python service function

Download all attachments as: .zip

Change History

Changed 6 years ago by tclarke

Changed 6 years ago by djay

Remove Py_Finalyze call after executing the Python service function

Changed 6 years ago by djay

I tried the same service with a Python 2.6.5 and I don't get any trouble using this service importing json module or not. Nevetheless, it seems to be near to another problem reported by Luca last week about the Python support.

So as a first step, I would like you to test applying the patch I attached here to your source tree to confirm that the issue is well when the call to Py_Finalize occurs. It was the issue reported by Luca.

You can apply the patch using the following command:

patch -p0 < finalize.patch

I also noticed another thing which should not cause trouble about executing your request, I guess (except that the DescribeProcess? request can't validate). You defined input and output using a LiteralData? node but it seems that you should use ComplexData? insteed as you defined mimeType and encoding. Nevertheless, as your service is working here I guess the issue is not comming from here. You can get more information about ZCFG from here.

Hope to get feedbacks from you about applying this patch.

Changed 6 years ago by tclarke

UPDATE: I have some more information about the bug

Run the HelloPy? example to ensure it works Add "import bsddb" to test_service.py "ZOO Kernel failed to process your request receiving signal 11 = SIGSEGV" is back sudo rm /usr/lib/python2.7/bsddb/*.pyc HelloPy? executes without issue sudo python -mcompileall /usr/lib/python2.7/bsddb HelloPy? throws the same exception

Changed 6 years ago by jmckenna

Hi Trevor,

I am wondering if you can duplicate this error on another server. This time change your steps a little (such as not using ubuntu packages)...this will be a good test if it is a problem with the zoo-kernel or if it is limited to just that initial server environment (which does happen).



Changed 6 years ago by tclarke

I tried this on Ubuntu 10.04 LTS with Python 2.6 and did not see a problem. I used the same binary as I did on the broken setup (used symlinks to fool it into using libpython2.6)

I haven't got a second machine with the latest Ubuntu and Python and the older machine is a production machine so I can't install an updated Python right now.

Changed 6 years ago by jmckenna

Can you try an install on a machine without the binary packages?

Changed 6 years ago by jmckenna

meaning: replicate your initial environment by building from source and not using any Ubuntu packages/binaries. This is a great way to test whether it is a problem with a binary build, or a problem with the source.

Changed 6 years ago by djay

I noticed that the ZOO-Kernel avoid to call the Py_Finalize function after running the Python service on MacOS X. After, I removed every Py_DRCREF and Py_XDECREF call from the source code in service_internal_python.c the Py_Finalize call doesn't imply segfault anymore on MacOS X.

Note that on my MacOS X platform I've got a Python 2.7 installed and used per default, so I run ./configure this way to force 2.6 use rather than 2.7 (I did that not because ZOO-Kernel doesn't support Python 2.7 but because I get all my Python packages installed for 2.6 version):

./configure --with-ptyhon --with-pyvers=2.6

You should be able to use the same command on your Linux platform if you need to use Python 2.6 rather than 2.7 from your ZOO-Kernel.

So I would like to ask if you can test this last modifications (rev. 295) on your side and let us know if it solve your issue or not ?

Changed 6 years ago by tclarke

  • status changed from new to closed
  • resolution set to fixed

The problem does not appear to occur any longer with rev 295.

Note: See TracTickets for help on using tickets.


Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png