jeapostrophe / xml-rpc

XML RPC in Racket
GNU Lesser General Public License v3.0
3 stars 4 forks source link

tcp-connect error not handled? #3

Open DexterLagan opened 2 years ago

DexterLagan commented 2 years ago

Hi Jay,

When I attempt to run too many tasks in parallel against the Odoo XML-RPC API, I'm getting TCP errors. Nothing special, but this particular error doesn't seem to be caught by exceptions, it just fails with this error:

xxxxx.rkt:195:4: tcp-connect: connection failed
  hostname: xxxxxxxxxxxx.cloud
  port number: 443
  system error: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.; win_err=10060

The piece of code responsible is this chain starting from an xml-rpc-server:

;; xml-rpc client setup
(define models
  (xml-rpc-server (string->url (string-append *url* *models-path*))))

;; execute a method with keywords
(define execute_kw
  (models 'execute_kw))

;; executes a keyword method given the model, the method and its parameter list
(define (execute model method params)
 (with-handlers ([exn:xml-rpc:fault?                         ; handle XML-RPC exceptions
                   (λ (e) (echo "Error: " (exn-message e)))])
    (execute_kw *db* *uid* *password* model method params '())))

execute_kw itself being the source of this tcp-connect error. I'd guess it's coming from xml-rpc-server, but Racket stops at execute_kw. Any clue?

Thanks!

jeapostrophe commented 2 years ago

Zero clue. I have literally not thought about this code in over a decade :) You could expand the handler to exn? and see if that helps.

DexterLagan commented 2 years ago

I'll give this a try. No rush, thanks for replying. Cheers