{"action":"created","issue":{"url":"https://api.github.com/repos/monix/monix/issues/374","repository_url":"https://api.github.com/repos/monix/monix","labels_url":"https://api.github.com/repos/monix/monix/issues/374/labels{/name}","comments_url":"https://api.github.com/repos/monix/monix/issues/374/comments","events_url":"https://api.github.com/repos/monix/monix/issues/374/events","html_url":"https://github.com/monix/monix/issues/374","id":234279393,"number":374,"title":"IllegalStateException: State Active(monix.execution.CancelableFuture$Implementation) in the Monix MapTask.onNext implementation is invalid","user":{"login":"kellerkindt","id":1133787,"avatar_url":"https://avatars3.githubusercontent.com/u/1133787?v=3","gravatar_id":"","url":"https://api.github.com/users/kellerkindt","html_url":"https://github.com/kellerkindt","followers_url":"https://api.github.com/users/kellerkindt/followers","following_url":"https://api.github.com/users/kellerkindt/following{/other_user}","gists_url":"https://api.github.com/users/kellerkindt/gists{/gist_id}","starred_url":"https://api.github.com/users/kellerkindt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kellerkindt/subscriptions","organizations_url":"https://api.github.com/users/kellerkindt/orgs","repos_url":"https://api.github.com/users/kellerkindt/repos","events_url":"https://api.github.com/users/kellerkindt/events{/privacy}","received_events_url":"https://api.github.com/users/kellerkindt/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-06-07T17:07:27Z","updated_at":"2017-06-07T19:51:59Z","closed_at":null,"body":"```\r\njava.lang.IllegalStateException: State Active(monix.execution.CancelableFuture$Implementation@b5e279e) in the Monix MapTask.onNext implementation is invalid, please send a bug report! See https://monix.io\r\n\tat monix.reactive.internal.operators.MapTaskObservable$MapAsyncSubscriber.reportInvalidState(MapTaskObservable.scala:291)\r\n\tat monix.reactive.internal.operators.MapTaskObservable$MapAsyncSubscriber.onNext(MapTaskObservable.scala:225)\r\n\tat monix.reactive.internal.operators.MapOperator$$anon$1.onNext(MapOperator.scala:46)\r\n\tat monix.reactive.internal.operators.MapOperator$$anon$1.onNext(MapOperator.scala:46)\r\n\tat monix.reactive.internal.operators.MapTaskObservable$MapAsyncSubscriber$$anonfun$1.apply(MapTaskObservable.scala:130)\r\n\tat monix.reactive.internal.operators.MapTaskObservable$MapAsyncSubscriber$$anonfun$1.apply(MapTaskObservable.scala:128)\r\n\tat monix.eval.internal.Transformation$Fold.success(Transformation.scala:51)\r\n\tat monix.eval.internal.Transformation.apply(Transformation.scala:29)\r\n\tat monix.eval.internal.TaskRunLoop$.liftedTree1$1(TaskRunLoop.scala:193)\r\n\tat monix.eval.internal.TaskRunLoop$.monix$eval$internal$TaskRunLoop$$loop$1(TaskRunLoop.scala:193)\r\n\tat monix.eval.internal.TaskRunLoop$RestartCallback$1.onSuccess(TaskRunLoop.scala:119)\r\n\tat monix.eval.Task$$anonfun$6$$anon$4.run(Task.scala:1463)\r\n\tat java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)\r\n\tat java.util.concurrent.FutureTask.run(FutureTask.java:266)\r\n\tat java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)\r\n\tat java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)\r\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)\r\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)\r\n\tat java.lang.Thread.run(Thread.java:748)\r\n```\r\n\r\nHappened while fiddling around with some test code, so the code itself isn't great at all.\r\nScrapped together what effectively caused it:\r\n```scala\r\nprivate val frameNumberSubject    = PublishToOneSubject[Int]()\r\nval mats : Observable[(Mat, Int)] = frameNumberSubject.share.map(getMat)\r\n\r\nval grayMats: Observable[(Mat, Int)] = mats.map(p => (ToGreyImage(matPool, p._1), p._2))\r\n\r\n\r\nshowMats(mats,     viewCl).subscribe()\r\nshowMats(grayMats, viewGr).subscribe()\r\n\r\ndef showMats(observable: Observable[(Mat, Int)], view: ImageView): Observable[Unit] = {\r\n  observable\r\n    .mapAsync(1)(p => Task{p})\r\n    .map(p => (toBgraMat(p._1), p._2))\r\n    .map(p => (toImage(p._1), p._2))\r\n    .mapAsync(1)(p => \r\n      Task{\r\n        RunInFx{view.setImage(p._1)}\r\n      }\r\n    )\r\n}\r\n```\r\n\r\n```scala\r\n(0 until properties.frames).foreach(number => {\r\n  try {\r\n    capture.frameNumberObserver.onNext(number) match {\r\n      case Continue => Continue\r\n      case Stop => Stop\r\n      case e => {\r\n        logger.warn(\"Whot? \"+e.getClass)\r\n      }\r\n    }\r\n  } catch {\r\n    case e: Throwable => e.printStackTrace()\r\n  }\r\n})\r\n```"},"comment":{"url":"https://api.github.com/repos/monix/monix/issues/comments/306905893","html_url":"https://github.com/monix/monix/issues/374#issuecomment-306905893","issue_url":"https://api.github.com/repos/monix/monix/issues/374","id":306905893,"user":{"login":"alexandru","id":11753,"avatar_url":"https://avatars1.githubusercontent.com/u/11753?v=3","gravatar_id":"","url":"https://api.github.com/users/alexandru","html_url":"https://github.com/alexandru","followers_url":"https://api.github.com/users/alexandru/followers","following_url":"https://api.github.com/users/alexandru/following{/other_user}","gists_url":"https://api.github.com/users/alexandru/gists{/gist_id}","starred_url":"https://api.github.com/users/alexandru/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexandru/subscriptions","organizations_url":"https://api.github.com/users/alexandru/orgs","repos_url":"https://api.github.com/users/alexandru/repos","events_url":"https://api.github.com/users/alexandru/events{/privacy}","received_events_url":"https://api.github.com/users/alexandru/received_events","type":"User","site_admin":false},"created_at":"2017-06-07T19:51:59Z","updated_at":"2017-06-07T19:51:59Z","body":"Most commonly this error happens whenever you're not respecting the back-pressure protocol, as described at: https://monix.io/docs/2x/reactive/observers.html\r\n\r\nI see a `PublishToOneSubject` being initialized, but I don't see any buffering, or any back-pressuring when you're doing `frameNumberObserver.onNext`."}}
{"actor":{"display_login":"alexandru"}}