fukamachi / clack

Web server abstraction layer for Common Lisp
MIT License
1.04k stars 87 forks source link

Is it possible to set up clack with woo to handle more than one connection at a time? #131

Closed asciimoo closed 8 years ago

asciimoo commented 8 years ago

Ohai

It seems, by default a single clack+woo instance doesn't support concurrent requests, is there any way to change this behavior? I tried all the permutations of the :worker-num 2-4 and :use-thread t/nil options in clack:clackup, but non of them worked.

tested on SBCL 1.2.15.debian

thanks!

fukamachi commented 8 years ago

Is it possible to set up clack with woo to handle more than one connection at a time?

Yes, it's possible.

non of them worked.

Could you tell me what is the actual code you executed and what happened at the time?

asciimoo commented 8 years ago

Hmm, actually using :worker-num 4, :use-thread nil it works!

(clack:clackup *app*
               :use-thread nil
               :worker-num 4)

The only problem with it, is that sbcl stops accepting any further inputs

The same code with :use-thread t throws the following error:

Woo server is going to start.
Listening on localhost:5000.

debugger invoked on a SIMPLE-ERROR in thread
#<THREAD "main thread" RUNNING {1003C866D3}>:
  Cannot fork with multiple threads running.

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [ABORT] Exit debugger, returning to top level.

(SB-POSIX:FORK)

*app* is a simple ningle app

fukamachi commented 8 years ago

It's intended (for now, at least). Woo's workers are UNIX forked processes and fork is allowed only for single threaded processes.

I'm working on rewriting worker mechanism of Woo to multithreaded model at multithread branch. Your case would work when the branch has merged.

asciimoo commented 8 years ago

thanks