jester icon indicating copy to clipboard operation
jester copied to clipboard

Jester crashes with SIGSEGV on "Hello, world!" example (Nim 2.2.2, Linux)

Open pubnoconst opened this issue 9 months ago • 1 comments

I'm encountering a crash when running a basic "Hello World" application using the Jester framework. Below is the minimal code that reproduces the issue:

Steps to Reproduce

  1. Create a file main.nim with the following content:
import jester

routes:
  get "/":
    resp "Hello, world!"
  1. Run the app:
$ nimble run --threads:on

When I run the application with the following command, it builds successfully but crashes immediately after starting the server:

$ nimble run --threads:on
   Building jesterbed/jesterbed using c backend
      Info: compiling nim package using /home/u1/.nimble/bin/nim
INFO Jester is making jokes at http://0.0.0.0:5000
Starting 24 threads
Listening on port 5000
Traceback (most recent call last)
/home/u1/.nimble/pkgs2/httpbeast-0.4.1-b23e57a401057dcb9b7fae1fb8279a6a2ce1d0b8/httpbeast.nim(83) eventLoop
/home/u1/.choosenim/toolchains/nim-2.2.2/lib/system/orc.nim(46) nimIncRefCyclic
SIGSEGV: Illegal storage access. (Attempt to read from nil?)

Environment

$ nim --version
Nim Compiler Version 2.2.2 [Linux: amd64]
Compiled at 2025-02-06
Copyright (c) 2006-2025 by Andreas Rumpf
git hash: 6c34f62785263ad412f3e4e4bf8d8751d113

However if I choose --mm:markAndSweep it runs perfectly fine.

Has anyone else encountered this issue with Jester and Nim 2.2.2? Could this be related to the httpbeast backend or the threading option? Any guidance on troubleshooting or resolving this crash would be greatly appreciated.

pubnoconst avatar Apr 26 '25 10:04 pubnoconst

@dom96 is not updating Jester and Httpbeast, so they don't support Nim v2.0 even though there are open PR's to do it: dom96/httpbeast#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.

I have forked it with the changes here: https://github.com/ThomasTJdev/jester_fork

ThomasTJdev avatar Apr 26 '25 10:04 ThomasTJdev