-
Notifications
You must be signed in to change notification settings - Fork 50
Open
Description
This minimal code should reproduce the issue.
# hello.nim
import options, asyncdispatch, logging
import httpbeast
proc onRequest(req: Request): Future[void] =
if req.httpMethod == some(HttpGet):
case req.path.get()
of "/":
req.send("Hello World")
else:
req.send(Http404)
if logging.getHandlers().len == 0:
addHandler(logging.newConsoleLogger())
setLogFilter(when defined(release): lvlInfo else: lvlDebug)
run(onRequest, httpbeast.initSettings(numThreads=2))nim c -r --gc:orc -d:releae --threads:on hello.nim- Nim version
1.6.8 - httpbeast version
0.4.1 - Run inside docker image
nimlang/nim(also tried with WSL2 and GCP debian instance)
When running and killing the binary multiple times, the program sometimes runs but most of the times it gives this error:
root@4dfa057c787d:~# ./hello
Starting 2 threads
Listening on port 8080
Traceback (most recent call last)
/root/.nimble/pkgs/httpbeast-0.4.1/httpbeast.nim(83) eventLoop
/nim/lib/system/orc.nim(46) nimIncRefCyclic
SIGSEGV: Illegal storage access. (Attempt to read from nil?)
Segmentation faultI initially found the issue when using Jester. After some searching I found that I can solve the issue by commenting this block of code. Other workaround that I did was modifying Settings.loggers to ref seq[Logger], which also removes the random segfault.
Lines 336 to 339 in 7de559e
| if not isMainThread: | |
| # We are on a new thread. Re-add the loggers from the main thread. | |
| for logger in settings.loggers: | |
| addHandler(logger) |
Metadata
Metadata
Assignees
Labels
No labels