[Twisted-Python] Thread Consumption Problem in Daemon?

Darren Govoni darrenuspto at gmail.com
Mon Nov 19 04:40:20 MST 2018


Hi,
  I am using twisted to run my Flask app via WSGI like so.

twistd --pidfile $PORT/pidfile -l $PORT/logfile  -n web --port tcp:$PORT
--wsgi my.app

Naturally, I have functions representing routes that enter and exit just
fine.

However, I notice the twisted daemon process is :"gathering threads".
Eventually system runs out of them.

 Here's a full status for one twisted server. 504 threads???

Name:   twistd
Umask:  0077
State:  S (sleeping)
Tgid:   54855
Ngid:   35415
Pid:    54855
PPid:   1
TracerPid:      0
Uid:    4052    4052    4052    4052
Gid:    4052    4052    4052    4052
FDSize: 256
Groups: 4052
VmPeak: 34240104 kB
VmSize: 34239336 kB
VmLck:         0 kB
VmPin:         0 kB
VmHWM:   1942708 kB
VmRSS:   1871884 kB
RssAnon:         1834800 kB
RssFile:           37080 kB
RssShmem:              4 kB
VmData: 33310576 kB
VmStk:       284 kB
VmExe:         4 kB
VmLib:    234176 kB
VmPTE:      8876 kB
VmSwap:        0 kB
Threads:        504
SigQ:   1/1546652
SigPnd: 0000000000000000
ShdPnd: 0000000000000000
SigBlk: 0000000000000000
SigIgn: 0000000001001007
SigCgt: 00000001800146e8
CapInh: 0000000000000000
CapPrm: 0000000000000000
CapEff: 0000000000000000
CapBnd: 0000001fffffffff
CapAmb: 0000000000000000
Seccomp:        0
Speculation_Store_Bypass:       thread vulnerable
Cpus_allowed:   ffffff,ffffffff
Cpus_allowed_list:      0-55
Mems_allowed:
 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000003
Mems_allowed_list:      0-1
voluntary_ctxt_switches:        358534596
nonvoluntary_ctxt_switches:     31738
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20181119/f328135d/attachment.html>


More information about the Twisted-Python mailing list