tagattie/FreeBSD-VSCode

Issue and success on building vscode on poudriere

Closed this issue ยท 7 comments

Good news and bad news

The good news is: I was able to build VSCode on my poudriere instance.
The bad news is: I had to slightly change my poudriere configuration, and it's not compatible with the official poudriere instance used by FreeBSD to build packages.
In other words, if I commit it to the portstree, it will fail to build a package usable by everyone.

The problem

poudriere unconditionally set the limit of openmaxfiles to 1024 (ulimit -n)
yarn/gulp parallelize the load of JS code at insane level (IMO it doesn't make sense to read concurrently 1024+ files) and that will fail the build.
Here you can find the exact error: vscode.log

Configuring poudriere to a bigger limit (2048 wasn't enough, but I've successfully build by setting MAX_FILES=8192 in poudriere.conf) fixed the issue, but I cannot change that limit in the official poudriere instance (I still have to ask, tho).

The solution?

Do you know if there's a way to limit the parallelization gulp or yarn is causing?

Hi @pizzamig,

Thanks for the report. I'm glad to hear you could build VSCode successfully.

Regarding EMFILE error, I found the following URL:
https://stackoverflow.com/questions/8965606/node-and-error-emfile-too-many-open-files
It appears the error is fairly common in Node/JavaScript environment.

I will investigate using graceful-fs module mentioned at the URL solves (or mitigates at least) the issue.

I will investigate using graceful-fs module mentioned at the URL solves (or mitigates at least) the issue.

It wasn't that easy. I spent some time to look into codes around the build process. But I still can't find how the concurrency can be controlled.

Instead I found a similar issue at the following URL:
Packaging v1.22.1 on Arch Linux results in "EMFILE: too many open files" #47437

Arch Linux appears to decide to raise max files according to the package build script:
https://git.archlinux.org/svntogit/community.git/tree/trunk/PKGBUILD?h=packages/code#n100

I'm asking to raise MAX_FILES to 8192, so we can commit to the portstree and have it built.

During Xmas holidays I'll try to work on a patch to avoid to have the ELECTRON_VERSION in the VSCode Makefile, but to read it directly from the electron6 port

Thanks for asking! I'm looking forward to a good news.

lwhsu commented

Is there any news on poudriere side? I think for now we probably need to have a note for people trying to build this in poudriere.

Sorry, I didn't follow up. antoine@ kindly raised MAX_FILES to 8192 for vscode only. the vscode packages is already available.
However, we should add this information on the README

Thanks @lwhsu and @pizzamig for the head-up and follow-up.

I will add information for poudriere users to README. Regarding the value of MAX_FILES, 4096 seems suffice ๐Ÿ˜„