{"action":"created","issue":{"url":"https://api.github.com/repos/ReactiveX/RxSwift/issues/936","repository_url":"https://api.github.com/repos/ReactiveX/RxSwift","labels_url":"https://api.github.com/repos/ReactiveX/RxSwift/issues/936/labels{/name}","comments_url":"https://api.github.com/repos/ReactiveX/RxSwift/issues/936/comments","events_url":"https://api.github.com/repos/ReactiveX/RxSwift/issues/936/events","html_url":"https://github.com/ReactiveX/RxSwift/issues/936","id":182388237,"number":936,"title":"ConcurrentDispatchQueueScheduler behavior","user":{"login":"pgherveou","id":521091,"avatar_url":"https://avatars.githubusercontent.com/u/521091?v=3","gravatar_id":"","url":"https://api.github.com/users/pgherveou","html_url":"https://github.com/pgherveou","followers_url":"https://api.github.com/users/pgherveou/followers","following_url":"https://api.github.com/users/pgherveou/following{/other_user}","gists_url":"https://api.github.com/users/pgherveou/gists{/gist_id}","starred_url":"https://api.github.com/users/pgherveou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pgherveou/subscriptions","organizations_url":"https://api.github.com/users/pgherveou/orgs","repos_url":"https://api.github.com/users/pgherveou/repos","events_url":"https://api.github.com/users/pgherveou/events{/privacy}","received_events_url":"https://api.github.com/users/pgherveou/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-10-11T22:15:00Z","updated_at":"2016-10-19T18:30:45Z","closed_at":null,"body":"**Short description of the issue**:\r\nOn the latest beta, When using a Concurrent Dispatch Queue, the sequence emit a few times but never complete.\r\n\r\n**Self contained code example that reproduces the issue**:\r\n\r\n```swift\r\nimport Foundation\r\nimport PlaygroundSupport\r\nimport RxSwift\r\n\r\nPlaygroundPage.current.needsIndefiniteExecution = true\r\n\r\nlet queue = DispatchQueue(\r\n  label: \"Test\",\r\n  attributes: .concurrent // commenting this to use a serial queue remove the issue\r\n)\r\n\r\nlet scheduler: SchedulerType = ConcurrentDispatchQueueScheduler(queue: queue)\r\n\r\nfunc makeSequence(label: String, period: RxTimeInterval) -> Observable<Int> {\r\n  return Observable<Int>\r\n    .interval(period, scheduler: scheduler)\r\n\r\n    // note in this simplifed snippet, share is useless\r\n    .shareReplay(1) // commenting this remove the issue,\r\n}\r\n\r\nlet _ = makeSequence(label: \"main\", period: 1.0)\r\n  .flatMapLatest { (index: Int) -> Observable<(Int, Int)> in\r\n    return makeSequence(label: \"nested\", period: 0.2).map { (index, $0) }\r\n  }\r\n  .take(10)\r\n  .mapWithIndex { ($1, $0.0, $0.1) }\r\n  .subscribe(\r\n    onNext: { print(\"\\($0.0) emit (main: v\\($0.1), nested: v\\($0.2))\") },\r\n    onCompleted: { print(\"completed\") }\r\n)\r\n```\r\n\r\n**Xcode version**: \r\n\r\n```\r\n8.0\r\n```\r\n\r\n**Expected outcome**:\r\n\r\nit should print\r\n```\r\n0 emit (main: v0, nested: v0)\r\n1 emit (main: v0, nested: v1)\r\n2 emit (main: v0, nested: v2)\r\n3 emit (main: v0, nested: v3)\r\n4 emit (main: v1, nested: v0)\r\n5 emit (main: v1, nested: v1)\r\n6 emit (main: v1, nested: v2)\r\n7 emit (main: v1, nested: v3)\r\n8 emit (main: v2, nested: v0)\r\n9 emit (main: v2, nested: v1)\r\ncompleted\r\n```\r\n**What actually happens**:\r\nIt prints \r\n```\r\n0 emit (main: v0, nested: v0)\r\n1 emit (main: v0, nested: v1)\r\n2 emit (main: v0, nested: v2)\r\n3 emit (main: v0, nested: v3)\r\n```\r\n\r\n**Installation method**:\r\n  - [x] CocoaPods\r\n  - [ ] Carthage\r\n  - [ ] Git submodules\r\n\r\n**I have multiple versions of Xcode installed**:\r\n  (so we can know if this is a potential cause of your issue)\r\n  - [ ] yes (which ones)\r\n  - [x] no\r\n\r\n**Level of RxSwift knowledge**:\r\n  (this is so we can understand your level of knowledge\r\n    and formulate the response in an appropriate manner)\r\n  - [ ] just starting\r\n  - [x] I have a small code base\r\n  - [ ] I have a significant code base\r\n"},"comment":{"url":"https://api.github.com/repos/ReactiveX/RxSwift/issues/comments/254900696","html_url":"https://github.com/ReactiveX/RxSwift/issues/936#issuecomment-254900696","issue_url":"https://api.github.com/repos/ReactiveX/RxSwift/issues/936","id":254900696,"user":{"login":"kzaher","id":1641148,"avatar_url":"https://avatars.githubusercontent.com/u/1641148?v=3","gravatar_id":"","url":"https://api.github.com/users/kzaher","html_url":"https://github.com/kzaher","followers_url":"https://api.github.com/users/kzaher/followers","following_url":"https://api.github.com/users/kzaher/following{/other_user}","gists_url":"https://api.github.com/users/kzaher/gists{/gist_id}","starred_url":"https://api.github.com/users/kzaher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kzaher/subscriptions","organizations_url":"https://api.github.com/users/kzaher/orgs","repos_url":"https://api.github.com/users/kzaher/repos","events_url":"https://api.github.com/users/kzaher/events{/privacy}","received_events_url":"https://api.github.com/users/kzaher/received_events","type":"User","site_admin":false},"created_at":"2016-10-19T18:30:44Z","updated_at":"2016-10-19T18:30:44Z","body":"Hi @pgherveou,\r\n\r\nI've pushed my attempt to repro this, but I was unable to. The code and unit tests look good too. It seems that maybe you have disposed dispose bag prematurely."}}
{"actor":{"display_login":"kzaher"}}