Git Product home page Git Product logo

Comments (3)

avodonosov avatar avodonosov commented on June 2, 2024 5

Currently this problem can be worked-around like this:

(let ((cl+ssl:*default-unwrap-stream-p* nil))
  (time (nth-value 1 (dex:get "https://httpbin.org/delay/10" :read-timeout 2))))

After two seconds I have (on CCL):

A failure in the SSL library occurred on handle #<A Foreign Pointer #x7FE3400B2DF0> (return code: 1). ERR_print_errors(): 140614316242688:error:01000044:unknown library:unknown library:internal error:cl+ssl/src/bio.lisp:0:Unexpected SERIOUS-CONDITION in the Lisp BIO: Input timeout on #<BASIC-TCP-STREAM ISO-8859-1 (SOCKET/4) #x3020027F4ACD>
   [Condition of type CL+SSL::SSL-ERROR-SSL]

Backtrace:
  0: (CL+SSL::SSL-SIGNAL-ERROR #<A Foreign Pointer #x7FE3400B2DF0> #<Compiled-function CL+SSL::SSL-READ #x30200180772F> 1 -1)
  1: (#<STANDARD-METHOD STREAM-READ-BYTE (CL+SSL::SSL-STREAM)> #<SSL-STREAM for #<BASIC-TCP-STREAM :CLOSED #x3020027F4ACD>>)
  2: (READ-BYTE #<SSL-STREAM for #<BASIC-TCP-STREAM :CLOSED #x3020027F4ACD>> NIL NIL)
  3: (DEXADOR.BACKEND.USOCKET::READ-UNTIL-CRLF*2 #<SSL-STREAM for #<BASIC-TCP-STREAM :CLOSED #x3020027F4ACD>>)
  4: (DEXADOR.BACKEND.USOCKET::READ-RESPONSE #<SSL-STREAM for #<BASIC-TCP-STREAM :CLOSED #x3020027F4ACD>> T NIL T)
  5: (DEXADOR.BACKEND.USOCKET:REQUEST "https://httpbin.org/delay/10" :METHOD :GET :READ-TIMEOUT 2)
  6: (#<Anonymous Function #x3020027F93FF>)
  7: (CCL::REPORT-TIME (NTH-VALUE 1 (DEXADOR:GET "https://httpbin.org/delay/10" :READ-TIMEOUT 2)) #<Anonymous Function #x3020027F93FF>)

This works because the *default-unwrap-stream-p* nil makes cl+ssl delegate all the low-level (unencrypted) IO to the lisp stream of the socket - cl+ssl uses custom Lisp BIO in this case. And the Lisp stream has timeout configured by dexador.

In the default mode cl+ssl extracts socket file descriptor from lisp stream, and passes it to OpenSSL to perform IO using the normal OpenSSL's socket BIO. And the socket file descriptor does not know about the timeout set on the Lisp stream level.

from dexador.

lispstudent avatar lispstudent commented on June 2, 2024

If it can be of help, same test on LispWorks (Windows) times out after about 3.5 seconds:

CL-USER 9 > (time (nth-value 1 (dex:get "https://httpbin.org/delay/10" :read-timeout 2)))
Timing the evaluation of (NTH-VALUE 1 (DEXADOR:GET "https://httpbin.org/delay/10" :READ-TIMEOUT 2))

Error: ERROR 12002: Timeout
  1 (abort) Return to top loop level 0.

Type :b for backtrace or :c <option number> to proceed.
Type :bug-form "<subject>" for a bug report template or :? for other options.

CL-USER 10 : 1 > 
User time    =        0.000
System time  =        0.000
Elapsed time =        3.838
Allocation   = 140008 bytes
0 Page faults

from dexador.

ajberkley avatar ajberkley commented on June 2, 2024

I will work on correcting the implementation of this in cl+ssl. Then if I am still happy, will add to dexador and drakma.

from dexador.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.