From: Gregory B. <gn...@it...> - 2006-10-20 19:46:37
|
I'm really struggling with making the 0.37 module work with Python 2.5. I'm getting some SIGSEGVs buried deep in the Python core, usually in the realloc/free calls, in all sorts of internal Python objects (e.g. PyList_Append(), PyDict_SetItem() etc) that really orta be very well tested and debugged! If I configure Python with either --with-pydebug or --without--pymalloc options (i.e. Changing the way objects/mallocs work) then the resulting Python version works fine with the Sybase module. SunPro or GCC compiled, both fail. Python 2.4.4 works fine with no special config options. All of which is telling me something is corrupting heap memory. Some notes in the 2.5 release notes indicate the memory mgmt for C extensions has been altered but as far as I can see, the sybase module doesn't use tiehr the PyMem_Malloc or PyObject_Malloc calls discussed there. Has anyone else succeeded in using the Sybase module with Python 2.5? Sparc / Solaris 10 Sybase 12_5_3 libraries |
From: Andrew M. <an...@ob...> - 2006-10-20 20:22:17
|
>All of which is telling me something is corrupting heap memory. Some notes >in the 2.5 release notes indicate the memory mgmt for C extensions has been >altered but as far as I can see, the sybase module doesn't use tiehr the >PyMem_Malloc or PyObject_Malloc calls discussed there. What makes these failures difficult to debug is that the crash happens away from the source of the corruption, so anything that closes that gap will help isolate the source. In the past, I've used techniques such as a "canary" function that performs a series of randomly sized allocations and then frees them, in the hope that this will trip up on the corruption. I then strategically litter the code with calls to this function. It might also help if the canary function writes a "hard to swallow" pattern, such as 0xA5A5A5A5, to the memory it allocates prior to freeing it. -- Andrew McNamara, Senior Developer, Object Craft http://www.object-craft.com.au/ |
From: Harri P. <har...@tr...> - 2006-10-21 00:38:21
|
T24gRnJpZGF5IDIwIE9jdG9iZXIgMjAwNiAwNToyMiwgQW5kcmV3IE1jTmFtYXJhIHdyb3RlOgo+ ID5BbGwgb2Ygd2hpY2ggaXMgdGVsbGluZyBtZSBzb21ldGhpbmcgaXMgY29ycnVwdGluZyBoZWFw IG1lbW9yeS4gCj4gPiBTb21lIG5vdGVzIGluIHRoZSAyLjUgcmVsZWFzZSBub3RlcyBpbmRpY2F0 ZSB0aGUgbWVtb3J5IG1nbXQgZm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HRoaXMgbWVzc2FnZSBvciBhdHRhY2ht ZW50cyB0aGF0IGRvIG5vdCByZWxhdGUgdG8gdGhlIGJ1c2luZXNzIG9mICBXYWxsIFN0cmVldCBT eXN0ZW1zIGFyZSBuZWl0aGVyIGdpdmVuIG5vciBlbmRvcnNlZCBieSB0aGUgY29tcGFueSBvciBp dHMgRGlyZWN0b3JzLg0KCg== |
From: Gregory B. <gn...@it...> - 2006-10-20 22:47:12
Attachments:
Python25-diffs.bin
|
On 20/10/06 12:46 PM, "Gregory Bond" <gn...@it...> wrote: > I'm really struggling with making the 0.37 module work with Python 2.5. I'm > getting some SIGSEGVs buried deep in the Python core, usually in the > realloc/free calls, in all sorts of internal Python objects (e.g. > PyList_Append(), PyDict_SetItem() etc) that really orta be very well tested > and debugged! > > If I configure Python with either --with-pydebug or --without--pymalloc > options (i.e. Changing the way objects/mallocs work) then the resulting > Python version works fine with the Sybase module. SunPro or GCC compiled, > both fail. > > Python 2.4.4 works fine with no special config options. > > All of which is telling me something is corrupting heap memory. Some notes > in the 2.5 release notes indicate the memory mgmt for C extensions has been > altered but as far as I can see, the sybase module doesn't use tiehr the > PyMem_Malloc or PyObject_Malloc calls discussed there. Found it. (I think..... Still a bit new to the Python extending caper.) The varous *_dealloc() functions in sybasect were using PyMem_DEL() to release memory. Under 2.5, this needs to be PyObject_DEL() as the default 2.5 Python allocator keeps these in separate pools. Patch attached! |