xtdb
xtdb copied to clipboard
http-client XTDB2 fails: too many open files.
trafficstars
How to reproduce:
(require '[xtdb.client :as xt.client]
'[xtdb.api :as xt])
(let [node (xt.client/start-client "http://localhost:3000")]
(doseq [i (iterate inc 1)]
(xt/submit-tx node [[:put :users
{:xt/id i
:user-id (random-uuid)
:name "yyeyeyeyeye"}]])
(when (zero? (mod i 10))
(prn i))))
producing:
Execution error (SocketException) at sun.nio.ch.Net/socket0 (Net.java:-2).
Too many open files
PS: Darwin sirius.local 23.1.0 Darwin Kernel Version 23.1.0: Mon Oct 9 21:27:24 PDT 2023; root:xnu-10002.41.9~6/RELEASE_ARM64_T6000 arm64
Hato wraps Java 11 HTTP client, which uses a configurable connection pool. Setting the following properties:
(System/setProperty "jdk.httpclient.connectionPoolSize" "10")
(System/setProperty "jdk.httpclient.keepalive.timeout" "2")
(timeout in seconds) seems to allow the client to handle the script above.