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

gc:arc cannot fully support threadpool with FlowVar #13781

Closed
khchen opened this issue Mar 27, 2020 · 6 comments · Fixed by #20804
Closed

gc:arc cannot fully support threadpool with FlowVar #13781

khchen opened this issue Mar 27, 2020 · 6 comments · Fixed by #20804

Comments

@khchen
Copy link
Contributor

khchen commented Mar 27, 2020

Example

import threadpool, os

proc thread(): string =
  os.sleep(1000)
  return "ok"

var fv = spawn thread()
sync()
echo ^fv

Current Output

Error: cannot bind another '=destroy' to: FlowVarObj; previous declaration was constructed here implicitly: d:\nim\lib\pure\concurrency\threadpool.nim(211, 48)

Expected Output

ok

$ nim -v
Nim Compiler Version 1.1.1 [Windows: amd64]
Compiled at 2020-03-27```

@cooldome
Copy link
Member

I do have a fix for this one

@diegomrsantos
Copy link

diegomrsantos commented Nov 9, 2022

Seems there is a regression. Running the same code as reported outputs the following:

Current Output

ok
Traceback (most recent call last)
.choosenim/toolchains/nim-#devel/lib/pure/concurrency/threadpool.nim(216) test
.choosenim/toolchains/nim-#devel/lib/system/orc.nim(486) nimDecRefIsLastCyclicDyn
.choosenim/toolchains/nim-#devel/lib/system/orc.nim(469) rememberCycle
.choosenim/toolchains/nim-#devel/lib/system/orc.nim(147) unregisterCycle
SIGSEGV: Illegal storage access. (Attempt to read from nil?)

Nim Compiler Version 1.7.3 [MacOSX: amd64]
Compiled at 2022-11-09
Copyright (c) 2006-2022 by Andreas Rumpf

git hash: cdb136f
active boot switches: -d:release

@Araq
Copy link
Member

Araq commented Nov 10, 2022

Report it properly. A test program that fails, a new issue, more information, things like that.

@diegomrsantos
Copy link

I can create a new issue if that's better, but I used the same code as initially reported and posted the current output.

@Araq
Copy link
Member

Araq commented Nov 10, 2022

Ah ok.

@Araq Araq reopened this Nov 10, 2022
@ringabout
Copy link
Member

ringabout commented Nov 10, 2022

I can create a new issue if that's better, but I used the same code as initially reported and posted the current output.

Duplicate of #14901

ringabout added a commit that referenced this issue Nov 10, 2022
* add acyclic pragmas to FlowVar

* add testcases
capocasa pushed a commit to capocasa/Nim that referenced this issue Mar 31, 2023
…owVar (nim-lang#20804)

* add acyclic pragmas to FlowVar

* add testcases
bung87 pushed a commit to bung87/Nim that referenced this issue Jul 29, 2023
…owVar (nim-lang#20804)

* add acyclic pragmas to FlowVar

* add testcases
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants