From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ian Price Newsgroups: gmane.lisp.guile.bugs Subject: bug#15227: Possible bug in (web server) Date: Fri, 13 Sep 2013 14:36:04 +0100 Message-ID: <87vc24zvwb.fsf@Kagami.home> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-2022-jp X-Trace: ger.gmane.org 1379079431 14343 80.91.229.3 (13 Sep 2013 13:37:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 13 Sep 2013 13:37:11 +0000 (UTC) Cc: 15227@debbugs.gnu.org To: Shane Celis Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Fri Sep 13 15:37:15 2013 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VKTYg-0000kC-Ep for guile-bugs@m.gmane.org; Fri, 13 Sep 2013 15:37:14 +0200 Original-Received: from localhost ([::1]:47074 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VKTYg-0005er-35 for guile-bugs@m.gmane.org; Fri, 13 Sep 2013 09:37:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38146) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VKTYZ-0005Zw-3n for bug-guile@gnu.org; Fri, 13 Sep 2013 09:37:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VKTYU-0000RU-I6 for bug-guile@gnu.org; Fri, 13 Sep 2013 09:37:07 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:53009) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VKTYU-0000RM-Df for bug-guile@gnu.org; Fri, 13 Sep 2013 09:37:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VKTYT-0007qo-N1 for bug-guile@gnu.org; Fri, 13 Sep 2013 09:37:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ian Price Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Fri, 13 Sep 2013 13:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15227 X-GNU-PR-Package: guile X-GNU-PR-Keywords: Original-Received: via spool by 15227-submit@debbugs.gnu.org id=B15227.137907937930123 (code B ref 15227); Fri, 13 Sep 2013 13:37:01 +0000 Original-Received: (at 15227) by debbugs.gnu.org; 13 Sep 2013 13:36:19 +0000 Original-Received: from localhost ([127.0.0.1]:33069 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VKTXm-0007pl-R9 for submit@debbugs.gnu.org; Fri, 13 Sep 2013 09:36:19 -0400 Original-Received: from mail-wg0-f41.google.com ([74.125.82.41]:40356) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VKTXj-0007pX-Uk for 15227@debbugs.gnu.org; Fri, 13 Sep 2013 09:36:16 -0400 Original-Received: by mail-wg0-f41.google.com with SMTP id l18so776492wgh.4 for <15227@debbugs.gnu.org>; Fri, 13 Sep 2013 06:36:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=pPPY+NANo4XlMuMigUwzCOAuVqrx9YKLNIuM97M7wKw=; b=Qk6nwFiG4tRFXEMLuTVAqnz+T0ib9yWIhQsslVAcZ/qGGlWMFYCUdoVmyc7nUUYl5t PbO38fPPYtUhomwgmOgnUkWfO8x30gFpkRZhh2elGr5Ut0bfaw8fV+s+svfGh8YkGzSM 0C+OlcZYWB3b7MqG/vpgG1PmxSFT8gc0OAaBwfaxfWDYT/MZ9Q/RKNZuWY+LvaBlsymk DqIwuiW2a5VQoZofNIGPfOf30zEak4godTZFMI0w8vVIEIwOirO7rGlPePz/+ZytwO2D XQuK2lKYbWDoRja6ESFBTg261usv5rQNBy3F9rJfv/NH+FqGyLW8PlZaJwiccB0mYeD7 zNpA== X-Received: by 10.180.76.171 with SMTP id l11mr2586977wiw.39.1379079370068; Fri, 13 Sep 2013 06:36:10 -0700 (PDT) Original-Received: from Kagami.home (host109-150-135-12.range109-150.btcentralplus.com. [109.150.135.12]) by mx.google.com with ESMTPSA id d11sm3627882wic.4.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 13 Sep 2013 06:36:09 -0700 (PDT) In-Reply-To: (Shane Celis's message of "Sat, 31 Aug 2013 03:11:10 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:7280 Archived-At: Shane Celis writes: > ;; GNU/Linux bug > ;; ------------ > ;; > ;; Info > ;; ---- > ;; > ;; $ uname -a > ;; Linux debian 3.2.0-4-686-pae #1 SMP Debian 3.2.46-1 i686 GNU/Linux > ;; > ;; $ guile --version > ;; guile (GNU Guile) 2.0.9 [...] > ;; > ;; $ bash ./build-aux/config.guess > ;; i686-pc-linux-gnu > ;; > ;; $ ./config.status --config > ;; > ;; Running > ;; ------- > ;; > ;; $ ./guile-web-server-osx-bug.scm server > ;; Web server replied 'Hello World! 0'. > ;; > ;; --- > ;; > ;; $ ./guile-web-server-osx-bug.scm client > ;; Getting http://gnu.org... response #< [...] > ;; > ;; Getting http://fsf.org... response #< [...] > ;; > ;; Getting http://localhost:8080...SIGALRM called; timedout. > ;; > ;; If I try to connect to http://localhost:8080 through a web browser, > ;; it works fine; so it seems like the (web client) is not working on > ;; GNU/Linux and the (web server) is not working on Mac OS X. > ;; If I run the client under strace I get read(13, "HTTP/1.1 200 OK\r\nContent-Length: 15\r\nContent-Type: text/plain;charset=utf-8\r\n\r\nHello World! 22", 4096) = 94 read(13, 0xa1ec000, 4096) = ? ERESTARTSYS (To be restarted if SA_RESTART is set) so even though we've read all the data that's needed, we're still making another call to read and blocking. One problem was that read-response-body was making a call to get-bytevector-all, but even after changing it to (define (read-response-body r) "Reads the response body from R, as a bytevector. Returns ‘#f’ if there was no response body." (let ((body (and=> (response-body-port r #:decode? #f) (lambda (p) (cond ((response-content-length r) => (lambda (n) (get-bytevector-n p n))) (else (get-bytevector-all p))))))) ;; Reading a body of length 0 will result in get-bytevector-all ;; returning the EOF object. (if (eof-object? body) #vu8() body))) I'm still seeing the same behaviour. (I did check and the get-bytevector-n case is definitely being ran) So, I'm guessing the problem lies in the C code for handling ports, and/or for handling sockets. No idea why it doesn't happen on web calls but only localhost. Aside: The above change to read-response-body has not been committed. I'm undecided as to whether or not read-response-body should handle checking the size of the content body. Currently it doesn't, but we have separate code for doing that in (web client), so maybe not. But it might be an idea to document that read-response-body may return less bytes than the content length. -- Ian Price -- shift-reset.com "Programming is like pinball. The reward for doing it well is the opportunity to do it again" - from "The Wizardy Compiled"