-
-
Notifications
You must be signed in to change notification settings - Fork 29.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tcl test change crashes AIX #66150
Comments
The patch for Issue bpo-21881 causes CPython test_tcl to crash on AIX. $ ./python -m test -v test_tcl
== CPython 3.5.0a0 (default:d1f89eb9ea1e+, Jul 10 2014, 10:21:22) [GCC 4.8.1]
== AIX-1-00F84C0C4C00-powerpc-32bit big-endian
== hash algorithm: siphash24 32bit
== /home/dje/src/cpython/build/test_python_27984522
Testing with flags: sys.flags(debug=0, inspect=0, interactive=0, optimize=0, dont_write_bytecode=0, no_user_site=0, no_site=0, ignore_environment=0, verbose=0, bytes_warning=0, quiet=0, hash_randomization=1, isolated=0)
[1/1] test_tcl
patchlevel = 8.4.7
testCall (test.test_tcl.TclTest) ... ok
testCallException (test.test_tcl.TclTest) ... ok
testCallException2 (test.test_tcl.TclTest) ... ok
testEval (test.test_tcl.TclTest) ... ok
testEvalException (test.test_tcl.TclTest) ... ok
testEvalException2 (test.test_tcl.TclTest) ... ok
testEvalFile (test.test_tcl.TclTest) ... ok
testEvalFileException (test.test_tcl.TclTest) ... ok
testGetVar (test.test_tcl.TclTest) ... ok
testGetVarArray (test.test_tcl.TclTest) ... ok
testGetVarArrayException (test.test_tcl.TclTest) ... ok
testGetVarException (test.test_tcl.TclTest) ... ok
testLoadWithUNC (test.test_tcl.TclTest) ... skipped 'Requires Windows'
testPackageRequireException (test.test_tcl.TclTest) ... ok
testSetVar (test.test_tcl.TclTest) ... ok
testSetVarArray (test.test_tcl.TclTest) ... ok
testUnsetVar (test.test_tcl.TclTest) ... ok
testUnsetVarArray (test.test_tcl.TclTest) ... ok
testUnsetVarException (test.test_tcl.TclTest) ... ok
test_eval_null_in_result (test.test_tcl.TclTest) ... ok
test_evalfile_null_in_result (test.test_tcl.TclTest) ... ok
test_exprboolean (test.test_tcl.TclTest) ... ok
test_exprdouble (test.test_tcl.TclTest) ... ok
test_exprlong (test.test_tcl.TclTest) ... ok
test_exprstring (test.test_tcl.TclTest) ... ok
test_getboolean (test.test_tcl.TclTest) ... ok
test_getdouble (test.test_tcl.TclTest) ... ok
test_getint (test.test_tcl.TclTest) ... ok
test_passing_values (test.test_tcl.TclTest) ... ok
test_split (test.test_tcl.TclTest) ... ok
test_splitlist (test.test_tcl.TclTest) ... ok
test_user_command (test.test_tcl.TclTest) ... Assertion failed: __EX, file Objects/methodobject.c, line 94
Fatal Python error: Aborted Current thread 0x00000001 (most recent call first): |
Is it crashes when comment out "check((), '')"? Is it crashes when comment out two previous checks (for inf and -inf)? |
If I comment out all three tests, it runs. --- a/Lib/test/test_tcl.py Thu Jul 10 01:17:11 2014 -0400
+++ b/Lib/test/test_tcl.py Sat Jul 12 16:59:33 2014 -0700
@@ -455,9 +455,9 @@
check(float('inf'), 'Inf', eq=float_eq)
check(-float('inf'), '-Inf', eq=float_eq)
# XXX NaN representation can be not parsable by float()
- check((), '')
- check((1, (2,), (3, 4), '5 6', ()), '1 2 {3 4} {5 6} {}')
- check([1, [2,], [3, 4], '5 6', []], '1 2 {3 4} {5 6} {}')
+ #check((), '')
+ #check((1, (2,), (3, 4), '5 6', ()), '1 2 {3 4} {5 6} {}')
+ #check([1, [2,], [3, 4], '5 6', []], '1 2 {3 4} {5 6} {}')
def test_splitlist(self):
splitlist = self.interp.tk.splitlist |
Is following test passed?
Is CPython crashes when change signature of testfunc? --- a/Lib/test/test_tcl.py Sat Jul 12 18:26:03 2014 +0300
+++ b/Lib/test/test_tcl.py Sun Jul 13 19:21:55 2014 +0300
@@ -416,7 +416,7 @@
def test_user_command(self):
result = None
- def testfunc(arg):
+ def testfunc(arg=None, *args):
nonlocal result
result = arg
return arg |
That test succeeds.
--- a/Lib/test/test_tcl.py Sat Jul 12 18:26:03 2014 +0300
+++ b/Lib/test/test_tcl.py Sun Jul 13 19:21:55 2014 +0300
@@ -416,7 +416,7 @@
def test_user_command(self):
result = None
- def testfunc(arg):
+ def testfunc(arg=None, *args):
nonlocal result
result = arg
return arg This change does not have any effect on the original failure. The assertion failure and crash continues to occur. |
#5 0x1019bb90 in PyCFunction_Call (func=0x30533b5c, arg=0x305d8ab4, kw=0x0) 94 CHECK_RESULT(res); (gdb) print res |
May be this patch will help. |
No difference with the patch. The problem is not a a malloc() failure. |
New changeset 7de64def6565 by Serhiy Storchaka in branch '2.7': New changeset 31f4cb1fede9 by Serhiy Storchaka in branch '3.4': New changeset de32cd419174 by Serhiy Storchaka in branch 'default': |
Link to log with a crash: http://buildbot.python.org/all/builders/PPC64%20AIX%203.x/builds/2442/steps/test/logs/stdio |
The failing assertion means that the method raised an exception and returned a result, or failed but didn't raised an exception. According to the gdb trace, the function failed (res is NULL). You can display the current exception in gdb using: "print PyErr_Occurred()" (NULL if there is no exception). Please run test_tcl on AIX with attached test_tkinter.patch applied. |
As far as I remember, both res and PyErr_Occurred() were NULL. |
When the failing test is re-enabled, the _tkinter patch produces the following output: test_user_command (test.test_tcl.TclTest) ... Assertion failed: __EX, file /home/dje/src/cpython/Modules/_tkinter.c, line 1277 Current thread 0x00000001 (most recent call first): |
New changeset 9ab404cdcaa1 by Victor Stinner in branch 'default': |
Thanks. I found and fixed a bug in AsObj() for tuple and list. It looks like ckalloc(size) returns NULL if size is 0. Please update Python, compile and run test_tcl to see if you get a MemoryError exception instead of a crash. I just created the issue bpo-22336 which may fix this issue if my analysis was correct. It uses PyMem_Malloc(size) which has a well-defined behaviour when size is 0. |
$ ./python -m test -v test_tcl
== CPython 3.5.0a0 (default:9ab404cdcaa1+, Sep 4 2014, 10:06:33) [GCC 4.8.1]
== AIX-1-00F84C0C4C00-powerpc-32bit big-endian
== hash algorithm: siphash24 32bit
== /home/dje/src/cpython/build/test_python_48694044
Testing with flags: sys.flags(debug=0, inspect=0, interactive=0, optimize=0, dont_write_bytecode=0, no_user_site=0, no_site=0, ignore_environment=0, verbose=0, bytes_warning=0, quiet=0, hash_randomization=1, isolated=0)
[1/1] test_tcl
patchlevel = 8.4.7
testCall (test.test_tcl.TclTest) ... ok
testCallException (test.test_tcl.TclTest) ... ok
testCallException2 (test.test_tcl.TclTest) ... ok
testEval (test.test_tcl.TclTest) ... ok
testEvalException (test.test_tcl.TclTest) ... ok
testEvalException2 (test.test_tcl.TclTest) ... ok
testEvalFile (test.test_tcl.TclTest) ... ok
testEvalFileException (test.test_tcl.TclTest) ... ok
testGetVar (test.test_tcl.TclTest) ... ok
testGetVarArray (test.test_tcl.TclTest) ... ok
testGetVarArrayException (test.test_tcl.TclTest) ... ok
testGetVarException (test.test_tcl.TclTest) ... ok
testLoadWithUNC (test.test_tcl.TclTest) ... skipped 'Requires Windows'
testPackageRequireException (test.test_tcl.TclTest) ... ok
testSetVar (test.test_tcl.TclTest) ... ok
testSetVarArray (test.test_tcl.TclTest) ... ok
testUnsetVar (test.test_tcl.TclTest) ... ok
testUnsetVarArray (test.test_tcl.TclTest) ... ok
testUnsetVarException (test.test_tcl.TclTest) ... ok
test_eval_null_in_result (test.test_tcl.TclTest) ... ok
test_evalfile_null_in_result (test.test_tcl.TclTest) ... ok
test_exprboolean (test.test_tcl.TclTest) ... ok
test_exprdouble (test.test_tcl.TclTest) ... ok
test_exprlong (test.test_tcl.TclTest) ... ok
test_exprstring (test.test_tcl.TclTest) ... ok
test_getboolean (test.test_tcl.TclTest) ... ok
test_getdouble (test.test_tcl.TclTest) ... ok
test_getint (test.test_tcl.TclTest) ... ok
test_passing_values (test.test_tcl.TclTest) ... ok
test_split (test.test_tcl.TclTest) ... ok
test_splitlist (test.test_tcl.TclTest) ... ok
test_user_command (test.test_tcl.TclTest) ... ERROR
testFlattenLen (test.test_tcl.TkinterTest) ... ok
test_huge_string_builtins (test.test_tcl.BigmemTclTest) ... skipped 'needs UINT_MAX < SIZE_MAX'
test_huge_string_call (test.test_tcl.BigmemTclTest) ... skipped 'needs UINT_MAX < SIZE_MAX' ====================================================================== Traceback (most recent call last):
File "/home/dje/src/cpython/Lib/test/test_tcl.py", line 468, in test_user_command
check((), '')
File "/home/dje/src/cpython/Lib/test/test_tcl.py", line 435, in check
r = self.interp.call('testfunc', value)
MemoryError Ran 35 tests in 0.133s FAILED (errors=1, skipped=3) |
Thanks David! Your ouput confirms my analysis. asobj_empty_sequence.patch should fix the test on AIX. I read Tcl source code, Tcl_NewListObj() doesn't use the second parameter if the first parameter (length) is zero. |
The patch can be simpler. And there is yet one similar bug, for unicode strings. |
As Victor noted on IRC, ckalloc() panics and doesn't returns NULL in case of error. We should use attemptckalloc() instead. |
I'm not sure that tkinter_ckallock.patch is correct. Extract of attemptckalloc() manual page: http://linux.die.net/man/3/attemptckalloc It looks like you are fixing two different issues in the same patch: fix AIX and enhance handling of memory allocation failure. Can you please split your patch in two parts? For AIX, adding these two lines for list/tuple should be enough: if (size == 0) |
"I'm not sure that tkinter_ckallock.patch is correct." Oh, when I read my message, I realized that I was not explicit enough. It looks like attemptckalloc() can be called with 0 at some places with tkinter_ckallock.patch. But I didn't check carefully, the patch is maybe correct. |
New changeset ee969a717cb5 by Serhiy Storchaka in branch '2.7': New changeset 1223c882253f by Serhiy Storchaka in branch '3.4': New changeset 499b60b7d067 by Serhiy Storchaka in branch 'default': New changeset d6c7ab5a2065 by Serhiy Storchaka in branch '2.7': New changeset 6a96c28f9474 by Serhiy Storchaka in branch '3.4': New changeset 7b7bae546959 by Serhiy Storchaka in branch 'default': |
Committed these two changes as separate patches. |
Thanks, it's clearer like that. |
test_tcl now pass on AIX: Thanks Serhiy for the fix. |
Thank you Victor for great investigation of this issue. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: