7

I have a cherrypy app that I've made an exe with pyinstaller. now when I run the exe it loads itself twice into memory. Watching the taskmanager shows the first instance load into about 1k, then a second later a second instance of hte exe loads into about 3k ram. If I close the bigger one both processes die. If I close hte smaller one only that one dies.

Loading the exe with subprocess, if I try to proc.kill(), it only kills the small one leaving the other running in memory. Is this a sideeffect of using cherrypy and pyinstaller together?

d.c
  • 243
  • 3
  • 6

2 Answers2

6

PyInstaller spawns a subprocess during its boot process. This is explained in a section of its manual.

dosaki
  • 113
  • 3
  • 13
Giovanni Bajo
  • 1,337
  • 9
  • 15
  • Hello Giovanni, it's always a pleasure talking to you. I need your support and experience regarding this question : http://stackoverflow.com/questions/14997414/obfuscating-python-bytecode-through-interpreter-mutation/14997695 -- Thanks :) – securecurve Feb 23 '13 at 08:45
  • 2
    The link is broken. – karamazovbros Mar 13 '19 at 17:18
  • I think this might be the new link: https://pyinstaller.readthedocs.io/en/stable/operating-mode.html?highlight=onefile#how-the-one-file-program-works – dosaki Aug 29 '19 at 14:23
1

It would be important to know what version of CherryPy you are using. The 2.x line had an unfortunate design: the autoreloader feature always started a second instance of CherryPy, so the first could respawn the child when it was killed off. That was fixed in version 3 to only use one process. If you are using version 2, turn off the autoreload feature via the config entry:

[global]
autoreload.on = False
fumanchu
  • 14,419
  • 6
  • 31
  • 36