Skip to content

Simple http server example does not work

yarl@yarl-pro $ guix shell -C artanis guile coreutils curl
yarl@yarl-pro ~ [env]$ mkdir /etc/artanis && touch /etc/artanis/artanis.conf        
yarl@yarl-pro ~ [env]$ guile -c "(use-modules (artanis artanis))(init-server)(run #:debug #t)"&
[1] 4
yarl@yarl-pro ~ [env]$ Loading /etc/artanis/artanis.conf...done.
DEBUG: ON
[WARN] You're not in application folder, the file motoring is disabled!
Initilizing session backend `SIMPLE'...
Session with SIMPLE backend init done!
Server core: ragnarok
http://127.0.0.1:3000
Anytime you want to quit just try Ctrl+C, thanks!
Loading server engine 'ragnarok' ...
Using Non-Blocking I/O
Installed suspendable ports
Starting `ragnarok' engine loader ...
Enter ragnarok-http-gateway-run
Listen socket is #<input-output: socket 18>
generating work-table
Prepare for regnarok-open
Added listenning port to epoll
Prepare for main-loop

yarl@yarl-pro ~ [env]$ curl http://localhost:3000                                              
Checking event (0 . 1)
listenning-port? (0 . 1)
Is listen-socket? 0 ?= #<input-output: socket 18>
The fd 0 in still in epoll but not task for it, just ignore!
The client (0 . 1) is ready to shutdown

Here nothing happens, I can wait indefinitely. If If press Ctrl+C then rerun curl artanis crashes.

^C
yarl@yarl-pro ~ [env]$ curl http://localhost:3000
Checking event (0 . 1)
listenning-port? (0 . 1)
Is listen-socket? 0 ?= #<input-output: socket 18>
The event 0 exist and kept alive
Backtrace:
In ice-9/boot-9.scm:
  1752:10 13 (with-exception-handler _ _ #:unwind? _ # _)
In unknown file:
          12 (apply-smob/0 #<thunk 2c2712e0>)
In ice-9/boot-9.scm:
    724:2 11 (call-with-prompt _ _ #<procedure default-prompt-handle?>)
In ice-9/eval.scm:
    619:8 10 (_ #(#(#<directory (guile-user) 2c276c80>)))
In ice-9/command-line.scm:
   185:19  9 (_ #<input: string 2c270850>)
In unknown file:
           8 (eval (run #:debug #t) #<directory (guile-user) 2c276c80>)
In artanis/server/ragnarok.scm:
   630:10  7 (establish-http-gateway _)
   450:27  6 (ragnarok-http-gateway-run _)
    420:6  5 (get-one-request-from-clients #<ragnarok-protocol name?> ?)
    218:4  4 (fill-ready-queue-from-service _ #<ragnarok-server epfd?>)
In ice-9/boot-9.scm:
   260:13  3 (for-each #<procedure 2cce2ed0 at artanis/server/ragna?> ?)
In artanis/server/ragnarok.scm:
   245:16  2 (_ (0 . 1))
In artanis/server/epoll.scm:
    220:4  1 (exists-in-epoll? 19 0)
    212:8  0 (epoll-ctl _ _ _ _ #:check-exists? _)

artanis/server/epoll.scm:212:8: In procedure epoll-ctl:
Throw to key `artanis-err' with args `(500 #<procedure epoll-ctl (epfd op fd event #:key check-exists?)> "~a: ~a" (19 2 0 #f "Bad file descriptor") (9))'.
curl: (56) Recv failure: Connection reset by peer
[1]+  Done(1)                 guile -c "(use-modules (artanis artanis))(init-server)(run #:debug #t)"

It works with server.engine = guile.

I'm using manjaro (guix on top of it) on an aarch64 board.

Edited by yarl