dom96 / jester

A sinatra-like web framework for Nim.
MIT License
1.57k stars 120 forks source link

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

Open mrichman opened 1 month ago

mrichman commented 1 month ago

Trivial example:

example.nim:

import htmlgen
import jester

routes:
  get "/":
    resp h1("Hello world")

example.nimble:

requires "jester >= 0.6.0"
requires "httpbeast >= 0.4.1"

Output:

nim c -r example.nim
Hint: used config file '/usr/local/Cellar/nim/2.0.8/nim/config/nim.cfg' [Conf]
Hint: used config file '/usr/local/Cellar/nim/2.0.8/nim/config/config.nims' [Conf]
...............................................................................................................................................................................
/Users/mrkrchm/.nimble/pkgs2/jester-0.6.0-4834f85e61ae39f6b6acfb74d3bbba62d8779b66/jester.nim(1345, 9) Hint: Asynchronous route: match. [User]
Hint:  [Link]
ld: warning: ignoring duplicate libraries: '-lm'
Hint: mm: orc; threads: on; opt: none (DEBUG BUILD, `-d:release` generates faster code)
83324 lines; 2.729s; 167.797MiB peakmem; proj: /Users/mrkrchm/Projects/Nim/jester/example.nim; out: /Users/mrkrchm/Projects/Nim/jester/example [SuccessX]
Hint: /Users/mrkrchm/Projects/Nim/jester/example [Exec]
INFO Jester is making jokes at http://0.0.0.0:5000
Starting 8 threads
Listening on port 5000
Traceback (most recent call last)
/Users/mrkrchm/.nimble/pkgs2/httpbeast-0.4.1-b23e57a401057dcb9b7fae1fb8279a6a2ce1d0b8/httpbeast.nim(83) eventLoop
/usr/local/Cellar/nim/2.0.8/nim/lib/system/orc.nim(46) nimIncRefCyclic
SIGSEGV: Illegal storage access. (Attempt to read from nil?)
Error: execution of an external program failed: '/Users/mrkrchm/Projects/Nim/jester/example'
ThomasTJdev commented 1 month ago

You might want to have a look at this Jester fork. @dom96 is not updateing Jester and Httpbeast, so they don't support Nim v2.0 even though there are open PR's to do it: https://github.com/dom96/httpbeast/issues/91

I would suggest that you switch to Mummy which is multithreaded webserver, and then use Mummy utils to mimic some of Jester's nice sugar for routes etc.