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

sharedtables.withValue causes deadlock on OSX (cf recent CI freezes) #18176

Open
timotheecour opened this issue Jun 4, 2021 · 3 comments
Open

Comments

@timotheecour
Copy link
Member

timotheecour commented Jun 4, 2021

refs #18172 (comment)

Example

when true:
  import std/sharedtables
  var table: SharedTable[string, string]
  init(table)

  table["a"] = "x"
  table["b"] = "y"
  table["c"] = "z"


  table.withValue("a", value):
    value[] = "m"

  table.withValue("d", value):
    discard value
    doAssert false
  do: # if "d" notin table
    table["d"] = "n"

  assert table.mget("a") == "m"
  assert table.mget("d") == "n"

Current Output

hangs, after ^C I get:

Traceback (most recent call last)
/Users/timothee/git_clone/nim/timn/tests/nim/all/t12358.nim(22) t12358
/Users/timothee/git_clone/nim/Nim_devel/lib/pure/collections/sharedtables.nim(57) []=
SIGINT: Interrupted by Ctrl-C.

Expected Output

works

Additional Information

@ringabout
Copy link
Member

The dead locks happened on linux too which is consistent with what it should be.

--threads:off: compiles and runs.
--threads:on: hangs

Works on windows with/without threads options because the locks module uses reentrant mutex on windows.

@timotheecour
Copy link
Member Author

on osx, compilation works fine, and running hangs regardless of --threads:on|off

@timotheecour
Copy link
Member Author

timotheecour commented Jun 5, 2021

ok now I remember I actually looked into related issues a while back:

@ringabout ringabout removed their assignment Sep 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants