This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author dmalcolm
Recipients benjamin.peterson, dmalcolm, pitrou, vstinner
Date 2010-10-26.17:50:49
SpamBayes Score 1.3142612e-08
Marked as misclassified No
Message-id <1288115452.7.0.29693282788.issue10195@psf.upfronthosting.co.za>
In-reply-to
Content
Attached is a new approach to doing this, based on "Out-Of-Memory Testing" within http://sqlite.org/testing.html

This reads environment variables, and injects a fault at the given value of "serialno", and (optionally) ongoing failures afterwards.

I used this to find a specific bug in Python/pythonrun.c (fix is the first hunk of the patch): if moduleName is NULL, then Py_DECREF will read through NULL.

Potentially this gives the low-level machinery to support adding SQLite's approach to be added to regrtest.  Doing so would imply running each test many tens of thousands of times, so perhaps we could run "-c pass" to establish at what serialno the interpreter has fully started up, then use that as a starting point when testing other scripts/modules.

I implemented a toy version of this as Lib/test/test_malloc_fault.py, which sits in an infinite loop injecting individual allocation failures when starting up sys.executable as a subprocess.

For low numbers, this throws up segfaults within _Py_ReadyTypes' call to PyType_Ready(&PyType_Type), where PyExc_MemoryError is set but has not yet been initialized (its ob_type is NULL):
        /* this will probably fail since there's no memory and hee,
           hee, we have to instantiate this class
        */

Running this interactively with a large value for PYTHONMALLOCINJECTFAULTSAT leads to an interesting failure mode within PyRun_InteractiveLoopFlags(): every call to PyRun_InteractiveOneFlags immediately returns (the PyUnicode_FromString("stdin") in within PySys_GetObject() fails to allocate memory); this leads to a tight loop sending the total refcount to stderr:
[52812 refs]
[52812 refs]
[52812 refs]
(etc)
History
Date User Action Args
2010-10-26 17:50:52dmalcolmsetrecipients: + dmalcolm, pitrou, vstinner, benjamin.peterson
2010-10-26 17:50:52dmalcolmsetmessageid: <1288115452.7.0.29693282788.issue10195@psf.upfronthosting.co.za>
2010-10-26 17:50:51dmalcolmlinkissue10195 messages
2010-10-26 17:50:50dmalcolmcreate