plexsystems/pacmod

Error while packing a module ("too many open files")

RonAmihai opened this issue · 4 comments

I'm trying to pack go-bluetooth package with all of it's dependencies, in order to put it in Athens registry later.

This package doesn't have a go.mod file so I've created one manually (run "go mod init" in the package's root and then "go mod tidy" to resolve all the dependencies).

But afterwards, when trying to run "pacmod pack v5.5.0 ." inside the package's root, I'm receiving the following error:

Error: could not package module: could not create zip archive: unable to open file: open /home/pi/go/src/github.com/muka/go-bluetooth/src/bluez/tools/l2cap-tester.c: too many open files

Am I missing something here?
Does it even possible to pack a module with all of it's dependencies?

Hi @RonAmihai, to answer your second question first, the go module contains all of the source in the current directory. That particular project appears to use git submodules to include the source for bluez into the source directory which is why it is then being included in the module package.

To be completely honest, I am not sure if go modules using the go build tooling respects git submodules. Either way we should investigate and make the behavior of the app match the behavior of the go build tools.

The specific error you are encountering appears to be a bug due to some lazy file handle cleanup here:

defer fileToZip.Close()

We will get it sorted. Thank you for the report :)

@RonAmihai sorry for the delay, I completely missed the notification.

Which version of pacmod are you running? I just tried running on the current version, v0.3.0, and did not get the error. Submodules aren't included in packaged modules, and are not present on the file system so they should not be getting picked up at all by the tool.

I also wasn't able to get the tool to fail with a large number of files. I created a quick script to generate 10,000 files, and it seemed to be packed fine. Regardless, I agree we should close the file after zipping.

Release v0.3.1 includes this, so please give that a try, and let us know.

@RonAmihai I am going to close this issue. If the latest release does not resolve your issue, please let us know!