{"action":"created","issue":{"url":"https://api.github.com/repos/ReactiveX/RxJava/issues/4906","repository_url":"https://api.github.com/repos/ReactiveX/RxJava","labels_url":"https://api.github.com/repos/ReactiveX/RxJava/issues/4906/labels{/name}","comments_url":"https://api.github.com/repos/ReactiveX/RxJava/issues/4906/comments","events_url":"https://api.github.com/repos/ReactiveX/RxJava/issues/4906/events","html_url":"https://github.com/ReactiveX/RxJava/issues/4906","id":193699223,"number":4906,"title":"The order of `doOnSubscribe` changed in RxJava 2 without documentation","user":{"login":"ansman","id":102883,"avatar_url":"https://avatars.githubusercontent.com/u/102883?v=3","gravatar_id":"","url":"https://api.github.com/users/ansman","html_url":"https://github.com/ansman","followers_url":"https://api.github.com/users/ansman/followers","following_url":"https://api.github.com/users/ansman/following{/other_user}","gists_url":"https://api.github.com/users/ansman/gists{/gist_id}","starred_url":"https://api.github.com/users/ansman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ansman/subscriptions","organizations_url":"https://api.github.com/users/ansman/orgs","repos_url":"https://api.github.com/users/ansman/repos","events_url":"https://api.github.com/users/ansman/events{/privacy}","received_events_url":"https://api.github.com/users/ansman/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-12-06T07:10:35Z","updated_at":"2016-12-06T09:06:46Z","closed_at":null,"body":"We noticed one of our tests failing because or an ordering issue with `doOnSubscribe`. In RxJava 1 downstream `doOnSubcribe` would be called before upstream but it's the reverse in RxJava 2.\r\n\r\nHere's a code snippet that showcases the problem:\r\n```java\r\nObservable.empty()\r\n\t.doOnSubscribe(() -> System.out.println(\"RX1 upstream\"))\r\n\t.doOnSubscribe(() -> System.out.println(\"RX1 downstream\"))\r\n\t.subscribe();\r\n```\r\nThis will produce the following log statements:\r\n```\r\nRX1 downstream\r\nRX1 upstream\r\n```\r\nwhile the following snippet:\r\n```java\r\nio.reactivex.Observable.empty()\r\n\t.doOnSubscribe(d -> System.out.println(\"RX2 upstream\"))\r\n\t.doOnSubscribe(d -> System.out.println(\"RX2 downstream\"))\r\n\t.subscribe();\r\n```\r\nproduces the following statement:\r\n```\r\nRX2 upstream\r\nRX2 downstream\r\n```\r\n\r\nIs this an intended change?"},"comment":{"url":"https://api.github.com/repos/ReactiveX/RxJava/issues/comments/265097431","html_url":"https://github.com/ReactiveX/RxJava/issues/4906#issuecomment-265097431","issue_url":"https://api.github.com/repos/ReactiveX/RxJava/issues/4906","id":265097431,"user":{"login":"akarnokd","id":1269832,"avatar_url":"https://avatars.githubusercontent.com/u/1269832?v=3","gravatar_id":"","url":"https://api.github.com/users/akarnokd","html_url":"https://github.com/akarnokd","followers_url":"https://api.github.com/users/akarnokd/followers","following_url":"https://api.github.com/users/akarnokd/following{/other_user}","gists_url":"https://api.github.com/users/akarnokd/gists{/gist_id}","starred_url":"https://api.github.com/users/akarnokd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akarnokd/subscriptions","organizations_url":"https://api.github.com/users/akarnokd/orgs","repos_url":"https://api.github.com/users/akarnokd/repos","events_url":"https://api.github.com/users/akarnokd/events{/privacy}","received_events_url":"https://api.github.com/users/akarnokd/received_events","type":"User","site_admin":false},"created_at":"2016-12-06T09:06:46Z","updated_at":"2016-12-06T09:06:46Z","body":"Yes. The 1.x operator is lift based which executes the downstream operations first. In 2.x, the onSubscribe happens starting from upstream travelling downstream like the onNext events. Why do you have order-dependent doOnSubscribe?"}}
{"actor":{"display_login":"akarnokd"}}