Too many files open with a RestXQ service

98 views Asked by At

I have a eXist 2.1 (version eXist-db-setup-2.1-rev18721) installed on a Debian server, on which a very simple RestXQ service is set:

declare
    %rest:PUT("{$content}")
    %rest:path("/foo")

function init:init($content as node()*) as item()+ {
    let $log := util:log("INFO", " test")
    let $id := $content/Identifiant/text()
    let $mypath := "/db/test/"
    let $finalpath:=xmldb:store($mypath, concat($id,".xml"),$content)
    let $code := if($finalpath="") then(500) else(201) 
    return (
    <rest:response>
        <http:response status="{$status}">
            <http:header name="Content-Type" value="application/xml; charset=utf-8"/>
        </http:response>
    </rest:response>
    ,$finalpath)
};

When i call a script that use it, there's no problem.

But then I tried to build a script that would call the service like 2 000 times (in short, I want to put 2 000 different files in the database, each one being rather small, like 100 lines).

If I launch it once, no problem; if I try a second time, then I get some error after some time, and then have some issue with the dashboard (not responding at all), but the xmlrpc client and the rest access still work, until I restart eXist.

In the restxq.log, I saw this:

Caused by: java.io.FileNotFoundException: /tmp/_mmtfm_c1600dd8-7203-442c-986b-90328917d6b5/mmtf_1418203231259112417444648192085.tmp (too many files open).

So I check for the pid of eXist in the linux system, and with lsof, I see that the eXist process uses more than 4 000 files. after multiple experiments, 4324 (or 4325) seems to be the limit where something goes wrong.

If I restart eXist, the process uses like 450 files; and each time I want to call the web service, a file (and a folder) is created in exist/tools/jetty/tmp/, and then used by the process.

Has anyone been in front of this problem ? Why aren't those file released once the PUT done ?

Thanks, and happy new years ^^

1

There are 1 answers

1
adamretter On

@lomobob, you also posted this question to the exist-open mailing list. May I suggest that you ask the question in one or the other place so as not to duplicate effort!