Re: Error from OpenSSL after a while

Anton Idukov via Chicken-users <[email protected]>
Newsgroups gmane.lisp.scheme.chicken
Message-ID <CAMJCnqUZMcHugPqqnKtnHNkwzO07S4xAT25RP+7+r+-=WhmBBQ@mail.gmail.com>
1) net split, connection problems, firewall. Insert some sleep in between
requests.

2) TLS may end handshake in case client-server time delta. Maybe client
local time drifting from actual UTC+tmzone?

пн, 7 июл. 2025 г., 21:28 Kristian Lein-Mathisen via Chicken-users <
[email protected]>:

>
> I'm unable to reproduce this. I replaced (read) with (thread-sleep! 1) and
> after 100s I C-c'd. Could this be the google servers that's banning your IP
> quicker than mine, and quickly shutting down the TCP connection? I don't
> know what else could be causing this. Perhaps you could try with a local
> https service.
>
> ====
> $ chicken-status -list|grep ssl
> (openssl "2.2.6")
>
> On Mon, Jul 7, 2025, 15:57 Pietro Cerutti via Chicken-users <
> [email protected]> wrote:
>
>> 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.