planety / prologue

Powerful and flexible web framework written in Nim
https://planety.github.io/prologue
Apache License 2.0
1.23k stars 47 forks source link

SIGSEV with --mm:orc and --threads:on #213

Open termermc opened 1 year ago

termermc commented 1 year ago

Descrption

Prologue applications SIGSEV when using ORC with threads enabled.

Test program

import prologue

proc hello*(ctx: Context) {.async.} =
  resp "<h1>Hello, Prologue!</h1>"

let app = newApp(settings = newSettings(debug = false))
app.get("/", hello)
app.run()

Command

nim r -d:release --mm:orc --threads:on src/prologuetest.nim

Steps to reproduce

Command Output

This is the output of running the program, including when I started hitting it with requests:

/t/prologuetest ❯❯❯ nim r -d:release --mm:orc --threads:on src/prologuetest.nim
Hint: used config file '/home/termer/.choosenim/toolchains/nim-1.6.10/config/nim.cfg' [Conf]
Hint: used config file '/home/termer/.choosenim/toolchains/nim-1.6.10/config/config.nims' [Conf]
Hint: used config file '/tmp/prologuetest/config.nims' [Conf]
Hint: gc: orc; threads: on; opt: speed; options: -d:release
19464 lines; 0.019s; 16.555MiB peakmem; proj: /tmp/prologuetest/src/prologuetest.nim; out: /home/termer/.cache/nim/prologuetest_r/prologuetest_2C3ECAC42048EEF172BBC7FB007EB4C0E8841BAD [SuccessX]
Hint: /home/termer/.cache/nim/prologuetest_r/prologuetest_2C3ECAC42048EEF172BBC7FB007EB4C0E8841BAD  [Exec]
SIGSEGV: Illegal storage access. (Attempt to read from nil?)
Error: execution of an external program failed: '/home/termer/.cache/nim/prologuetest_r/prologuetest_2C3ECAC42048EEF172BBC7FB007EB4C0E8841BAD '

Notes

This is not an httpx or httpbeast problem, as running their benchmark programs with the same options and slamming them with concurrent requests does not cause any crashes.

ITwrx commented 6 months ago

Just as another data point: I wrote a website (portfolio type with admin area for adding projects, blog posts, etc) using Prologue a couple years ago, and once deployed, it was crashing with this error, IIRC. I pulled off of nim for a year or so after that due to being burned, and not seeing a suitable alternative.