xpra icon
Bug tracker and wiki

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#251 closed defect (fixed)

server uses 100% CPU with old versions of Python

Reported by: Antoine Martin Owned by:
Priority: critical Milestone: 0.8
Component: server Version: trunk
Keywords: Cc:

Description (last modified by Antoine Martin)

This triggers more often in 0.8.x because we try to launch pulseaudio by default if sound is enabled, but this has nothing to do with sound: you can also trigger this bug with:

xpra start :10 --start-child=ls

'ls' will terminate and send python into a 100% CPU spin.

That's because we register a SIGCHLD handler in order to support the --exit-with-children flag, and this interferes with subprocess.Popen in mysterious ways.

This is a known issue in Python versions 3.0 and 2.6 and older, only versions 2.7 and 3.1 onwards have the fix, more details in this python.org ticket, and in this twisted bug.

All sorts of workarounds are suggested, but none of them seem to work here (at least not without significant code changes - which I am very reluctant to do simply to support broken versions of python):

  • overriding subprocess._cleanup
  • doing the reaping ourselves and calling _handle_exitstatus ourselves

etc..

Note: this is not the same as the 100% cpu bug in pygtk which you can find here and here, and also not the same as this other 100% cpu bug (although this one probably shared the same underlying cause).

Change History (2)

comment:1 Changed 6 years ago by Antoine Martin

Resolution: fixed
Status: newclosed

r2683 cleans up this mess: if you use a buggy Python version and --exit-with-children then you will end up using polling, all other cases end up with cleaner/better code.

We will not be held hostage by already fixed bugs!

comment:2 Changed 6 years ago by Antoine Martin

Description: modified (diff)
Note: See TracTickets for help on using tickets.