{"action":"created","issue":{"url":"https://api.github.com/repos/typelevel/cats-effect/issues/375","repository_url":"https://api.github.com/repos/typelevel/cats-effect","labels_url":"https://api.github.com/repos/typelevel/cats-effect/issues/375/labels{/name}","comments_url":"https://api.github.com/repos/typelevel/cats-effect/issues/375/comments","events_url":"https://api.github.com/repos/typelevel/cats-effect/issues/375/events","html_url":"https://github.com/typelevel/cats-effect/issues/375","id":363551109,"node_id":"MDU6SXNzdWUzNjM1NTExMDk=","number":375,"title":"ConcurrentLaws.acquireIsNotCancelable unreasonable assumption about Fiber.cancel","user":{"login":"alexandru","id":11753,"node_id":"MDQ6VXNlcjExNzUz","avatar_url":"https://avatars2.githubusercontent.com/u/11753?v=4","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},"labels":[{"id":579526311,"node_id":"MDU6TGFiZWw1Nzk1MjYzMTE=","url":"https://api.github.com/repos/typelevel/cats-effect/labels/bug","name":"bug","color":"ee0701","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/typelevel/cats-effect/milestones/7","html_url":"https://github.com/typelevel/cats-effect/milestone/7","labels_url":"https://api.github.com/repos/typelevel/cats-effect/milestones/7/labels","id":3686864,"node_id":"MDk6TWlsZXN0b25lMzY4Njg2NA==","number":7,"title":"1.1.0","description":null,"creator":{"login":"alexandru","id":11753,"node_id":"MDQ6VXNlcjExNzUz","avatar_url":"https://avatars2.githubusercontent.com/u/11753?v=4","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},"open_issues":1,"closed_issues":0,"state":"open","created_at":"2018-09-25T12:20:23Z","updated_at":"2018-09-25T12:22:50Z","due_on":null,"closed_at":null},"comments":6,"created_at":"2018-09-25T12:22:50Z","updated_at":"2018-09-25T13:06:05Z","closed_at":null,"author_association":"MEMBER","body":"As seen in https://github.com/scalaz/scalaz-zio/pull/267\r\n\r\nWe have this law:\r\n\r\n```scala\r\n  def acquireIsNotCancelable[A](a1: A, a2: A) = {\r\n    val lh =\r\n      for {\r\n        mVar  <- MVar[F].of(a1)\r\n        latch <- Deferred.uncancelable[F, Unit]\r\n        task   = F.bracket(latch.complete(()) *> mVar.put(a2))(_ => F.never[A])(_ => F.unit)\r\n        fiber <- F.start(task)\r\n        _     <- latch.get\r\n        _     <- fiber.cancel\r\n        _     <- contextShift.shift\r\n        _     <- mVar.take\r\n        out   <- mVar.take\r\n      } yield out\r\n\r\n    lh <-> F.pure(a2)\r\n  }\r\n```\r\n\r\nThis law introduces the assumption that `fiber.cancel` doesn't block. In `cats.effect.IO`'s implementation there aren't at that point any finalizers registered so `cats.effect.IO` doesn't block on anything. But ZIO blocks for the completion of that fiber.\r\n\r\nWhich means that we need a fix that forks the `cancel` operation. E.g. we could use `F.start(fiber.cancel)` instead. Maybe even with an extra `contextShift.shift` just to be sure that it is indeed concurrent."},"comment":{"url":"https://api.github.com/repos/typelevel/cats-effect/issues/comments/424335104","html_url":"https://github.com/typelevel/cats-effect/issues/375#issuecomment-424335104","issue_url":"https://api.github.com/repos/typelevel/cats-effect/issues/375","id":424335104,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNDMzNTEwNA==","user":{"login":"SystemFw","id":7769582,"node_id":"MDQ6VXNlcjc3Njk1ODI=","avatar_url":"https://avatars2.githubusercontent.com/u/7769582?v=4","gravatar_id":"","url":"https://api.github.com/users/SystemFw","html_url":"https://github.com/SystemFw","followers_url":"https://api.github.com/users/SystemFw/followers","following_url":"https://api.github.com/users/SystemFw/following{/other_user}","gists_url":"https://api.github.com/users/SystemFw/gists{/gist_id}","starred_url":"https://api.github.com/users/SystemFw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SystemFw/subscriptions","organizations_url":"https://api.github.com/users/SystemFw/orgs","repos_url":"https://api.github.com/users/SystemFw/repos","events_url":"https://api.github.com/users/SystemFw/events{/privacy}","received_events_url":"https://api.github.com/users/SystemFw/received_events","type":"User","site_admin":false},"created_at":"2018-09-25T13:06:05Z","updated_at":"2018-09-25T13:06:05Z","author_association":"COLLABORATOR","body":"> E.g. we could use F.start(fiber.cancel) in\r\n\r\nWasn't this already exposed in another law as well?"}}
{"actor":{"display_login":"SystemFw"}}