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

SIGSEGV: Illegal storage access. (Attempt to read from nil?) #227

Open lost22git opened 10 months ago

lost22git commented 10 months ago

WSL2 Debian 12

proc hello*(ctx: Context) {.async.} = resp "

Hello, Prologue!

"

let app = newApp() app.get("/", hello) app.run()

* nimble file

Package

version = "0.1.0" author = "lost22git" description = "A new awesome nimble package" license = "MIT" srcDir = "src" bin = @["test_prologue"]

Dependencies

requires "nim >= 2.0.0", "prologue >= 0.6.4"


* build  and run

```shell
nimble build -d:release
./test_prologue
ahungry commented 10 months ago

I just got the exact same error on Arch using siege for concurrency testing - same nim + prologue versions, and same test code 😆

ahungry commented 10 months ago

I downgraded some deps:

nim = 1.6.0 prologue = 0.5.0

No more error - a prologue downgrade didn't fix the issue, so I'm thinking it's something in the nim 2.0 (I'll try the last non 2.0 version for comparison with the latest prologue possible).

ahungry commented 10 months ago

I also noticed the (per request) DEBUG log does not show on nim 2.0 either - only the boot up message does.

ahungry commented 10 months ago

These versions do not produce the issue:

requires "nim == 1.6.14"
requires "prologue == 0.6.4" 
ahungry commented 10 months ago

https://github.com/nim-lang/Nim/issues?q=is%3Aissue+is%3Aopen+sigsegv+ - looks like a lot of this in 2.0 release usage.

ahungry commented 10 months ago

Maybe helpful to prologue, httpbeast is having a similar issue: https://github.com/nim-lang/Nim/issues/21422

ahungry commented 10 months ago

One stack trace mentioned httpx for me - and if I use -d:usestd, I no longer receive the error (on nim 2.0) - so I'm guessing this is something httpx is doing incorrectly.

ahungry commented 10 months ago

I updated httpx issue here: https://github.com/ringabout/httpx/issues/33 with a link to the httpbeast solution - I think httpx needs to incorporate it from httpbeast HEAD, add a new tag, then include the new tag on prologue.

ringabout commented 10 months ago

Another workaround is to use --mm:refc.