[Openmcl-devel] TIL that CCL's load function speaks HTTP

Hans Hübner hans.huebner at gmail.com
Mon Jan 19 05:24:19 PST 2015


Max,

DEADLINE is the way to go, I think.  It seems, though, that there is a
regression in the socket error handling that causes it to act funny:

(drakma:http-request "http://10.0.0.1/" :deadline (+
(get-internal-real-time) internal-time-units-per-second))

This signals a USOCKET:TIMEOUT-ERROR in the Slime repl, but on the bare
repl, it raises an error related to some failing numeric comparison
(supposedly in the printer for the timeout condition, but I am not sure.
Error and stack trace below.

If you establish a handler for USOCKET:TIMEOUT-ERROR, you should be good to
go.

-Hans

> Error: The value NIL is not of the expected type REAL.
 (21818D60) : 0 (>-2 NIL 0) 2293
 (21818D90) : 1 (<=-2 NIL 0) 29
 (21818DB0) : 2 (FUNCALL #'#<#<CCL::STANDARD-KERNEL-METHOD PRINT-OBJECT
(STANDARD-OBJECT T)>> #<USOCKET:TIMEOUT-ERROR #x302002202C8D>
#<STRING-OUTPUT-STREAM  #x302002202A1D>) 69
 (21818DD0) : 3 (%CALL-NEXT-METHOD (NIL #<CCL::STANDARD-KERNEL-METHOD
PRINT-OBJECT #> . 70267366)) 997
 (21818E50) : 4 (%CALL-NEXT-METHOD (NIL #<CCL::STANDARD-KERNEL-METHOD
PRINT-OBJECT #> . 70267366)) 997
 (21818ED0) : 5 (%%STANDARD-COMBINED-METHOD-DCODE
(#<CCL::STANDARD-KERNEL-METHOD PRINT-OBJECT :AROUND #>
#<CCL::STANDARD-KERNEL-METHOD PRINT-OBJECT #> #<CCL::STANDARD-KERNEL-METHOD
PRINT-OBJECT #>) 70267366) 669
 (21818F48) : 6 (FUNCALL #'#<#<CCL::STANDARD-KERNEL-METHOD
CCL::REPORT-CONDITION (CONDITION T)>> #<USOCKET:TIMEOUT-ERROR
#x302002202C8D> #<STRING-OUTPUT-STREAM  #x302002202A1D>) 237
 (21818F88) : 7 (%BREAK-MESSAGE "Error" #<USOCKET:TIMEOUT-ERROR
#x302002202C8D> 70267452 #\>) 1101
 (21819150) : 8 (BREAK-LOOP-HANDLE-ERROR #<USOCKET:TIMEOUT-ERROR
#x302002202C8D> 70267452) 701
 (218191B8) : 9 (%ERROR #<USOCKET:TIMEOUT-ERROR #x302002202C8D> (:SOCKET
NIL) 70267452) 333
 (218191E0) : 10 (RAISE-ERROR-FROM-ID :CONNECTION-TIMED-OUT NIL
#<SOCKET-CREATION-ERROR #x302002202CED>) 149
 (21819210) : 11 (SIGNAL #<SOCKET-CREATION-ERROR #x302002202CED>) 981
 (21819268) : 12 (%ERROR #<SOCKET-CREATION-ERROR #x302002202CED> NIL
70267474) 117
 (21819290) : 13 (SOCKET-ERROR NIL "connect" 60 NIL :CONNECT-ADDRESS
#<IP4-SOCKET-ADDRESS 10.0.0.1:80>) 1053
 (21819300) : 14 (%SOCKET-CONNECT 4 #<IP4-SOCKET-ADDRESS 10.0.0.1:80> 1000)
317
 (21819348) : 15 (MAKE-TCP-SOCKET :REMOTE-HOST "10.0.0.1" :REMOTE-PORT 80
:LOCAL-HOST NIL :LOCAL-PORT NIL :FORMAT :BINARY :EXTERNAL-FORMAT :UNIX
:DEADLINE 60509603 :NODELAY T :CONNECT-TIMEOUT 20) 1357
 (21819440) : 16 (MAKE-SOCKET :REMOTE-HOST "10.0.0.1" :REMOTE-PORT 80
:LOCAL-HOST NIL :LOCAL-PORT NIL :FORMAT :BINARY :EXTERNAL-FORMAT :UNIX
:DEADLINE 60509603 :NODELAY T :CONNECT-TIMEOUT 20) 989
 (21819638) : 17 (SOCKET-CONNECT "10.0.0.1" 80 :PROTOCOL :STREAM
:ELEMENT-TYPE FLEXI-STREAMS:OCTET :TIMEOUT 20 :DEADLINE 60509603 :NODELAY T
:LOCAL-HOST NIL :LOCAL-PORT NIL) 477
 (21819708) : 18 (HTTP-REQUEST #<URI http://10.0.0.1/> :DEADLINE 60509603)
4261
 (21819A38) : 19 (CALL-CHECK-REGS DRAKMA:HTTP-REQUEST "http://10.0.0.1/"
:DEADLINE 60509603) 221
 (21819A70) : 20 (TOPLEVEL-EVAL (DRAKMA:HTTP-REQUEST "http://10.0.0.1/"
:DEADLINE (+ # INTERNAL-TIME-UNITS-PER-SECOND)) NIL) 693
 (21819B00) : 21 (READ-LOOP :INPUT-STREAM #<SYNONYM-STREAM to *TERMINAL-IO*
#x30200041458D> :OUTPUT-STREAM #<SYNONYM-STREAM to *TERMINAL-IO*
#x30200041442D> :BREAK-LEVEL 0 :PROMPT-FUNCTION #<Compiled-function
(:INTERNAL CCL::READ-LOOP) (Non-Global)  #x30000053056F>) 2269
 (21819D58) : 22 (RUN-READ-LOOP :BREAK-LEVEL 0) 157
 (21819D80) : 23 (TOPLEVEL-LOOP) 101
 (21819DA8) : 24 (FUNCALL #'#<(:INTERNAL (TOPLEVEL-FUNCTION
(CCL::LISP-DEVELOPMENT-SYSTEM T)))>) 101
 (21819DC8) : 25 (FUNCALL #'#<(:INTERNAL CCL::MAKE-MCL-LISTENER-PROCESS)>)
661
 (21819E60) : 26 (RUN-PROCESS-INITIAL-FORM #<TTY-LISTENER listener(1)
[Active] #x30200041346D> (#<COMPILED-LEXICAL-CLOSURE # #x302000412F9F>)) 669
 (21819EF0) : 27 (FUNCALL #'#<(:INTERNAL (CCL::%PROCESS-PRESET-INTERNAL
(PROCESS)))> #<TTY-LISTENER listener(1) [Active] #x30200041346D>
(#<COMPILED-LEXICAL-CLOSURE # #x302000412F9F>)) 573
 (21819F98) : 28 (FUNCALL #'#<(:INTERNAL
CCL::THREAD-MAKE-STARTUP-FUNCTION)>) 277



2015-01-19 14:11 GMT+01:00 Max Rottenkolber <max at mr.gy>:

> On Sun, 04 Jan 2015 18:33:34 -0800, Ron Garret wrote:
>
> > No more need to load drakma to get simple urls!  Woohoo!
>
> I guess the reason to use drakma is to not introduce non-portability.
> Also SNARF-URL is not documented (and as far as I can tell CCL-1.9
> doesn't have it)?
>
> Without wanting to needlessly hijack this thread, there is a specific
> HTTP-REQUEST functionality that I am missing in drakma: Reliable timeouts.
>
> Drakma has CONNECTION-TIMEOUT, READ-TIMEOUT, WRITE-TIMEOUT and DEADLINE.
>
> DEADLINE seems to be a Clozure only parameter and accepts "internal time
> units". I couldn't get it to work so far .
>
> (READ-TIMEOUT and WRITE-TIMEOUT are LispWorks only, CONNECTION-TIMEOUT is
> rather unreliable.)
>
> It's not a big issue (in the end you just attach a watchdog to your
> request-thread), but this part of Drakma really annoys me, if not only
> for the complete non-portability of the API by itself.
>
> Then I just noticed CCL's (also undocumented) WITH-INPUT/OUTPUT-TIMEOUT.
>
> Comments? :)
>
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> https://lists.clozure.com/mailman/listinfo/openmcl-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.clozure.com/pipermail/openmcl-devel/attachments/20150119/631f0fde/attachment.htm>


More information about the Openmcl-devel mailing list