[erlang-patches] cover: fix file descriptor leak
shunichi shinohara
shino.shun@REDACTED
Wed May 4 17:03:59 CEST 2011
Thanks for information to run tests.
By following the wiki, I can execute test suites of tools app.
Thanks,
shino
On Mon, May 2, 2011 at 9:54 PM, Henrik Nord <henrik@REDACTED> wrote:
> On 04/29/2011 08:07 AM, shunichi shinohara wrote:
>>
>> The patch below fixes file descriptor leak of cover module.
>>
>> git fetch https://github.com/shino/otp.git shino/fix-cover-fd-leak
>>
>> Explanation:
>>
>> Data import of cover module is called with a file path and
>> open a fd internally. The fd should be closed in cover module,
>> but it does not.
>> As an additional information, in data export it closes a fd properly.
>>
>> This patch does not include test code because
>> - I can't find the way to execute test suites, and
>> - I don't know how to find fd list in beam process.
>>
>> Steps to reproduce:
>>
>> I tested the patch on Mac OS X 10.6.7, 64bit.
>>
>> 1. Run the escript below, and find the process id (OS pid).
>> ============
>> #!/usr/bin/env escript
>> -export([main/1]).
>>
>> main([]) ->
>> file:write_file("sample.erl",<<"-module(sample).\n">>),
>> {ok, sample} = cover:compile("sample.erl"),
>> ok = cover:export("sample.coverdata", sample),
>> ok = cover:import("sample.coverdata"),
>> io:format("~s~n", [os:cmd("lsof -p " ++ os:getpid())]).
>> ============
>>
>> 2. Confirm cover's data file is NOT listed in output.
>>
>> Before apply this patch, script outputs the line like:
>> beam.smp 17008 shino 11r REG 14,5 89 567192 /path/to/sample.coverdata
>>
>> After this patch is applied, lsof does not report "sample.coverdata".
>>
>> Regards,
>> Shunichi Shinohara (shino.shun@REDACTED)
>> _______________________________________________
>> erlang-patches mailing list
>> erlang-patches@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-patches
>
> Hi
>
> I have now included this branch in 'pu' and I will let it cook for a while.
>
> Information on how to invoke the tests can be found on the github wiki:
> https://github.com/erlang/otp/wiki/Running-tests
> If you have additional questions do not hesitate to ask
> Thank you for the contribution!
>
> --
> /Henrik Nord Erlang/OTP
>
>
More information about the erlang-patches
mailing list