Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • pypy pypy
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 674
    • Issues 674
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 13
    • Merge requests 13
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • PyPyPyPy
  • pypypypy
  • Issues
  • #1833
Closed
Open
Issue created Aug 01, 2014 by Bitbucket Importer@bitbucket_importerMaintainer

PyPy sandbox leaks when writing to stdout

Created originally on Bitbucket by kostialopuhin (Konstantin Lopukhin)

Here is etl.py:

#!python 
import sys

def main():
    for i in xrange(100000):
        sys.stdout.write('%d\n' % i)

if __name__ == '__main__':
    main()

I run it like this:

sandbox $ /usr/bin/time -l ./pypy_interact.py --tmp=. ../goal/pypy-c /tmp/etl.py > /dev/null 
'import site' failed
        6.50 real         5.33 user         1.56 sys
 422952960  maximum resident set size
...

A slighly more complex example (that also reads from stdin) leaks twice as much:

gen.py:

#!python 
import sys

for i in xrange(100000):
    sys.stdout.write('%d\n' % i)

etl.py

#!python 
import sys

def main():
    while True:
        line = sys.stdin.readline()
        if line:
            line = line.strip()
            sys.stdout.write('%d\n' % (int(line) + 1,))
        else:
            break

if __name__ == '__main__':
    main()

Run:

sandbox $ python gen.py | /usr/bin/time -l ./pypy_interact.py --tmp=. ../goal/pypy-c /tmp/etl.py > /dev/null 
'import site' failed
       14.69 real        12.35 user         3.20 sys
 835825664  maximum resident set size

Version was built from 2.3.1 release:

sandbox $ ./pypy_interact.py ../goal/pypy-c
'import site' failed
Python 2.7.6 (32f35069a16d819b58c1b6efb17c44e3e53397b2, Jul 11 2014, 13:35:07)
[PyPy 2.3.1 with GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.38)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>> 
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking