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

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

Open
lost22git opened this issue Aug 15, 2023 · 9 comments
Open

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

lost22git opened this issue Aug 15, 2023 · 9 comments

Comments

@lost22git
Copy link

  • os

WSL2 Debian 12

  • code
import prologue

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

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
nimble build -d:release
./test_prologue
  • wrk test
ulimt -n 1000000
wrk -c 10000 -d 30s http://localhost:8080
  • error message
DEBUG Prologue is serving at http://0.0.0.0:8080
DEBUG Starting 16 threads
DEBUG Listening on port 8080
SIGSEGV: Illegal storage access. (Attempt to read from nil?)
SIGSEGV: Illegal storage access. (Attempt to read from nil?)
SIGSEGV: Illegal storage access. (Attempt to read from nil?)
SIGSEGV: Illegal storage access. (Attempt to read from nil?)
Segmentation fault
@ahungry
Copy link

ahungry commented Aug 29, 2023

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

@ahungry
Copy link

ahungry commented Aug 29, 2023

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
Copy link

ahungry commented Aug 29, 2023

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

@ahungry
Copy link

ahungry commented Aug 29, 2023

These versions do not produce the issue:

requires "nim == 1.6.14"
requires "prologue == 0.6.4" 

@ahungry
Copy link

ahungry commented Aug 29, 2023

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
Copy link

ahungry commented Aug 29, 2023

Maybe helpful to prologue, httpbeast is having a similar issue: nim-lang/Nim#21422

@ahungry
Copy link

ahungry commented Aug 29, 2023

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
Copy link

ahungry commented Aug 29, 2023

I updated httpx issue here: ringabout/httpx#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
Copy link
Member

Another workaround is to use --mm:refc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants