aitjcize / PyTox

Python binding for Project-Tox the skype replacement.
GNU General Public License v3.0
96 stars 29 forks source link

PyTox Segfault - from Ado Matejov's email #51

Closed kitech closed 8 years ago

kitech commented 8 years ago

Hello,

first of all, thank you for fixing new tox api as I've been waiting for it for a few weeks. I'd like to create a simple videocall PyTox bot which woud run under raspbian on raspberrypi. I went through all the steps to install toxcore, libsodium, opencv and pyaudio. Everything went good, but after trying to run example I'm getting Segmentation fault. I'm pasting here log from valgrind which shows where the executed script fails. Do you have any idea how to fix that?

Thanks for the answer

==2609== Memcheck, a memory error detector ==2609== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al. ==2609== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info ==2609== Command: python echo.py ==2609== ==2609== Invalid read of size 4 ==2609== at 0x14B14C: PyObject_Free (in /usr/bin/python2.7) ==2609== Address 0x4b6b010 is 2,392 bytes inside a block of size 2,731 free'd ==2609== at 0x48348B8: free (vg_replace_malloc.c:427) ==2609== by 0x11F94F: PyMarshal_ReadLastObjectFromFile (in /usr/bin/python2.7) ==2609== ==2609== Conditional jump or move depends on uninitialised value(s) ==2609== at 0x14B154: PyObject_Free (in /usr/bin/python2.7) ==2609== ==2609== Use of uninitialised value of size 4 ==2609== at 0x14B164: PyObject_Free (in /usr/bin/python2.7) ==2609== ==2609== Conditional jump or move depends on uninitialised value(s) ==2609== at 0x2E0BC: ??? (in /usr/bin/python2.7) ==2609== ==2609== Use of uninitialised value of size 4 ==2609== at 0x2E0C8: ??? (in /usr/bin/python2.7) ==2609== ==2609== Invalid read of size 4 ==2609== at 0x2E0B4: ??? (in /usr/bin/python2.7) ==2609== Address 0x4dd3010 is 32 bytes inside a block of size 384 free'd ==2609== at 0x48348B8: free (vg_replace_malloc.c:427) ==2609== by 0x28A1F: ??? (in /usr/bin/python2.7) ==2609== ==2609== Invalid read of size 1 ==2609== at 0x483646C: strlen (mc_replace_strmem.c:390) ==2609== by 0x180D9F: PyString_FromString (in /usr/bin/python2.7) ==2609== Address 0x1f is not stack'd, malloc'd or (recently) free'd ==2609== ==2609== ==2609== Process terminating with default action of signal 11 (SIGSEGV) ==2609== Access not within mapped region at address 0x1F ==2609== at 0x483646C: strlen (mc_replace_strmem.c:390) ==2609== by 0x180D9F: PyString_FromString (in /usr/bin/python2.7) ==2609== If you believe this happened as a result of a stack ==2609== overflow in your program's main thread (unlikely but ==2609== possible), you can try to increase the size of the ==2609== main thread stack using the --main-stacksize= flag. ==2609== The main thread stack size used in this run was 8388608. ==2609== ==2609== HEAP SUMMARY: ==2609== in use at exit: 1,666,390 bytes in 730 blocks ==2609== total heap usage: 3,448 allocs, 2,718 frees, 3,511,107 bytes allocated ==2609== ==2609== LEAK SUMMARY: ==2609== definitely lost: 0 bytes in 0 blocks ==2609== indirectly lost: 0 bytes in 0 blocks ==2609== possibly lost: 35,052 bytes in 96 blocks ==2609== still reachable: 1,631,338 bytes in 634 blocks ==2609== suppressed: 0 bytes in 0 blocks ==2609== Rerun with --leak-check=full to see details of leaked memory ==2609== ==2609== For counts of detected and suppressed errors, rerun with: -v ==2609== Use --track-origins=yes to see where uninitialised values come from ==2609== ERROR SUMMARY: 434 errors from 7 contexts (suppressed: 63 from 12)

Adman commented 8 years ago

@kitech Any news on this?

kitech commented 8 years ago

no news. maybe a coredump stack more useful. and not familiar with raspberrypi, so difficult test the problem.

kitech commented 8 years ago

now pytox using toxcore new audio/video api, can someone test lastest version on raspberrypi?

rodolpheh commented 8 years ago

I just tried and get a Segmentation Fault when trying to import the pytox module. See https://github.com/aitjcize/PyTox/issues/9 for the same issue but on a different setup.

I'm using Arch Linux on Raspberry Pi Model B, with : Python 3.5.1 GCC 5.3.0 toxcore 3697-1 from community python-pytox-git 20160122-1 from AUR

rodolpheh commented 8 years ago

Just saw your commit 30 seconds ago. Will try and return to you in one hour max.

kitech commented 8 years ago

en, help test the fix, thanks.

rodolpheh commented 8 years ago

It is working now.

kitech commented 8 years ago

wow, nice. but i need recommit, corret the comment.

rodolpheh commented 8 years ago

No problem, I took the sources from kitech/PyTox for my tests.

kitech commented 8 years ago

now it's be ok. no need more test, no code change.

Adman commented 8 years ago

@kitech would you mind pushing your changes to aitjcize/PyTox repository? Or should I rather grab changes from kitech/PyTox repo?

kitech commented 8 years ago

ok, i will merge the PR if no test faild report.

rodolpheh commented 8 years ago

I don't want to reopen this issue but since people are trying pytox on a raspberry, I wanted to know if any of you had success in using pyaudio for an audio call. I'm using a USB Sound card and can't have a clean sound. With an example from pyaudio, no issue. But when I use pytox, I always get an "errno -9981: input overflowed". The input sound is terribly choppy (just unusable) and the same goes for the output (it's even worse). I tried playing with a lot of parameters, without any luck. I tried increasing or decreasing the sample size, changing the rate and changing the format.

kitech commented 8 years ago

only test on pc. see examples/echo.py, audio works.

or if still has problem, open a new issue, right?

rodolpheh commented 8 years ago

Sorry for the troubles. To me it seems to be a problem with the USB sound card i'm using. When used in a simple example from pytox, audio is perfect. When used with pytox, it gets choppy and unlistenable. I'm using a wifi dongle so the wifi dongle could take all the bandwidth when using it in pytox.

EDIT: conclusions, I don't think it is pytox related

kitech commented 8 years ago

no matter. feel free open new issue if found something.