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

Fix opal arg parsing overhead #11827

Closed
wants to merge 2 commits into from

Conversation

nivShpak
Copy link

reported issue:
Issues running OMPI with address sanitizer #11826

@jsquyres
Copy link
Member

Discussion about this PR occurring on #11826.

@nivShpak nivShpak force-pushed the pr/opal_args_addr_sanitizer branch from 1717930 to 20866f0 Compare July 17, 2023 17:39
@jsquyres jsquyres added the bug label Jul 17, 2023
@artpol84 artpol84 requested review from jsquyres and devreal July 17, 2023 19:38
Copy link
Member

@jsquyres jsquyres left a comment

Choose a reason for hiding this comment

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

Per our discussion on #11826 (sorry, it's a little weird that our discussion of this PR got put on the corresponding issue -- not this PR), I'm not a fan of adding an otherwise-meaningless enum, and not explaining it at all in either the git commit or a comment in the code.

I outlined some alternatives on the issue.

@jsquyres
Copy link
Member

#11828 might be a more maintainable fix.

@nivShpak nivShpak force-pushed the pr/opal_args_addr_sanitizer branch from 20866f0 to e3a0f7b Compare July 18, 2023 16:05
@artpol84
Copy link
Contributor

@jsquyres the PR is updated as discussed in the issue

@@ -89,10 +89,11 @@ static bool opal_register_util_done = false;

static char *opal_var_dump_color_string = NULL;

static char *opal_var_dump_color_keys[OPAL_VAR_DUMP_COLOR_KEY_COUNT] = {
static char *opal_var_dump_color_keys[OPAL_VAR_DUMP_COLOR_KEY_COUNT + 1] = {
Copy link
Contributor

Choose a reason for hiding this comment

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

The size should also be changed in the header file:

extern char *opal_var_dump_color[OPAL_VAR_DUMP_COLOR_KEY_COUNT];

Copy link
Contributor

@artpol84 artpol84 Jul 18, 2023

Choose a reason for hiding this comment

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

Thanks! I was thinking of that, but forgot to check! Good catch

Copy link
Contributor

Choose a reason for hiding this comment

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

@devreal should be fixed now

Copy link
Member

Choose a reason for hiding this comment

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

@gkatev What is the relation between opal_var_dump_color_keys and opal_var_dump_color? Is a larger fix needed here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ahh shoot, those are two different arrays 🤦 Not sure opal_var_dump_color needs to change, thanks for pointing that out @jsquyres

Copy link
Contributor

Choose a reason for hiding this comment

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

looks like the similarity in the array names caused some confusion. opal_var_dump_color_keys is the one being fixed in this PR, and opal_var_dump_color is the one in the header file

Copy link
Contributor

Choose a reason for hiding this comment

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

@gkatev What is the relation between opal_var_dump_color_keys and opal_var_dump_color? Is a larger fix needed here?

I think the opal_var_dump_color_keys is for key names and opal_var_dump_color for values

Copy link
Contributor

Choose a reason for hiding this comment

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

color values do not seem considered NULL-terminated, so maybe they don't need an extra element

Copy link
Contributor

@gkatev gkatev Jul 18, 2023

Choose a reason for hiding this comment

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

No, as far as I can tell only the keys array is affected. The keys/values arrays weren't originally meant to be NULL-terminated. Apart from fixing this bug, there might not be another benefit to making them so.

Unless I'm missing something, the only points that the two are passed to opal_argv functions are the two I mentioned in #11826 (comment).

Now, if it proves too peculiar trying to shape the arrays into NULL terminated ones, I would suggest just replacing the two offending calls. I can put together a patch tomorrow and offer it for consideration.

@nivShpak nivShpak force-pushed the pr/opal_args_addr_sanitizer branch 2 times, most recently from 6d10769 to 005bf61 Compare July 18, 2023 16:37
@nivShpak nivShpak force-pushed the pr/opal_args_addr_sanitizer branch from 005bf61 to deb3eb1 Compare July 18, 2023 17:41
nshpak and others added 2 commits July 18, 2023 20:41
Allocate missing element for opal_var_dump_color to ensure
it is NULL-terminated.

Signed-off-by: nshpak <[email protected]>
@jsquyres
Copy link
Member

@gkatev Thank you for identifying the issue and working through the conversation to identify the correct fix. I am closing this PR in favor of #11828, just so that we can close this issue and finally get the fix in. You are correctly identified and credited with finding the issue and the initial fix.

@jsquyres jsquyres closed this Oct 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants