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

uwsgi provides false debugging information #2637

Open
aizyuval opened this issue May 1, 2024 · 0 comments
Open

uwsgi provides false debugging information #2637

aizyuval opened this issue May 1, 2024 · 0 comments

Comments

@aizyuval
Copy link

aizyuval commented May 1, 2024

A problem with how uwsgi logs error messages, and therefore makes it harder to debug problems:

#define uwsgi_error(x) uwsgi_log("%s: %s [%s line %d]\n", x, strerror(errno), __FILE__, __LINE__);

This macro expands correctly, but the problem is that when uwsgi_error() is used under functions that are cross-refrenced, mainly in utils.c, uwsgi_error() takes the filename of the file where the function including it resides in, instead of where that function is called.

Example:
uwsgi_malloc() is defined in utils.c, and calls uwsgi_error() if it can't allocate space. No matter where you call uwsgi_malloc, if an error happens - the filename that will be logged will always be 'utils.c' instead of where uwsgi_malloc() was originally called (say in some plugin)!

I have started writing a shell script that will:
change uwsgi_error() definition, and respective definitions of functions that include it, and parents of these functions, to pass filename and line from the original call that will pass __FILE__ and __LINE__.
That way uwsgi will always log the correct line and file that caused the issue!

This will introduce changes all throughout the project.

I think I will get around to it in a few days, If someone else has a better implementation for it, or is faster than me I'm therefore sharing this issue.

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

No branches or pull requests

1 participant