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

Connections to wrong scope due race condition #14

Closed
mdalepiane opened this issue Jun 26, 2014 · 0 comments
Closed

Connections to wrong scope due race condition #14

mdalepiane opened this issue Jun 26, 2014 · 0 comments

Comments

@mdalepiane
Copy link
Contributor

Hello,

I am using Red5 compiled from 343aa92, and I believe I found a bug that result in connections to wrong scopes, due a race condition.

I have a Red5 server with an app called video. When two Flash clients connect at the same time to a scope video/scope1, sometimes one client end up connected to scope video.

I have checked the code and found a possible cause in ScopeResolver class.

In the method resolveScope(IScope root, String path), the root scope is default and the path is video/scope1. In the first iteration of the loop, scope will be set to video for both connections, since scope video was previously created by the app. In the second iteration of the loop, scope.hasChildScope(child) will return false for both connections, and both will try to create the scope scope1. Since the scope.children is concurrent, only one of the connections will succeed, and set it's scope to scope1. The other connection will fail, staying in scope video, and since this is not the root scope the code will not throw a ScopeNotFoundException.

I also tested with the last commit on master, 90add06, and was able to reproduce this bug.

I will submit a pull request with a possible fix for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant