Closed AritraBanik08 closed 1 year ago
Me too, got this error "SIGSEGV: Illegal storage access. (Attempt to read from nil?)" when trying Nim 2.0.0
Stacktrace
^CTraceback (most recent call last)
jester_ex.nim(5) jester_ex
~/.nimble/pkgs2/jester-0.6.0-4834f85e61ae39f6b6acfb74d3bbba62d8779b66/jester.nim(527) serve
~/.nimble/pkgs2/httpbeast-0.4.1-b23e57a401057dcb9b7fae1fb8279a6a2ce1d0b8/httpbeast.nim(546) run
~/.choosenim/toolchains/nim-2.0.0/lib/pure/asyncdispatch.nim(377) eventLoop
~/.choosenim/toolchains/nim-2.0.0/lib/pure/ioselects/ioselectors_kqueue.nim(467) selectInto
# example.nim
import htmlgen
import jester
routes:
get "/":
resp h1("Hello world")
Nim Compiler Version 2.0.0 [MacOSX: amd64]
Compiled at 2023-08-08
Copyright (c) 2006-2023 by Andreas Rumpf
Try to import std/segfaults
and it working, not sure the error
import htmlgen
import jester
import std/segfaults
routes:
get "/":
resp h1("Hello world")
Result
INFO Jester is making jokes at http://0.0.0.0:5000
Starting 12 threads
Listening on port 5000
httpbeast
This is properbly due to httpbeast https://github.com/dom96/httpbeast/issues/80 / https://github.com/nim-lang/Nim/issues/21422. This should be fixed with PR https://github.com/dom96/httpbeast/pull/89 which besides the startup-proc also implemented an addExitProc()
for the threads.
You can test whether this solution works by cloning the httpbeast repo by manually installing it:
git clone git@github.com:dom96/httpbeast.git
cd httpbeast
nimble install
For jester to use this new PR it requires @dom96 to release a new tag in the httpbeast repo, before jester will use this version of httpbeast.
Temporary solution
You can compile with nim c -d:dev -d:useStdLib -r server.nim
where -d:useStdLib
forces jester to use the standard lib instead of httpbeast.
@ThomasTJdev Thank you ;)
thanks
Reasently I updated to nim version 2.0.0 but all my jester code is not working and is providing the error "Illegal Storage use". It is also showing the error while only creating a "Hello World" page.