Skip to content

Lwt.npick is broken #340

Closed
Closed

Description

@aantron

It seems that trying to resolve Lwt.npick, when the argument promises are initially pending, results in a promise that fails with Lwt.Canceled:

open Lwt.Infix

let () =
  let p1, r = Lwt.task () in
  let p2, _ = Lwt.task () in

  let p3 = Lwt.npick [p1; p2] in
  assert (Lwt.state p3 = Lwt.Sleep);

  Lwt.wakeup r ();

  (* Expected: *)
  (* assert (Lwt.state p3 = Lwt.Return [()]) *)

  (* Actual: *)
  assert (Lwt.state p3 = Lwt.Fail Lwt.Canceled);

(* ocamlfind opt -linkpkg -package lwt npick.ml && ./a.out *)

By comparison, if you replace npick with nchoose, you get the Expected behavior.

Since nobody has complained about this, I guess nobody is actually using npick with pending promises :)

Activity

  1. added this to the 3.1.0 milestone on Apr 30, 2017
  2. aantron commented on May 30, 2017

    @aantron
    CollaboratorAuthor

    Probably best fixed after #354 is in.

  3. modified the milestones: 3.1.0, 3.2.0 on Jul 18, 2017
  4. added a commit that references this issue on Oct 16, 2025
    0d5502f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions