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 when running a basic jester 0.6.0 server in nim 2.0 on M1 Mac #90

Open
sklarsa opened this issue Aug 13, 2023 · 3 comments
Open

Comments

@sklarsa
Copy link

sklarsa commented Aug 13, 2023

I have a simple file:

import htmlgen
import jester

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

and when I compile, I get the following output:

$ nim c -r --gc:orc src/server
command line(1, 2) Warning: `gc:option` is deprecated; use `mm:option` instead [Deprecated]
Hint: used config file '/Users/steven/.choosenim/toolchains/nim-2.0.0/config/nim.cfg' [Conf]
Hint: used config file '/Users/steven/.choosenim/toolchains/nim-2.0.0/config/config.nims' [Conf]
Hint: mm: orc; threads: on; opt: none (DEBUG BUILD, `-d:release` generates faster code)
10086 lines; 0.027s; 10.484MiB peakmem; proj: /Users/steven/source/github/questdb-partition-manager/src/server; out: /Users/steven/source/github/questdb-partition-manager/src/server [SuccessX]
Hint: /Users/steven/source/github/questdb-partition-manager/src/server [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/steven/.nimble/pkgs/httpbeast-0.4.1/httpbeast.nim(83) eventLoop
/Users/steven/.choosenim/toolchains/nim-2.0.0/lib/system/orc.nim(46) nimIncRefCyclic
SIGSEGV: Illegal storage access. (Attempt to read from nil?)
Error: execution of an external program failed: '/Users/steven/source/github/questdb-partition-manager/src/server'

Nim Info

$ nim -V
Nim Compiler Version 2.0.0 [MacOSX: amd64]
Compiled at 2023-08-13
Copyright (c) 2006-2023 by Andreas Rumpf

active boot switches: -d:release
@louis77
Copy link

louis77 commented Aug 19, 2023

I'm having the same issue:

import jester
import htmlgen

routes:
  get "/":
    resp h1("Guten Morgen")

Running it runs into a SIGSEGV:

% nim c -r src/nimapi.nim
Hint: used config file '/opt/homebrew/Cellar/nim/2.0.0_1/nim/config/nim.cfg' [Conf]
Hint: used config file '/opt/homebrew/Cellar/nim/2.0.0_1/nim/config/config.nims' [Conf]
...............................................................................................................................................................................
/Users/louis/.nimble/pkgs2/jester-0.6.0-4834f85e61ae39f6b6acfb74d3bbba62d8779b66/jester.nim(1345, 9) Hint: Asynchronous route: match. [User]
Hint:  [Link]
Hint: mm: orc; threads: on; opt: none (DEBUG BUILD, `-d:release` generates faster code)
83886 lines; 0.768s; 167.531MiB peakmem; proj: /Users/louis/Git/nimapi/src/nimapi.nim; out: /Users/louis/Git/nimapi/src/nimapi [SuccessX]
Hint: /Users/louis/Git/nimapi/src/nimapi [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/louis/.nimble/pkgs2/httpbeast-0.4.1-b23e57a401057dcb9b7fae1fb8279a6a2ce1d0b8/httpbeast.nim(83) eventLoop
/opt/homebrew/Cellar/nim/2.0.0_1/nim/lib/system/orc.nim(46) nimIncRefCyclic
SIGSEGV: Illegal storage access. (Attempt to read from nil?)
Error: execution of an external program failed: '/Users/louis/Git/nimapi/src/nimapi'

Using Nim:

% nim -v
Nim Compiler Version 2.0.0 [MacOSX: arm64]
Compiled at 2023-08-01
Copyright (c) 2006-2023 by Andreas Rumpf

active boot switches: -d:release -d:nimUseLinenoise

@danny1113
Copy link

Just found a work around:

You can add -d:useStdLib in your nim.cfg,
and jester will use std/asynchttpserver instead of httpbeast.

And it works!

@ThomasTJdev
Copy link
Contributor

@danny1113 - this should also be solved in PR #89 . httpbeast git-tag is not updated yet, so you need to either use #head or manually cloning and installing.

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

4 participants