Skip to content

Strange -only --gc:none is stable #3

@KMiNT21

Description

@KMiNT21

I'm not sure if it lib or Nim or I do something wrong, but after many hours I can't find the place...

I simplified my code ~ to this TEST example.
So it runs 250 tasks and from time to time crashed with:
Error: execution of an external program failed: (path)
It stops before line "echo "Finished.""

If I use --gc:none - it works stable every start.
But I can't understand where can be problem with GC ...

...
let files_dir = "some-folder-with-txt-files"
let files_to_process = lc[f | (f <- walkFiles(files_dir & "/*.txt")), string]
...
const my_limit = 250
...
let my_files = files_to_process[0..my_limit-1]

proc process(ch: MsgBox[int], file_path: string) {.routine.} =
    let data = readFile(file_path)
    let s = len(data.splitlines())

echo "Starting.."

for i in 0..my_limit-1:
  pRun process, (boxes[i], my_files[i])
waitAllRoutine()

echo "Finished."

nim c -w:off --hints:off --verbosity:0 --threads:on -r rtest.nim

If I remove waitAllRoutine() - no errors, but if I put sleep(5000) instead to give time for threads - ERROR back again some times. So problem somewhere it threads switching.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions