[erlang-patches] Prevent zip:zip_open/1,2 from leaking ports

Daniel White daniel@REDACTED
Sat Jan 17 09:51:24 CET 2015


The case was discovered where a parent process would exit before closing
the zip file. The result was that a port would be left open
indefinitely, as the small zip server would not detect this condition.

By comparison, the file module will close the associated port when the
parent exits for any reason. This change would make the zip module more
consistent with the semantics of similar modules.

This change is breaking for any callers expecting to pass the handle to
another process for processing (assuming it exits).

With this in mind, it may need a bit more thought with regards to:

1. Is this the best way to cope with a parent process exiting?
2. Should an equivalent of gen_tcp:controlling_process/2 to deal with
migrating an open zip to another process?
3. If backwards compatibility is necessary, then would it be worth
introducing new functions without the "zip_" prefix?

git fetch git://github.com/danielwhite/otp.git zip-port-leak-fix

https://github.com/danielwhite/otp/compare/erlang:master...zip-port-leak-fix
https://github.com/danielwhite/otp/compare/erlang:master...zip-port-leak-fix.patch

https://github.com/erlang/otp/pull/587

-- 
Daniel White



More information about the erlang-patches mailing list