cyberkitsune / PSO2Proxy

A protocol proxy for PSO2
GNU Affero General Public License v3.0
46 stars 42 forks source link

[GChat] CPU usage skyrockets when IRC fails to connect #178

Closed belldandu closed 3 years ago

belldandu commented 8 years ago

I don't know what update caused this nor do i think i want to know but. I Started the Proxy on my server 12 hours ago. I come back and log into vultr and see 100% cpu usage and WAY more bandwidth usage then my server has ever had before (like 120GB in a day). I looked at htop and it showed PSO2Proxy is the culprit for the CPU usage. It may just be a side effect of whatever the proxy is doing to use that rediculous amount of gigabytes in just 12 hours or vice versa, But It would be nice if someone could come and look at my server and try to figure out why its doing this. cough ACF or ALAM cough

alama commented 8 years ago

Missing information: OS? Python version? Twised version? Anything installed by PIP? GIT Rev? Any plugin enabled?

WE ARE NOT MIND READER!

You can trigger the profile command to see what function eating the CPU And dumptraceback commans to see the currect stack..

belldandu commented 8 years ago

Oh yeah i was extremely tired when i made this.

OS: Debian Jessie 8.3 Python version: 2.7.9-1 Twister version: 14.0.2-3 Pip list:

touma@Index:~$ pip list
futures (3.0.5)
goslate (1.5.1)
microsofttranslator (0.7)
pip (8.1.0)
requests (2.9.1)
setuptools (5.5.1)
six (1.10.0)
unicodescript (0.8)

GIT rev: 1dd9641a3284bf3cd32ef799ec21ce74089243e6

Plugins enabled: EQ_Notice, Translate, WebAPI, whitelist

Ran the profile command ran dumptraceback

Thread 0x00007fc24210a700:
  File "/usr/lib/python2.7/threading.py", line 340 in wait
  File "/usr/lib/python2.7/Queue.py", line 168 in get
  File "/usr/lib/python2.7/dist-packages/twisted/python/threadpool.py", line 217 in _worker
  File "/usr/lib/python2.7/threading.py", line 763 in run
  File "/usr/lib/python2.7/threading.py", line 810 in __bootstrap_inner
  File "/usr/lib/python2.7/threading.py", line 783 in __bootstrap

Thread 0x00007fc24290b700:
  File "/usr/lib/python2.7/threading.py", line 340 in wait
  File "/usr/lib/python2.7/Queue.py", line 168 in get
  File "/usr/lib/python2.7/dist-packages/twisted/python/threadpool.py", line 217 in _worker
  File "/usr/lib/python2.7/threading.py", line 763 in run
  File "/usr/lib/python2.7/threading.py", line 810 in __bootstrap_inner
  File "/usr/lib/python2.7/threading.py", line 783 in __bootstrap

Thread 0x00007fc243735700:
  File "/usr/lib/python2.7/threading.py", line 340 in wait
  File "/usr/lib/python2.7/Queue.py", line 168 in get
  File "/usr/lib/python2.7/dist-packages/twisted/python/threadpool.py", line 217 in _worker
  File "/usr/lib/python2.7/threading.py", line 763 in run
  File "/usr/lib/python2.7/threading.py", line 810 in __bootstrap_inner
  File "/usr/lib/python2.7/threading.py", line 783 in __bootstrap

Thread 0x00007fc243f36700:
  File "/usr/lib/python2.7/threading.py", line 340 in wait
  File "/usr/lib/python2.7/Queue.py", line 168 in get
  File "/usr/lib/python2.7/dist-packages/twisted/python/threadpool.py", line 217 in _worker
  File "/usr/lib/python2.7/threading.py", line 763 in run
  File "/usr/lib/python2.7/threading.py", line 810 in __bootstrap_inner
  File "/usr/lib/python2.7/threading.py", line 783 in __bootstrap

Current thread 0x00007fc24a0d9700:
  File "/home/touma/PSO2Proxy/proxy/commands.py", line 473 in call_from_console
  File "./PSO2Proxy.py", line 57 in lineReceived
  File "/usr/lib/python2.7/dist-packages/twisted/protocols/basic.py", line 571 in dataReceived
  File "/usr/lib/python2.7/dist-packages/twisted/internet/_posixstdio.py", line 76 in childDataReceived
  File "/usr/lib/python2.7/dist-packages/twisted/internet/process.py", line 260 in dataReceived
  File "/usr/lib/python2.7/dist-packages/twisted/internet/fdesc.py", line 94 in readFromFD
  File "/usr/lib/python2.7/dist-packages/twisted/internet/process.py", line 257 in doRead
  File "/usr/lib/python2.7/dist-packages/twisted/internet/posixbase.py", line 614 in _doReadOrWrite
  File "/usr/lib/python2.7/dist-packages/twisted/python/context.py", line 81 in callWithContext
  File "/usr/lib/python2.7/dist-packages/twisted/python/context.py", line 118 in callWithContext
  File "/usr/lib/python2.7/dist-packages/twisted/python/log.py", line 73 in callWithContext
  File "/usr/lib/python2.7/dist-packages/twisted/python/log.py", line 88 in callWithLogger
  File "/usr/lib/python2.7/dist-packages/twisted/internet/epollreactor.py", line 396 in doPoll
  File "/usr/lib/python2.7/dist-packages/twisted/internet/base.py", line 1204 in mainLoop
  File "/usr/lib/python2.7/dist-packages/twisted/internet/base.py", line 1192 in run
  File "./PSO2Proxy.py", line 132 in main
  File "./PSO2Proxy.py", line 144 in <module>
alama commented 8 years ago

you need to run the profile command again so it will dump the profiling data to a file and turn off the profiling mode

cyberkitsune commented 8 years ago

@kamijoutouma also how many people are on the proxy during these spikes? is this during EQs or other popular events?

alama commented 8 years ago

Also, you may want to turn off the "Translate" plugin, if a user have it on, it will send out the chat to Google/Bing almost everything said will be sent to them webservices

belldandu commented 8 years ago

@cyberkitsune No one is on at all it's a private proxy to which i only have given 2 other people access and they weren't online. No one was using the proxy it was just sitting there.

@alama I use the translate option and they do too we don't have an issue with it. Will do that was wondering why there was no file.

belldandu commented 8 years ago

profile_1458084463.txt There @alama @cyberkitsune

belldandu commented 8 years ago

LMFAO i did not mean to click that

cyberkitsune commented 8 years ago

15403985 23.695 0.000 1873.342 0.000 /home/touma/PSO2Proxy/proxy/plugins/GlobalChat.py:184(clientConnectionFailed)

Does disabling gchat reduce the CPU load?

belldandu commented 8 years ago

Hmm That makes me wonder if the chat it was connecting to is down and sec will check.

belldandu commented 8 years ago

Yep irc.thetechshed.com is down. and yes it does.

Can we like make an exception for when the proxy can't connect so that this weird problem doesn't happen? @cyberkitsune @alama

belldandu commented 8 years ago

Just a heads up after doing a htop -d 2 i noticed that every now and then without the gchat plugin that the cpu usage spontaniously spikes at random intervals between 10-50% only for a second and goes down to 0%. Not sure why because before it never went over 5%.

alama commented 8 years ago

@kamijoutouma does disabled EQ_Notice plugin drop the random spikes? by default, it setup a timer to fire up every 60 seconds (the timer can go off every 60 to 120 seconds) and on player login, it check the player database if the user have the notice plugin enabled, it may spike up CPU time to do that

belldandu commented 8 years ago

Thought i had replied to this and yes.