Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Runtime crashes (sometimes) after call to Code.cache_ #2389

Closed
stew opened this issue Sep 8, 2021 · 2 comments
Closed

Runtime crashes (sometimes) after call to Code.cache_ #2389

stew opened this issue Sep 8, 2021 · 2 comments
Assignees

Comments

@stew
Copy link
Member

stew commented Sep 8, 2021

Here's a somewhat minimized example. This will segfault most of the time.

load : '{base.IO, base.Exception} ()
load _ =
  use base.io printLine
  deserialize' : Bytes ->{base.Exception} Code
  deserialize' bs =
    match Code.deserialize bs with
      Right code -> code
      Left text  ->
        base.Exception.raise
          (Failure
            (typeLink DeserializationError) "failed to deserialize code" !Any)
  match Value.deserialize
    0xs00000001030101010140c5d6cb034ceaefe6773629fb46172132d107d1c8ec66f0a724d92aac527202cc036da07eef198403d2d20afdc37e234c302e6a8e022431c74c5370363528365c00010000000000000000000203020001403db141c292f1eb4ca304505f45f981c21a5c46b7cadffa4534b6371001dab1602cc6c77d064986907ecf21199178bd8ca2b9a07e5caff274fe85af13837c08500001010140c5d6cb034ceaefe6773629fb46172132d107d1c8ec66f0a724d92aac527202cc036da07eef198403d2d20afdc37e234c302e6a8e022431c74c5370363528365c0001000000000000000000020304018905000000010201010a01010703093132372e302e302e310a010103030140228c36286c40d6842729b1bd98cc21eac5ce9ec01903895d5f34ded586efb59ff825e6ba1b0b5e4d041292fa6b138d0b878c74d9813cf33bfd5f95c5bf91b51e00010001000a0101070304353330390a0101030301404c25e24fe4418804863b00fe59c92f7c4720e9b011be5b9082d527b75130a8abd3ab9acc7ba1c1841c4b64a80e8c95b2091b83b1fff83152f6c45afa567d50d700010001000b000101010300060003010140520e1ce4951f6d8b8adc44acd52ee8853178b99c7ce3529178663ae0497f3232b10a68f64fa1295bcdb43b71a3f8c1dc961c490451fbafacd37e3502cb87694d00010303010001010a01000701000000000000000a0a0101030300034e61740001000a01000701000000000000000c0a0101030300034e6174000100030100054e61742e2b02020001010a010107030a6164644e756d626572730b00020101030101407c9a11869bf84b18aab5f2c6faff985c527620d7e528e296510bb57211ce174723f46d6efb9d1e9762a98c8dc146e2d8b2bb640b07de5e0cb9ad1c4da1d19fd9000101000a0101030301402991be48f81c23a45acb7285c7a2dc6d040c455cc2cbc16ff3eea02aec1fe0d350c6c947b7b9badcd8ff81bd451664bd7816557da3c11c7c0712bcbb71bf2ecd00010000090401000b0005010103000201000a010107030e676f74206120726573756c743a200b000301010301000a4e61742e746f5465787401010b0004010103010007546578742e2b2b0201000301014062ef75ed3e99f5814c741aa1a597eb9aacd03e36b50aa462fca0216e9371744fbff5888ddddeb5021a6ef28d339266bc8e93810a87de01debd72c2e9d3875383000101000101402991be48f81c23a45acb7285c7a2dc6d040c455cc2cbc16ff3eea02aec1fe0d350c6c947b7b9badcd8ff81bd451664bd7816557da3c11c7c0712bcbb71bf2ecd000100000000000000000000 with
    Left text -> printLine text
    Right a   ->
      use List foldLeft
      use Text ++
      match Value.load a with
        Left terms  ->
          printLine
            (foldLeft (txt t -> txt ++ Term.toText t) "need terms: " terms)
        Right terms ->
          printLine "loaded succesfully"
          terms' = List.map (cases (t, c) -> (t, deserialize' c)) terms
          printLine "deserialized succesfully"
          stillNeeded = cache_ terms'
          printLine "cached successfully"
          printLine
            (foldLeft
              (txt t -> txt ++ " " ++ Term.toText t)
              (   "still need: "
              ++ (Nat.toText (List.size stillNeeded) ++ " terms"))
              stillNeeded)
@stew
Copy link
Member Author

stew commented Sep 8, 2021

I made some changes on this branch to get us this far: https://github.com/unisonweb/unison/compare/trunk...stew:bug/TermDeserialize?expand=1

@ceedubs
Copy link
Contributor

ceedubs commented Oct 2, 2021

I'm pretty sure that this was resolved by #2430. Feel free to reopen if I'm wrong.

@ceedubs ceedubs closed this as completed Oct 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants