Plex using 100% of CPU randomly when idle

Hi, since a few week when I go to my computer that is running I find the system very slow, this happened like 4 or 5 times, and is completely random with 1 or 2 weeks in between.

I open task manager and all plugins scripts are using all the CPU.

To be clear, there is no transcoding, there is no external access to plex, im the only user, there is no programmed tasks to do anything with the videos.

I scanned everything with Kaspersky AV and Malwarebytes Antimalware and 0 founds.

Need to close Plex Server and start again to stop using 100% of CPU. When I open the process again, this not happen for a few days or weeks.

Didn’t install any random plugin or anything.

Added to images from Task Manager and Process Explorer

There is no way to tell from these. Next time you see it happen, note the time, then grab the PMS logs.

the times are in the image names.

also there is anything in the logs. the timestamp updates of today only show library updates.
plex media server.log

Jul 10, 2018 13:38:19.388 [20064] INFO - It's been 7201 seconds, so we're starting scheduled library update for section 2 (Series)
Jul 10, 2018 13:38:19.418 [15860] INFO - Notification: Scanning the "Series" section - 
Jul 10, 2018 13:38:31.590 [15860] INFO - Notification: Library scan complete - Extra information may still be downloading from the Internet
Jul 10, 2018 13:58:19.589 [13568] INFO - It's been 7201 seconds, so we're starting scheduled library update for section 1 (Peliculas)
Jul 10, 2018 13:58:19.621 [11976] INFO - Notification: Scanning the "Peliculas" section - 
Jul 10, 2018 13:58:22.849 [11976] INFO - Notification: Library scan complete - Extra information may still be downloading from the Internet
Jul 10, 2018 15:43:20.721 [11868] INFO - It's been 7489 seconds, so we're starting scheduled library update for section 2 (Series)
Jul 10, 2018 15:43:20.738 [13772] INFO - Notification: Scanning the "Series" section - 
Jul 10, 2018 15:43:29.780 [13772] INFO - Notification: Library scan complete - Extra information may still be downloading from the Internet
Jul 10, 2018 16:03:20.970 [16972] INFO - It's been 7499 seconds, so we're starting scheduled library update for section 1 (Peliculas)
Jul 10, 2018 16:03:20.998 [15640] INFO - Notification: Scanning the "Peliculas" section - 
Jul 10, 2018 16:03:29.974 [15640] INFO - Notification: Library scan complete - Extra information may still be downloading from the Internet
Jul 10, 2018 17:48:22.265 [7716] INFO - It's been 7493 seconds, so we're starting scheduled library update for section 2 (Series)
Jul 10, 2018 17:48:22.292 [13500] INFO - Notification: Scanning the "Series" section - 
Jul 10, 2018 17:48:24.908 [13500] INFO - Notification: Library scan complete - Extra information may still be downloading from the Internet
Jul 10, 2018 17:59:59.049 [4072] INFO - Killing EasyAudioEncoder.exe process with pid 4400

plex media scanner.log have nothing only the machine build.

no other log have timestamp of today or yesterday.

any idea? .

The log file excerpt above shows clearly that there are scheduled library updates.
Disable ‘Scan my library periodically’

To make those library updates faster, consider switching to the ‘one subfolder per movie’ strategy. This reduces the number of files which need to get inspected on every library update drastically.

Adhere strictly to the Plex file naming guides, thus reducing the number of ‘unmatched’ items in your libraries.

Put ‘unmatchable items’ (e.g. training videos, sport events) into separate libraries of the type ‘Other Videos’.

scheduled library update has nothing to do with plex randomly start using 100% until restart. library scans last a few seconds and use almost no cpu.

you dont understand that this happen like 1 time per week. is like something on the plexscripthost.exe get fucked and all other plexscripthost processes start doing something that hang at 100% cpu usage.

All those plexscripthost.exe instances are running a different metadata agent. Look at the right side of your first screenshot.
And metadata agents are invoked after a library scan has been performed.
So yes, I am sure it has to do with the library updates.

no its not. seriously. check the log, it say big “Notification: Library scan complete” always after 2 seconds. there is no new media, so there no new things that need to be downloaded.

the hang is for hours in 100% usage until plex is restarted manually.

also a library update every 20 minutes that has nothing new SHOULDN’T hang cpu usage at 100% for hours. so is clearly a bug.

for info the pc is working 24/7 without restart.

You’ll need to provide the logs for us to check them. The excerpt you provided is not enough. You’ll also want to turn on debug logging. If you had that off, the logs won’t include all activities so it will be hard to tell what is happening.

It is possible that there is something running that isn’t behaving, but without the logs its not possible to tell exactly what.

that the only useful log from july 10. there is no new log from all others files that are updated in july 10.

so i need to turn on debug and wait a random week for this to happen?

Unfortunately yes. The logging level is not retroactive.

You can also provide the entire zip file of all the logs using Plex Web. Maybe there is something in there in another log you haven’t looked in.

happen again, this time when watching a movie.

after 1 hour the movie start lagging until it keep loading. go to pc and again there are the plexhostscripts exes using 100% of the cpu (thats why movie lagged).

turned debug on when happen and wait a minutes and build a log file.

SCAN LIBRARY IS DISABLED BY THE WAY I RUN IT MANUALLY.

this is the only debug with timestamp of today. started movie at ~1:10am and lag start at 2:50am~3am.

Jul 16, 2018 00:59:38.707 [13780] INFO - AutoUpdate: no updates available
Jul 16, 2018 01:16:19.347 [14736] WARN - LongPoll: Got error, closing.
Jul 16, 2018 01:17:22.229 [20816] WARN - Sync: local sync directory "C:\Users\Alejandro\AppData\Local\Plex Media Server\Cache\Transcode\Sync+" does not exist
Jul 16, 2018 01:17:30.530 [18684] INFO - Sync: downloaded 0 sync list(s) with 0 sync items(s): 0 new, 0 updated, 0 deleted
Jul 16, 2018 02:52:54.098 [6220] ERROR - EventSource: Retrying in 15 seconds.
Jul 16, 2018 02:53:29.099 [14736] ERROR - EventSource: Retrying in 30 seconds.
Jul 16, 2018 03:09:50.588 [14736] ERROR - EventSource: Retrying in 15 seconds.
Jul 16, 2018 03:12:21.568 [16296] WARN - Transcode runner appears to have died.
Jul 16, 2018 03:12:21.693 [16296] WARN - Timed out waiting for segment.
Jul 16, 2018 03:12:22.708 [20368] ERROR - Transcoder: Failed to delete session directory (boost::filesystem::remove: El sistema no puede encontrar el archivo especificado: "D:\Plex\Transcode\Sessions\plex-transcode-xuzapk2swvam9pnnzg1kecof-8ae8e945-f718-4bc5-924b-a8f73ec67bdd\media-00311.ts")
Jul 16, 2018 03:12:25.233 [15352] ERROR - Failed to delete session directory (boost::filesystem::remove: El sistema no puede encontrar el archivo especificado: "D:\Plex\Transcode\Sessions\plex-transcode-xuzapk2swvam9pnnzg1kecof-8ae8e945-f718-4bc5-924b-a8f73ec67bdd\media-01285.ts")
Jul 16, 2018 03:13:16.675 [9588] WARN - Transcode runner appears to have died.
Jul 16, 2018 03:13:16.792 [9588] WARN - Timed out waiting for segment.
Jul 16, 2018 03:14:28.073 [5552] INFO - AutoUpdate: no updates available
Jul 16, 2018 03:14:40.128 [12388] INFO - AutoUpdate: no updates available
Jul 16, 2018 03:14:56.133 [6220] DEBUG - Completed: [127.0.0.1:53195] 200 PUT /:/prefs?logDebug=1 (8 live) GZIP 178ms 268 bytes (pipelined: 3)
Jul 16, 2018 03:15:10.380 [14736] DEBUG - handleStreamRead code 2: End of file
Jul 16, 2018 03:15:10.387 [6220] DEBUG - Auth: authenticated user 1 as sharkiller
Jul 16, 2018 03:15:10.418 [15088] DEBUG - Request: [127.0.0.1:53195 (Loopback)] GET /player/proxy/poll?deviceClass=pc&protocolVersion=1&protocolCapabilities=timeline%2Cplayback%2Cnavigation%2Cmirror%2Cplayqueues&timeout=1 (6 live) GZIP Signed-in Token (sharkiller)
Jul 16, 2018 03:15:10.418 [15088] DEBUG - Beginning read from two-way stream.
Jul 16, 2018 03:15:30.597 [14736] DEBUG - handleStreamRead code 2: End of file
Jul 16, 2018 03:15:30.602 [6220] DEBUG - Auth: authenticated user 1 as sharkiller
Jul 16, 2018 03:15:30.701 [13708] DEBUG - Request: [127.0.0.1:53690 (Loopback)] GET /player/proxy/poll?deviceClass=pc&protocolVersion=1&protocolCapabilities=timeline%2Cplayback%2Cnavigation%2Cmirror%2Cplayqueues&timeout=1 (6 live) GZIP Signed-in Token (sharkiller)
Jul 16, 2018 03:15:30.704 [13708] DEBUG - Beginning read from two-way stream.
Jul 16, 2018 03:15:50.860 [14736] DEBUG - handleStreamRead code 2: End of file
Jul 16, 2018 03:15:50.866 [6220] DEBUG - Auth: authenticated user 1 as sharkiller
Jul 16, 2018 03:15:50.878 [16728] DEBUG - Request: [127.0.0.1:53886 (Loopback)] GET /player/proxy/poll?deviceClass=pc&protocolVersion=1&protocolCapabilities=timeline%2Cplayback%2Cnavigation%2Cmirror%2Cplayqueues&timeout=1 (6 live) GZIP Signed-in Token (sharkiller)
Jul 16, 2018 03:15:50.878 [16728] DEBUG - Beginning read from two-way stream.
Jul 16, 2018 03:16:10.679 [6220] DEBUG - Auth: authenticated user 1 as sharkiller
Jul 16, 2018 03:16:10.699 [17176] DEBUG - Request: [127.0.0.1:54080 (Loopback)] GET /diagnostics/logs (6 live) GZIP Signed-in Token (sharkiller)
Jul 16, 2018 03:16:10.700 [17176] DEBUG - Diagnostics: Building logfile zip

there is no other log changed of today or after running the movie. no errores. so stop asking for full log.

Still happening? Are you running a VPN
Windscribe maybe? Turn off “Force Close all TCP sockets after connection” in Preferences - Connection. This is an unresolved issue with Plex.

no vpn. but stopped using plex regularly because of this. I only turn on when i need something.

Sorry, didn’t see you posted the above log snippet again.

That doesn’t help. You need to have the debug level enabled before the problem occurs.

If you still want help, you’ll need to provide the proper information. I do see in the above

Jul 16, 2018 03:12:21.568 [16296] WARN - Transcode runner appears to have died.

Followed by 2 lines mentioning 2 different transcode sessions. So it appears that the transcoder was doing something and on 2 different videos too. 1 was probably the video you were watching. Don’t know what the other is. Could be someone else playing a video you didn’t know about. Or based on that timing, it could be the scheduled tasks kicking in and doing something. You can try changing the schedules task window an even later time so it doesn’t interfere with your movie watching.

no its not 2 videos. im the only viewer.

and i remember correctly that the transcode died because of the scriptshost exes going to 100%.

I’m only going by what you provided. It says there was a second transcode session that also failed. This does not necessarily have to be someone watching a video. It could be a sync job, media optimizer, of preview thumbnail generation.

However, if it is the transcoder, it doesn’t match up with your earlier screenshots where it shows the python processes running and not the transcoder. So this is still unknown exactly what is going on. The only way to know, like I said is to leave the debugging logging enabled on your PMS, then the next time you see the problem, grab the PMS logs and maybe a new screenshot of the processes so we can see what executable is involved.

no, there is no optimization enabled, no sync.

you see 2 “transcode error” because in the TV i saw lag, lag more often, then transcode crashed/timeout. (because all cpu is became utilized by scripthost exes)
and I retry to continue the video again with no success (because there is no cpu free to transcode). that why there are 2 transcode errors with 1 minute of delay

the only thing that (i think) is maybe not very compatible is that I have phyton 3.6 installed on “C:\Python36”
and since these scripts are phyton maybe something is conflicting

Ok, so the transcoder timing out and crashing could be a symptom and not a cause.

These scripts should not be running when you are playing a video, so something is going on if these are the cause. Which is why I need to see the logs to find out why they are running. To be clear, this is not normal behavior. The scripthost is the python host that runs the agents and other plugins. These should be in memory but not running under normal circumstances. Only when doing a media scan. Like I said earlier, it could be the scheduled tasks running to update your library, which would trigger these agents to run.

As a test, try refreshing a media library then playback a video from another library. See if you get the same slowdown and crash.

It shouldn’t but it’s possible. Can you try the test I mentioned above? That should recreate the problem if it is.