[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] questionable http-server behaviour under heavyload:

From: gian paolo ciceri
Subject: Re: [Chicken-users] questionable http-server behaviour under heavyload: broken pipe
Date: Fri, 27 Aug 2004 09:36:16 +0200
User-agent: Mozilla Thunderbird 0.6 (X11/20040519)

Hash: SHA1

Ed Watkeys wrote:
|> Only a supplementary question: in both cases,
|> doing a CTRL+C (i.e. SIGINT if I remember right) in the
|> terminal where the server run, doesn't terminate the server
|> process anymore, but I've trapped SIGPIPE, not SIGINT.
| This seems to be a result of using threads. (You are using threads,
| right?) You should be able to  kill the process by typing Control-\.
| Chicken threads behave very similarly to Python threads with respect to
| responding to Control-C and Control-\ (SIGINT and SIGQUIT).

Thanks Ed for your reply, but
I'm rather surprised than *before* I inserted the code
that catchs the SIGPIPE I was able to terminate the server with
SIGINT (CTRL+C in the terminal).

As a further control, I've added an explicit SIGINT handler,
dumbhandler, to the server code...
- ----
(require-extension http-server)
(require-extension posix)

(set-signal-handler! signal/pipe #f)

(define (dumbhandler n)
~       (display (conc "I've just catched a signal: " n))
~       (newline)
~       (display "And now I'm exiting, bye bye... ")
~       (newline)
~       (exit)
~           )

(set-signal-handler! signal/int dumbhandler)

(http:add-resource '("/" "/index.html")
~  (lambda (r a)
~    (http:write-response-header)
~    (let ([msg "<h1>Hello, world!</h1>"])
~      (print "Content-type: text/html\r\nContent-length: "
(string-length msg) "\r\n\r\n" msg) ) ) )

((http:make-server 4242) #t)
- ----

Using this, I'm able to terminate the server with SIGINT.

IMHO, there should be some trouble somewhere: if I don't
use any signal handler, the default SIGINT behaviour is honored,
but if I install an unrelated sighandler, for SIGPIPE, the SIGINT
behaviour doesn't work anymore and I've to explicitely install
an handler for this, too.

| Regarding the SIGPIPE error, a properly-functioning web server and
| client should not generate SIGPIPE: Someone is doing something wrong. As
| someone suggested, the problem could be as simple as the server sending
| an extra newline after a request. If no one else is going to look into
| this, I'd be willing to.

I agree with you to this point.

| On a related subject, I found that there are interoperability issues
| with the XMLRPC client: It doesn't like talking to HTTP 1.1 servers. (Or
| is it that the server doesn't serve clients who submit HTTP 1.1
| requests? I'm not sure; it was a while ago.)

mmmmh. I was able to see pages via mozilla 1.7, so it seems Http 1.1
calls are supported

address@hidden gpciceri]$ csi -batch testHttpServer.scm
~   ________    _      __
~  / ____/ /_  (_)____/ /_____  ____
~ / /   / __ \/ / ___/ //_/ _ \/ __ \
/ /___/ / / / / /__/ ,< /  __/ / / /
\____/_/ /_/_/\___/_/|_|\___/_/ /_/

Version 1, Build 66 - linux-unix-gnu-x86
(c)2000-2004 Felix L. Winkelmann
; loading testHttpServer.scm ...
; loading /usr/local/lib/chicken/ ...
; loading library regex ...
; loading /usr/local/lib/chicken/ ...
; loading library posix ...
[waiting for requests...]
[request 0 from; thread0 (of 1) started...]
[read: "GET /index.html HTTP/1.1"]
[request: method=GET, url=/index.html, protocol=HTTP/1.1]
[attributes: (("cookie" . "PASSWORD=U39ufwlvhLw=;
ad_user_login=17!1184660306937!7JqnxcsaUlSW/yNzz1+6Rw==; tz_offset=3600;
address@hidden; loginkey=24ff5c3fba7903f106b3f7b98b1d5170;
user=gpciceri; style=null") ("connection" . "keep-alive") ("keep-alive"
. "300") ("accept-charset" . "ISO-8859-1,utf-8;q=0.7,*;q=0.7")
("accept-encoding" . "gzip,deflate") ("accept-language" .
"it,en-us;q=0.7,en;q=0.3") ("accept" .
("user-agent" . "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7)
Gecko/20040808 Firefox/0.9.3") ("host" . "localhost:4242"))]

This is an HTTP 1.1 request.

For Xml-Rpc there should be a standard validation suite at Perhaps should be
opportune make xml-rpc chicken implementation compliant with this.

| Regards,
| Ed

Thanks for your patience,
have a nice day.

- --
gian paolo ciceri - japanman
suddenthinks, excellence through refactoring
++39 340 7218101
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird -


reply via email to

[Prev in Thread] Current Thread [Next in Thread]