{"action":"created","issue":{"url":"https://api.github.com/repos/waarp/WaarpR66/issues/185","repository_url":"https://api.github.com/repos/waarp/WaarpR66","labels_url":"https://api.github.com/repos/waarp/WaarpR66/issues/185/labels{/name}","comments_url":"https://api.github.com/repos/waarp/WaarpR66/issues/185/comments","events_url":"https://api.github.com/repos/waarp/WaarpR66/issues/185/events","html_url":"https://github.com/waarp/WaarpR66/issues/185","id":135199062,"number":185,"title":"REST API for submitting a transfer - pipes not closed ?","user":{"login":"Astr0boy","id":17062495,"avatar_url":"https://avatars.githubusercontent.com/u/17062495?v=3","gravatar_id":"","url":"https://api.github.com/users/Astr0boy","html_url":"https://github.com/Astr0boy","followers_url":"https://api.github.com/users/Astr0boy/followers","following_url":"https://api.github.com/users/Astr0boy/following{/other_user}","gists_url":"https://api.github.com/users/Astr0boy/gists{/gist_id}","starred_url":"https://api.github.com/users/Astr0boy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Astr0boy/subscriptions","organizations_url":"https://api.github.com/users/Astr0boy/orgs","repos_url":"https://api.github.com/users/Astr0boy/repos","events_url":"https://api.github.com/users/Astr0boy/events{/privacy}","received_events_url":"https://api.github.com/users/Astr0boy/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-02-21T12:12:30Z","updated_at":"2016-02-21T14:46:03Z","closed_at":null,"body":"Hi Frédéric,\r\n\r\nI've implemented a R66 rest client based on the example org.waarp.openr66.protocol.http.rest.test.HttpTestRestR66Client but I'm experimenting some issues...\r\nThe client is working and the transfer is submitted, however after a number of transfers I'm having a java exception too many open files.\r\nAfter looking at my JVM pid running the rest client, I can see that the number of open files is growing and I guess there's some pipes or something else not closed properly.\r\nWhen the transfer is submitted, I'm using the WaarpSslUtility.closingSslChannel(channel) & clientHelper.closeAll() methods.\r\nDo you have any clues ?"},"comment":{"url":"https://api.github.com/repos/waarp/WaarpR66/issues/comments/186834116","html_url":"https://github.com/waarp/WaarpR66/issues/185#issuecomment-186834116","issue_url":"https://api.github.com/repos/waarp/WaarpR66/issues/185","id":186834116,"user":{"login":"fredericBregier","id":477131,"avatar_url":"https://avatars.githubusercontent.com/u/477131?v=3","gravatar_id":"","url":"https://api.github.com/users/fredericBregier","html_url":"https://github.com/fredericBregier","followers_url":"https://api.github.com/users/fredericBregier/followers","following_url":"https://api.github.com/users/fredericBregier/following{/other_user}","gists_url":"https://api.github.com/users/fredericBregier/gists{/gist_id}","starred_url":"https://api.github.com/users/fredericBregier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fredericBregier/subscriptions","organizations_url":"https://api.github.com/users/fredericBregier/orgs","repos_url":"https://api.github.com/users/fredericBregier/repos","events_url":"https://api.github.com/users/fredericBregier/events{/privacy}","received_events_url":"https://api.github.com/users/fredericBregier/received_events","type":"User","site_admin":false},"created_at":"2016-02-21T14:46:03Z","updated_at":"2016-02-21T14:46:03Z","body":"One idea: it is in link with how Netty is working.\r\nNetty uses ThreadPool (which are initiated and closed respectively in constructor (NioEventLoopGroup)  and closeAll). In various OS, this brings extra \"fake\" open files, but counted as such by the OS. I have no control on that, but one can limit the impact by:\r\n\r\n- specifying small number of threads (in general close to the number of \"concurrent\" clients, and for server parts the number of cores * 2) : in the HttpTestRestR66Client this is the nbclient parameter\r\n- ensureing that you keep the bootstrap (and therefore its NioEventLoopGroup) over all call, meaning defining it once and reusing it all over (as in the HttpTestRestR66Client created in the constructor and reused over all threads)\r\n\r\nSo you should not create the bootstrap and ending it for each and every Rest client call, but once for all, then reusing the bootstrap already created.\r\n\r\nI believe this is your issue."}}