Error from OpenSSL after a while

Pietro Cerutti via Chicken-users <[email protected]>
Newsgroups gmane.lisp.scheme.chicken
Message-ID <01070197e520644e-48976ddd-165e-44b1-b810-2bfc9da3658f-000000@eu-central-1.amazonses.com>
I've been chasing this for months. I have a long-running process that 
sometimes needs to do an HTTPS call. The call sometimes fails with an 
error out of OpenSSL.

Here's the code:

---------------------------------------------------------------------
(import
   (scheme)
   (openssl)
   (only (chicken base) cut)
   (only (chicken condition) condition->list handle-exceptions)
   (only (chicken format) printf)
   (only (chicken io) read-string)
   (only (chicken time) current-seconds)
   (only (chicken time posix) seconds->string)
   (only (http-client) call-with-input-request))


(define (dd . msg)
   (printf "~A - ~A~%" (seconds->string (current-seconds)) msg))

(let loop ()
   (read)
   (handle-exceptions exn 
     (begin
       (dd "call failed" (condition->list exn)))
     (begin
       (dd "call start")
       (call-with-input-request
         "https://google.com"
         #f
         (lambda (in)
           (dd (string-length (read-string #f in)))))
       (dd "call end")))
   (loop))
---------------------------------------------------------------------

And here's what I get after triggering the fetch a few time:

$ chicken-csi -s openssl-error.scm
foo
Mon Jul  7 11:53:36 2025 - (call start)
Mon Jul  7 11:53:36 2025 - (17789)
Mon Jul  7 11:53:36 2025 - (call end)
foo
Mon Jul  7 11:53:41 2025 - (call start)
Mon Jul  7 11:53:41 2025 - (34456)
Mon Jul  7 11:53:41 2025 - (call end)
foo
Mon Jul  7 11:56:24 2025 - (call start)
Mon Jul  7 11:56:24 2025 - (34456)
Mon Jul  7 11:56:24 2025 - (call end)
foo
Mon Jul  7 13:31:49 2025 - (call start)
Mon Jul  7 13:31:49 2025 - (call failed ((exn message error:0A000197:SSL routines::shutdown while in init location ssl-shutdown arguments ()) (i/o) (net) (openssl status ssl)))
---------------------------------------------------------------------

Can people reproduce it? Do people have any clue?

Thanks!

-- 
Pietro Cerutti
I have pledged to give 10% of income to effective charities
and invite you to join me - https://givingwhatwecan.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.