I'm testing my app on FreeBSD 13.0-CURRENT with NIM 1.4.0 (built from ports). After ~5 minutes of working, the web thread (Jester, communicating with web browser and some external modules) fails with the following error:
/home/freebsd/Programming/noogest/noogest.nim(547) web
/home/freebsd/.nimble/pkgs/jester-0.5.0/jester.nim(494) serve
/home/freebsd/.nimble/pkgs/httpbeast-0.2.2/httpbeast.nim(427) run
/home/freebsd/.nimble/pkgs/httpbeast-0.2.2/httpbeast.nim(288) eventLoop
/home/freebsd/.nimble/pkgs/httpbeast-0.2.2/httpbeast.nim(155) processEvents
/usr/local/lib/nim/pure/includes/oserr.nim(94) raiseOSError
Error: unhandled exception: Operation timed out [OSError]
I tried to catch the exception in httpbeast.nim as follows:
while true:
let ret = selector.selectInto(-1, events)
try :
processEvents(selector, events, ret, onRequest)
except :
continue
...and attached GDB when the program was frozen. The backtrace is:
#0 _kevent () at _kevent.S:4
#1 0x00000000404661b4 in __thr_kevent (kq=4, changelist=0x0, nchanges=0, eventlist=0xffffbfbfbe38, nevents=64, timeout=0x0)
at /usr/src/lib/libthr/thread/thr_syscalls.c:400
#2 0x00000000002c63f0 in selectInto__IPADcbzjjSyfNJ5RfGC37g (s=0x42039c50, timeout=-1, results=0xffffbfbfd1b0, resultsLen_0=64
at /home/freebsd/.cache/nim/noogest_d/stdlib_selectors.nim.c:1515
#3 0x00000000002f627c in eventLoop__2zLKVHMUjaQxuLlvzFuZGA (params=0xffffbfbfd730)
at /home/freebsd/.cache/nim/noogest_d/@m..@[email protected]@[email protected]@shttpbeast.nim.c:2258
#4 0x00000000002f69a8 in run__qDSc4B4fo9clwdMQH79bSEyg (onRequest=..., settings=...)
at /home/freebsd/.cache/nim/noogest_d/@m..@[email protected]@[email protected]@shttpbeast.nim.c:2369
#5 0x0000000000304c2c in serve__uyVGO9b8GZDPA7YPHmJyO1w (self=0xffffbfbfdcb0)
at /home/freebsd/.cache/nim/noogest_d/@m..@[email protected]@[email protected]@sjester.nim.c:4987
#6 0x0000000000337578 in web__qy9a8Kv0IyChqHcc6p2IPIA_4 () at /home/freebsd/.cache/nim/noogest_d/@mnoogest.nim.c:6540
#7 0x000000000026aa84 in threadProcWrapDispatch__Mxf9cF7DzrT73i52k5zPHQA_2 (thrd=0xffffffffe6f8)
at /home/freebsd/.cache/nim/noogest_d/stdlib_system.nim.c:6873
#8 0x000000000026af28 in threadProcWrapStackFrame__Mxf9cF7DzrT73i52k5zPHQA (thrd=0xffffffffe6f8)
at /home/freebsd/.cache/nim/noogest_d/stdlib_system.nim.c:6994
#9 0x000000000026afec in threadProcWrapper__KwtUyNVh00QDWGRZcngjGA (closure=0xffffffffe6f8)
at /home/freebsd/.cache/nim/noogest_d/stdlib_system.nim.c:7013
#10 0x0000000040458ef0 in thread_start (curthread=0x40c12f00) at /usr/src/lib/libthr/thread/thr_create.c:292
#11 0x0000000040458a48 in _pthread_create (thread=0xffffffffe700, attr=<optimized out>, start_routine=<optimized out>,
arg=<optimized out>) at /usr/src/lib/libthr/thread/thr_create.c:187
#12 0x000000000020265b in ?? ()
What's happening? Is there any chance to get it working?
D-d-do you mean jester and httpbeast instead of jockers and httpbeans? Jester has some niceties build in but I don't see why asynchttp wouldn't work.
You can also take a look at: https://github.com/planety/prologue
I'm trying individual http APIs now. Jester has better routing, is built on httpbeans and or alternatively on stdlib/asynchttpserver.
I studied the Prologues. Suffers a mysterious error, more my post here https://forum.nim-lang.org/t/7153
"Prologue has strange behavior. When running examples, the blog sometimes returns HTTP 200 OK and sometimes HTTP 404 NOT FOUND."