{"action":"opened","issue":{"url":"https://api.github.com/repos/akka/akka/issues/18092","labels_url":"https://api.github.com/repos/akka/akka/issues/18092/labels{/name}","comments_url":"https://api.github.com/repos/akka/akka/issues/18092/comments","events_url":"https://api.github.com/repos/akka/akka/issues/18092/events","html_url":"https://github.com/akka/akka/issues/18092","id":98026148,"number":18092,"title":"Akka Streams: .log() requests elements without demand from downstream","user":{"login":"AnIrishDuck","id":289125,"avatar_url":"https://avatars.githubusercontent.com/u/289125?v=3","gravatar_id":"","url":"https://api.github.com/users/AnIrishDuck","html_url":"https://github.com/AnIrishDuck","followers_url":"https://api.github.com/users/AnIrishDuck/followers","following_url":"https://api.github.com/users/AnIrishDuck/following{/other_user}","gists_url":"https://api.github.com/users/AnIrishDuck/gists{/gist_id}","starred_url":"https://api.github.com/users/AnIrishDuck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AnIrishDuck/subscriptions","organizations_url":"https://api.github.com/users/AnIrishDuck/orgs","repos_url":"https://api.github.com/users/AnIrishDuck/repos","events_url":"https://api.github.com/users/AnIrishDuck/events{/privacy}","received_events_url":"https://api.github.com/users/AnIrishDuck/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-07-29T20:47:26Z","updated_at":"2015-07-29T20:47:26Z","closed_at":null,"body":"The following fails:\r\n\r\n```scala\r\nimport org.reactivestreams._\r\n\r\nval count = 4L\r\nvar requested = 0L\r\n\r\nval pub = new Publisher[Long]() {\r\n  override def subscribe(s: Subscriber[_ >: Long]) = s.onSubscribe(new Subscription() {\r\n    def cancel() = { }\r\n    def request(l: Long) = {\r\n      requested += l\r\n      (0L until l).foreach(s.onNext)\r\n    }\r\n  })\r\n}\r\n\r\nval sub = new Subscriber[Long] {\r\n  var sub: Subscription = _\r\n\r\n  var received = 0L\r\n  var donePromise = Promise[Unit]\r\n  var done = donePromise.future\r\n\r\n  override def onSubscribe(s: Subscription) = {\r\n    sub = s\r\n    sub.request(count)\r\n  }\r\n\r\n  override def onError(t: Throwable) = { }\r\n  override def onComplete() = { }\r\n  override def onNext(e: Long) = { received += 1 ; if(received == count) donePromise.success(Unit) }\r\n}\r\n\r\nSource(pub).log(\"MIDDLEMAN\").runWith(Sink(sub))\r\n\r\nAwait.result(sub.done, 1.second)\r\n\r\nrequested ==== count\r\n```\r\n\r\nUnless you remove `.log(\"MIDDLEMAN\")`. It appears that `.log()` will preemptively request elements. This can complicate debugging complex scenarios involving precise `request()` and `cancel()` sequences, as it interrupts the true flow of data."}}