Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(launchdoctor): detect missing libraries for dlopen #3202

Merged

Conversation

aslushnikov
Copy link
Collaborator

WebKit WPE assumes libglesv2.so is available on the host system
and uses dlopen to open it.

This patch starts using ldconfig -p to check if the library
exists on the system.

References #2745

WebKit WPE assumes `libglesv2.so` is available on the host system
and uses `dlopen` to open it.

This patch starts using `ldconfig -p` to check if the library
exists on the system.

References microsoft#2745
@aslushnikov aslushnikov requested a review from yury-s July 29, 2020 00:58
cwd: dirname,
env: {
...process.env,
LD_LIBRARY_PATH: process.env.LD_LIBRARY_PATH ? `${process.env.LD_LIBRARY_PATH}:${dirname}` : dirname,
},
});
if (code !== 0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should throw if it failed otherwise it's indistinguishable from the case when all dependencies are good.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ldd fails if we feed in a non-ELF file (and we might occasionally do so).

We should throw if it failed otherwise it's indistinguishable from the case when all dependencies are good.

If our spawn fails for some reason, i'd still try launching to avoid false negatives.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's unfortunate, perhaps we could run this checks after launch failed? Don't remember what was the rationale for running the checks before launch.

Copy link
Collaborator Author

@aslushnikov aslushnikov Jul 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason is that there might be no browser crash at all. In case of missing libglesv2 the browsers won't crash - instead, renderer will either misbehave (on ubuntu 18.04) or crash (on ubuntu 20.04)

if (!libraries.length)
return [];
const {stdout, code} = await spawnAsync('ldconfig', ['-p'], {});
if (code !== 0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

@aslushnikov aslushnikov merged commit 6bc02f8 into microsoft:master Jul 29, 2020
@aslushnikov aslushnikov deleted the check-dlopen-libs-in-launch-doctor branch July 29, 2020 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants