Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RunTime exception on destroyed player #1423

Closed
tbrixi opened this issue Apr 25, 2018 · 5 comments
Closed

RunTime exception on destroyed player #1423

tbrixi opened this issue Apr 25, 2018 · 5 comments
Labels
status: archived Archived and locked; will not be updated type: bug Something isn't working correctly
Milestone

Comments

@tbrixi
Copy link

tbrixi commented Apr 25, 2018

Have you read the FAQ and checked for duplicate open issues?: yes

What version of Shaka Player are you using?: 2.3.7

Can you reproduce the issue with our latest release version?: yes

Can you reproduce the issue with the latest code from master?: yes

Are you using the demo app or your own custom app?: custom

If custom app, can you reproduce the issue using our demo app?: no

What browser and OS are you using?: Chrome Version 66.0.3359.117 (Official Build) (64-bit)

What are the manifest and license server URIs?:
(NOTE: you can send the URIs to shaka-player-issues@google.com instead, but please use GitHub and the template for the rest)
(NOTE: a copy of the manifest text or an attached manifest will not be enough to reproduce your issue, and we will ask you to send a URI instead)

What did you do?
step to reproduce:

  1. start video playback
  2. block video source url (simulate server not responding)
  3. on error unload and destroy player
    shaka.Player.unload();
    shaka.Player.destroy();
  4. async handleStreamingError is fired when player is already destroyed

What did you expect to happen?
ignore error events when player is destroyed

What actually happened?
RunTime exception TypeError: Cannot read property 'onError' of null;

streaming_engine.js (line 2200):
shaka.media.StreamingEngine.prototype.handleStreamingError_ = function(error) {

this.playerInterface_.onError(error);
where playerInterface_ is null;

this.config_.failureCallback(error);
where config_ is null
}

@theodab
Copy link
Collaborator

theodab commented Apr 30, 2018

It's hard to say what the exact problem is without being able to see your custom app.

One possibility is that... I do notice that, in your repro steps, you say that you called:

shaka.Player.unload();
shaka.Player.destroy();

Is that the exact code? Player.unload and Player.destroy are both asynchronous methods. I'm not sure what kind of behavior there will be if you destroy without waiting to first unload. I tested a little bit, and calling unload and then destroy immediately afterwards does seem to have a chance of causing weird problems.

Could you try something like:

await shaka.Player.unload();
await shaka.Player.destroy();

or, if you don't want to use ES6 syntax:

shaka.Player.unload().then(function() {
  return shaka.Player.destroy();
}).then(function() {
  // Post-shutdown code here
});

@theodab theodab added status: waiting on response Waiting on a response from the reporter(s) of the issue and removed needs triage labels Apr 30, 2018
@joeyparrish joeyparrish added needs triage and removed status: waiting on response Waiting on a response from the reporter(s) of the issue labels Apr 30, 2018
@joeyparrish
Copy link
Member

Although they are both async methods, unload() followed by destroy() without waiting should not cause errors. I'm putting this back in queue to be reproduced by this week's bug cop.

@michellezhuogg
Copy link
Contributor

I tried to reproduce the issue with network throttling, but could not see the exception.
Could you please provide more detailed instructions to reproduce the issue, or some sample code? You may send it to shaka-player-issues@google.com if you prefer to keep it private.

@joeyparrish joeyparrish added status: unable to reproduce Issue could not be reproduced by the team status: waiting on response Waiting on a response from the reporter(s) of the issue labels May 2, 2018
@tbrixi
Copy link
Author

tbrixi commented May 15, 2018

Problem is partly in our implementation when we setting player to null immediately after destroy().
I am able to reproduce problem on "shaka-player\docs\tutorials\basic-usage.md", if I set player to null after destroy();

var player;
...
function onError(error) {
// Log the error.
console.error('Error code', error.code, 'object', error);
player.unload();
player.destroy();
player = null;
}

shaka.js:284 Uncaught (in promise) TypeError: Cannot read property 'onError' of null
at cg. (shaka.js:284)

@shaka-bot shaka-bot removed the status: waiting on response Waiting on a response from the reporter(s) of the issue label May 15, 2018
TheModMaker added a commit that referenced this issue May 15, 2018
This is a partial cherry-pick of
f48f7fd.

Issue #1323
Issue #1423
@TheModMaker
Copy link
Contributor

This was fixed as part of #1323, but that wasn't added to a v2.3.x release. I've pulled the relevant parts of that commit into a cherry-pick onto the v2.3.x branch and it will appear in the v2.3.8 release. This has already been fixed on master.

@TheModMaker TheModMaker added type: bug Something isn't working correctly and removed needs triage status: unable to reproduce Issue could not be reproduced by the team labels May 15, 2018
@joeyparrish joeyparrish added this to the v2.4 milestone May 22, 2018
@shaka-project shaka-project locked and limited conversation to collaborators Jul 14, 2018
@shaka-bot shaka-bot added the status: archived Archived and locked; will not be updated label Apr 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: archived Archived and locked; will not be updated type: bug Something isn't working correctly
Projects
None yet
Development

No branches or pull requests

6 participants