-
Notifications
You must be signed in to change notification settings - Fork 154
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
compiling a file gives error: *** Error in `pyconcrete': corrupted double-linked list #31
Comments
How do you compile the
pyconcrete-admin.py is script and it will use default python |
Looks like this is not Python version problem (I checked my version and that is always 2.7.12).
|
@SashaAVCO |
Yes, I have python3 (
) |
What is your default python? |
I'll let you know if I understand how exactly to reproduce this bug. Python looks Ok:
|
The problem is around this call:
Maybe related to passing args list, because my Python program being frozen with this call If I remove this call to argparse from my program, then program fails somewhere just before the end with the same error:
|
I added return code check (probably someone may add it to git program too):
Now I see that the program returns Error ("Error run script!\n") just before segfault happens. Also just tested small HelloWorld program (and then small program with just one call to "parser = argparse.ArgumentParser(description='detection process')") and it works Ok from .pye saying "Executed Ok\n", so fails only for my larger with many lines main code script. Unfortunately, the error message itself doesn't say much:
The only ideas I have now is removing different parts of my program until it stops failing (because if running without .pye it doesn't fail and runs Ok, but with .pye fails in the very beggining where parsing cmd args), or just to use other way to run python instead (for example, "exec python prgname.py" instead of "PyEval_EvalCode" or similar). |
Actually I found the way to proper output text of error that happened inside Python by using this code in "src/pyconcrete_exe/pyconcrete_exe.c":
and the output below (so it means that something wrong with memory of global space or with default module import; so probably something with memory of "global = PyDict_New()" or first line of my program "import argparse" failed in some special way, because actually 'argparse' should be defined Ok and works well if without .pye):
|
Actually looks like I found how to fix the problem. Viewing the Python itself: https://github.com/enthought/Python-2.7.3/blob/master/Python/pythonrun.c
If I change src/pyconcrete_exe/pyconcrete_exe.c to similar code (instead of separate initialization of local and global), then everything starts working for my program without errors:
-- so just use the same system calls for execution of program like Python itself does and for some reason it solves the problem then. Could you apply this fix to release or is something wrong with this? |
@SashaAVCO I will spend some time to check it later, but not recently |
I'll try to create Pull request later, but don't know when yet. Also I found that (for unknown reason) my Python program SegFault on exit at "free(content)" point of pyconcrete_exe.c code or at "Py_DECREF(py_plaint_content)" point if I comment "//free(content)" line. The error text on exit if SegFault at "Py_DECREF(py_plaint_content)" point:
At last, I found that this code works for me without any errors (and currently I don't do any crypt/decrypt, so just uses .pyc as .pye):
|
For some reason, the code above didn't work correctly for some simple example
I've upgraded it and both added "file" system var inited to filename, because I need it (now works Ok both for my program and for the example above):
The debug output for the try.py/module.py example looks like:
|
Why this bug closed? The fix of bug that I described above not ready yet (no pull request) and no fixes in source code yet (the fix that you've just commited is regarding memory releasing only, but this bug was about "corrupted double-linked list" during program startup, but not during exit when memory release happens). |
Had you tried the latest code? Please help to give me more reproduce example to fix it in future, thanks |
Ok, I'll try to help with this. Currently I noted one more bug that required new fix (apart from described above fixed that were in my latest paste-code comment). For some reason, this original code (from "src/pyconcrete_exe/pyconcrete_exe.c") didn't work for me with segmentation fault:
For fixing this, I added new func fnDecryptBufferChar(..) that is without Python kind of data/calls and then it works Ok for me. The new version of similar "src/pyconcrete_exe/pyconcrete_exe.c" code:
The new func fnDecryptBufferChar(content, size) is similar to existing fnDecryptBuffer(..) func, but I'm using other crypto lib than OpenAES was (and currently for module decryption being called fnDecryptBuffer(..) the same as before and for main program decryption this new func fnDecryptBufferChar(content, size) ):
After I do more testing of my changes, I'll try to summarize it for you (both creating pull request). |
Here are the modules which are used:
Full error:
*** Error in
pyconcrete': corrupted double-linked list: 0x0000000002014800 ***======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7fc32c33d7e5]
/lib/x86_64-linux-gnu/libc.so.6(+0x80c71)[0x7fc32c346c71]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7fc32c34a53c]
pyconcrete[0x40182a]
pyconcrete[0x4014a4]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7fc32c2e6830]
pyconcrete[0x401529]
======= Memory map: ========
00400000-00407000 r-xp 00000000 103:01 394867 /home/ubuntu/anaconda3/bin/pyconcrete
00606000-00607000 r--p 00006000 103:01 394867 /home/ubuntu/anaconda3/bin/pyconcrete
00607000-00608000 rw-p 00007000 103:01 394867 /home/ubuntu/anaconda3/bin/pyconcrete
01ed4000-0204e000 rw-p 00000000 00:00 0 [heap]
7fc324000000-7fc324021000 rw-p 00000000 00:00 0
7fc324021000-7fc328000000 ---p 00000000 00:00 0
7fc32aff5000-7fc32b00b000 r-xp 00000000 103:01 396802 /lib/x86_64-linux-gnu/libgcc_s.so.1
7fc32b00b000-7fc32b20a000 ---p 00016000 103:01 396802 /lib/x86_64-linux-gnu/libgcc_s.so.1
7fc32b20a000-7fc32b20b000 rw-p 00015000 103:01 396802 /lib/x86_64-linux-gnu/libgcc_s.so.1
7fc32b213000-7fc32b21a000 r-xp 00000000 103:01 545814 /home/ubuntu/anaconda3/lib/python3.5/site-packages/pyconcrete/_pyconcrete.cpython-35m-x86_64-linux-gnu.so
7fc32b21a000-7fc32b419000 ---p 00007000 103:01 545814 /home/ubuntu/anaconda3/lib/python3.5/site-packages/pyconcrete/_pyconcrete.cpython-35m-x86_64-linux-gnu.so
7fc32b419000-7fc32b41a000 r--p 00006000 103:01 545814 /home/ubuntu/anaconda3/lib/python3.5/site-packages/pyconcrete/_pyconcrete.cpython-35m-x86_64-linux-gnu.so
7fc32b41a000-7fc32b41b000 rw-p 00007000 103:01 545814 /home/ubuntu/anaconda3/lib/python3.5/site-packages/pyconcrete/_pyconcrete.cpython-35m-x86_64-linux-gnu.so
7fc32b41b000-7fc32b49b000 rw-p 00000000 00:00 0
7fc32b49b000-7fc32b773000 r--p 00000000 103:01 51155 /usr/lib/locale/locale-archive
7fc32b773000-7fc32b87b000 r-xp 00000000 103:01 399430 /lib/x86_64-linux-gnu/libm-2.23.so
7fc32b87b000-7fc32ba7a000 ---p 00108000 103:01 399430 /lib/x86_64-linux-gnu/libm-2.23.so
7fc32ba7a000-7fc32ba7b000 r--p 00107000 103:01 399430 /lib/x86_64-linux-gnu/libm-2.23.so
7fc32ba7b000-7fc32ba7c000 rw-p 00108000 103:01 399430 /lib/x86_64-linux-gnu/libm-2.23.so
7fc32ba7c000-7fc32ba7e000 r-xp 00000000 103:01 401388 /lib/x86_64-linux-gnu/libutil-2.23.so
7fc32ba7e000-7fc32bc7d000 ---p 00002000 103:01 401388 /lib/x86_64-linux-gnu/libutil-2.23.so
7fc32bc7d000-7fc32bc7e000 r--p 00001000 103:01 401388 /lib/x86_64-linux-gnu/libutil-2.23.so
7fc32bc7e000-7fc32bc7f000 rw-p 00002000 103:01 401388 /lib/x86_64-linux-gnu/libutil-2.23.so
7fc32bc7f000-7fc32bc82000 r-xp 00000000 103:01 401383 /lib/x86_64-linux-gnu/libdl-2.23.so
7fc32bc82000-7fc32be81000 ---p 00003000 103:01 401383 /lib/x86_64-linux-gnu/libdl-2.23.so
7fc32be81000-7fc32be82000 r--p 00002000 103:01 401383 /lib/x86_64-linux-gnu/libdl-2.23.so
7fc32be82000-7fc32be83000 rw-p 00003000 103:01 401383 /lib/x86_64-linux-gnu/libdl-2.23.so
7fc32be83000-7fc32be9c000 r-xp 00000000 103:01 396873 /lib/x86_64-linux-gnu/libz.so.1.2.8
7fc32be9c000-7fc32c09b000 ---p 00019000 103:01 396873 /lib/x86_64-linux-gnu/libz.so.1.2.8
7fc32c09b000-7fc32c09c000 r--p 00018000 103:01 396873 /lib/x86_64-linux-gnu/libz.so.1.2.8
7fc32c09c000-7fc32c09d000 rw-p 00019000 103:01 396873 /lib/x86_64-linux-gnu/libz.so.1.2.8
7fc32c09d000-7fc32c0c3000 r-xp 00000000 103:01 395910 /lib/x86_64-linux-gnu/libexpat.so.1.6.0
7fc32c0c3000-7fc32c2c3000 ---p 00026000 103:01 395910 /lib/x86_64-linux-gnu/libexpat.so.1.6.0
7fc32c2c3000-7fc32c2c5000 r--p 00026000 103:01 395910 /lib/x86_64-linux-gnu/libexpat.so.1.6.0
7fc32c2c5000-7fc32c2c6000 rw-p 00028000 103:01 395910 /lib/x86_64-linux-gnu/libexpat.so.1.6.0
7fc32c2c6000-7fc32c486000 r-xp 00000000 103:01 401381 /lib/x86_64-linux-gnu/libc-2.23.so
7fc32c486000-7fc32c686000 ---p 001c0000 103:01 401381 /lib/x86_64-linux-gnu/libc-2.23.so
7fc32c686000-7fc32c68a000 r--p 001c0000 103:01 401381 /lib/x86_64-linux-gnu/libc-2.23.so
7fc32c68a000-7fc32c68c000 rw-p 001c4000 103:01 401381 /lib/x86_64-linux-gnu/libc-2.23.so
7fc32c68c000-7fc32c690000 rw-p 00000000 00:00 0
7fc32c690000-7fc32c6a8000 r-xp 00000000 103:01 401380 /lib/x86_64-linux-gnu/libpthread-2.23.so
7fc32c6a8000-7fc32c8a7000 ---p 00018000 103:01 401380 /lib/x86_64-linux-gnu/libpthread-2.23.so
7fc32c8a7000-7fc32c8a8000 r--p 00017000 103:01 401380 /lib/x86_64-linux-gnu/libpthread-2.23.so
7fc32c8a8000-7fc32c8a9000 rw-p 00018000 103:01 401380 /lib/x86_64-linux-gnu/libpthread-2.23.so
7fc32c8a9000-7fc32c8ad000 rw-p 00000000 00:00 0
7fc32c8ad000-7fc32cc6b000 r-xp 00000000 103:01 5417 /usr/lib/x86_64-linux-gnu/libpython3.5m.so.1.0
7fc32cc6b000-7fc32ce6a000 ---p 003be000 103:01 5417 /usr/lib/x86_64-linux-gnu/libpython3.5m.so.1.0
7fc32ce6a000-7fc32ce6c000 r--p 003bd000 103:01 5417 /usr/lib/x86_64-linux-gnu/libpython3.5m.so.1.0
7fc32ce6c000-7fc32cf03000 rw-p 003bf000 103:01 5417 /usr/lib/x86_64-linux-gnu/libpython3.5m.so.1.0
7fc32cf03000-7fc32cf34000 rw-p 00000000 00:00 0
7fc32cf34000-7fc32cf5a000 r-xp 00000000 103:01 401379 /lib/x86_64-linux-gnu/ld-2.23.so
7fc32cf5a000-7fc32d152000 rw-p 00000000 00:00 0
7fc32d152000-7fc32d159000 r--s 00000000 103:01 6146 /usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache
7fc32d159000-7fc32d15a000 r--p 00025000 103:01 401379 /lib/x86_64-linux-gnu/ld-2.23.so
7fc32d15a000-7fc32d15b000 rw-p 00026000 103:01 401379 /lib/x86_64-linux-gnu/ld-2.23.so
7fc32d15b000-7fc32d15c000 rw-p 00000000 00:00 0
7ffe42d4a000-7ffe42d6b000 rw-p 00000000 00:00 0 [stack]
7ffe42d9a000-7ffe42d9d000 r--p 00000000 00:00 0 [vvar]
7ffe42d9d000-7ffe42d9f000 r-xp 00000000 00:00 0 [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
Aborted (core dumped)`
The text was updated successfully, but these errors were encountered: