[pypy-dev] Memory leaks in Pypy

Maciej Fijalkowski fijall at gmail.com
Thu Jan 30 11:19:08 CET 2014


I can definitely reproduce it, investigating


On Thu, Jan 30, 2014 at 9:23 AM, Ron Reiter <ron.reiter at gmail.com> wrote:

> I've discovered the cause of the leak - Cyclone uses BytesIO instead of
> StringIO.
> Turns out the following code leaks on Pypy only!
>
> from io import BytesIO
> while True: a = BytesIO()
>
> I'm filing a bug right now.
>
>
> On Thu, Jan 23, 2014 at 6:27 PM, Maciej Fijalkowski <fijall at gmail.com>wrote:
>
>> On Thu, Jan 23, 2014 at 2:44 PM, Marko Tasic <mtasic85 at gmail.com> wrote:
>>
>>> Hi Ron,
>>>
>>> Exactly same problem I have discovered yesterday in one of my production
>>> servers running PyPy 2.2.1, Flask==0.10.1, gunicorn==18.0 and tornado==3.2
>>> on ArchLinux updated on daily basis. I do not have more details on this,
>>> but I can say only that POST requests takes at least 10x slower then on
>>> CPython. However, I measured time spent inside method and its 0.01s, and
>>> actual sending of response takes 30s. This is very strange for reason.
>>>
>>> How I can help on this and send you more details?
>>>
>>> Regards,
>>> Marko Tasic
>>>
>>
>> gunicorn is a bit dodge (it's pypy support is not very official), but I
>> can give it a go - please write some sort of reproducible example and we
>> can take it from there.
>>
>>
>>>
>>>
>>> On Wed, Jan 22, 2014 at 2:08 PM, Ron Reiter <ron.reiter at gmail.com>wrote:
>>>
>>>> Something really strange is happening to me. I've stumbled upon a
>>>> memory leak that happens only when answering a POST request using Twisted
>>>> and Pypy.
>>>>
>>>> The problem is described here:
>>>>
>>>>
>>>> http://stackoverflow.com/questions/21063842/using-twisted-cyclone-pypy-to-handle-post-requests-cause-a-memory-leak
>>>>
>>>> It could either be a bug in the Python code that handles the request
>>>> and leaks, a but in Twisted, or in Pypy.
>>>>
>>>> I've been investing the problem for weeks now, with the following
>>>> conclusion:
>>>>
>>>> * CPython does not leak with this code
>>>> * Tornado with Pypy does not leak with this code
>>>> * Answering GET requests instead of POST requests does not leak with
>>>> this code
>>>> * I tried switching GCs, collecting using gc.collect and setting
>>>> PYPY_GC_MAX, those attempts did not help
>>>> * This happens both on Linux and Mac
>>>>
>>>> Insights as to how to debug this are very welcome.
>>>>
>>>> Thanks,
>>>>
>>>> --
>>>>
>>>> Ron Reiter
>>>> [image: Facebook] <http://www.facebook.com/ron.reiter> [image: Twitter]<http://twitter.com/#!/ronreiter> [image:
>>>> LinkedIn]<http://www.linkedin.com/profile/view?id=4436607&locale=en_US&trk=tab_pro>
>>>> Contact me: [image: Skype] ron.reiter
>>>>
>>>> _______________________________________________
>>>> pypy-dev mailing list
>>>> pypy-dev at python.org
>>>> https://mail.python.org/mailman/listinfo/pypy-dev
>>>>
>>>>
>>>
>>> _______________________________________________
>>> pypy-dev mailing list
>>> pypy-dev at python.org
>>> https://mail.python.org/mailman/listinfo/pypy-dev
>>>
>>>
>>
>
>
> --
>
> Ron Reiter
> [image: Facebook] <http://www.facebook.com/ron.reiter> [image: Twitter]<http://twitter.com/#!/ronreiter> [image:
> LinkedIn]<http://www.linkedin.com/profile/view?id=4436607&locale=en_US&trk=tab_pro>
> Contact me: [image: Skype] ron.reiter
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20140130/7eb3b562/attachment-0001.html>


More information about the pypy-dev mailing list