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

Can't print trace details due to memory allocation issues #1966

Closed
mykaul opened this issue Dec 31, 2020 · 0 comments · Fixed by #1984
Closed

Can't print trace details due to memory allocation issues #1966

mykaul opened this issue Dec 31, 2020 · 0 comments · Fixed by #1984

Comments

@mykaul
Copy link
Contributor

mykaul commented Dec 31, 2020

gf_print_trace() is calling gf_dump_config_flags() which is calling gf_asprintf(), which is calling GF_MALLOC() that might fail for various reasons and thus we may not get a nice trace, just a loop of failures.

The offending line is:

#ifdef PACKAGE_STRING
    {
        char *msg = NULL;
        int ret = -1;

        ret = gf_asprintf(&msg, "package-string: %s", PACKAGE_STRING);   <<<-----
        if (ret >= 0) {
            gf_msg_plain_nomem(GF_LOG_ALERT, msg);
            GF_FREE(msg);
        }
    }
#endif

I suspect we could replace all that with:

#ifdef PACKAGE_STRING
    gf_msg_plain_nomem(GF_LOG_ALERT, "package-string: " PACKAGE_STRING);
#endif

@mykaul mykaul changed the title Can't print q details due to memory allocation issues Can't print trace details due to memory allocation issues Dec 31, 2020
rkothiya pushed a commit to rkothiya/glusterfs that referenced this issue Jan 8, 2021
Printing trace can fail due to memory allocation issues
this patch avoids that.

Fixes: gluster#1966

Change-Id: I14157303a2ff5d19de0e4ece0a460ff0cbd58c26
Signed-off-by: Rinku Kothiya <rkothiya@redhat.com>
@rkothiya rkothiya self-assigned this Jan 8, 2021
rkothiya pushed a commit to rkothiya/glusterfs that referenced this issue Jan 8, 2021
Printing trace can fail due to memory allocation issues
this patch avoids that.

Fixes: gluster#1966

Change-Id: I14157303a2ff5d19de0e4ece0a460ff0cbd58c26
Signed-off-by: Rinku Kothiya <rkothiya@redhat.com>
rkothiya pushed a commit to rkothiya/glusterfs that referenced this issue Jan 8, 2021
Printing trace can fail due to memory allocation issues
this patch avoids that.

Fixes: gluster#1966

Change-Id: I14157303a2ff5d19de0e4ece0a460ff0cbd58c26
Signed-off-by: Rinku Kothiya <rkothiya@redhat.com>
xhernandez pushed a commit that referenced this issue Jan 11, 2021
Printing trace can fail due to memory allocation issues
this patch avoids that.

Fixes: #1966

Change-Id: I14157303a2ff5d19de0e4ece0a460ff0cbd58c26
Signed-off-by: Rinku Kothiya <rkothiya@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants