plexinc / plex-media-player

Next generation Plex Desktop/Embedded Client
GNU General Public License v2.0
1.16k stars 168 forks source link

Plex Media Player - 2 HTTP API / Windows player issues (1 crash) #964

Open fizzsnob opened 4 years ago

fizzsnob commented 4 years ago

Test environment

PMP Version: 2.56.0.1071 Platform (Windows/macOS/Embedded RPi/Embedded Intel): Windows (10)

Issue 1:

Sending HTTP based media playback commands (play/pause/stop/skip forward/etc...) quickly (100 ms or less) back to back to the PMP app on Windows causes the app to crash/quit. 100 % reproducible on my machine. May be a re-entrancy problem, and thus depend on the speed of the windows player computer HW; I am using a older NUC with limited memory.

Sent quickly enough (must be sent no more than 100 ms apart) back to back, this command should expose the problem:

curl -H "X-Plex-Client-Identifier: RTI" -H "X-Plex-Device-Name: RTI" -H "X-Plex-Product: PlexAPI" -H "X-Plex-Provides: controller" 'http://10.0.1.112:32433/player/playback/pause?type=video&commandID=2'

There is likely a race condition in the command processing code.

Issue 2:

After "subscribing" to updates, at some random time, from both Mac and PC based 2.x PMP players, the updates simply stop being sent. A restart of the PMP app "fixes" the problem. No pattern as to why or when these updates stop being sent.

The subscribe commands look like this:

curl -H "X-Plex-Client-Identifier: RTI" -H "X-Plex-Device-Name: RTI" -H "X-Plex-Product: PlexAPI" -H "X-Plex-Provides: controller" 'http://10.0.1.112:32433/player/timeline/subscribe?protocol=http&port=33052&commandID=5'

fizzsnob commented 4 years ago

looking at the .dmp files, the crash is caused by a NULL pointer exception in the command handling code...

mseeley commented 4 years ago

Hi @fizzsnob are you sending incrementing/unique commandID values on each request?

A look through hits for commandID may turn up more information.

fizzsnob commented 4 years ago

Hi @fizzsnob are you sending incrementing/unique commandID values on each request?

A look through hits for commandID may turn up more information.

On issue 2:

The commandID IS being incremented. We discovered a bug where, on a very rare basis, our code didn't send a 200 response to the update sent from the player. It appears, perhaps by design, that the player stops sending all updates, forever, if it doesn't get a 200 for EVERY update that it sends. It appears that it never times out, and simply hangs/waits.

fizzsnob commented 4 years ago

The first issue is separate and 100% reproducible as well.