-
Notifications
You must be signed in to change notification settings - Fork 136
Failed tasks no longer store traceback. #7065
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
base: main
Are you sure you want to change the base?
Conversation
pulpcore/tasking/tasks.py
Outdated
| raise ValueError("Immediate tasks must be async functions.") | ||
| raise NonAsyncImmediateTaskError(task_name=task.name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When this happens, it's a programming error. This should not be user visible.
7a4572d to
633d6be
Compare
633d6be to
43966ea
Compare
ffcb19b to
0c2fc24
Compare
673f40c to
f10b3ba
Compare
c0a7cb3 to
fc3aef2
Compare
c216476 to
bbb4420
Compare
pulpcore/app/models/task.py
Outdated
| tb_str = "".join(traceback.format_tb(tb)) | ||
| error = exception_to_dict(exc, tb_str) | ||
| error = {} | ||
| if tb: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this still happen? Don't we just want the error to be a single string like:
"Remote URL not found" or "Internal Error"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we maybe instead add the PLP000X codes here?
pulpcore/exceptions/base.py
Outdated
|
|
||
| def __str__(self): | ||
| return _("Domain name was not found for {}. Check if specified url is valid.").format( | ||
| self.url |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should not leak urls either...
pulpcore/exceptions/base.py
Outdated
| self.url = url | ||
|
|
||
| def __str__(self): | ||
| return _("Domain name was not found for {}. Check if specified url is valid.").format( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Domains in the context of Pulp may be misleading. "URL lookup failed." Should be sufficient.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you have a chance, could you please squash the commits where it makes sense? Also, if you want to sync the branch with main, rebasing instead of creating merge commits would help to keep the history clean.
| return _("Domain name was not found for {}. Check if specified url is valid.").format( | ||
| self.url | ||
| ) | ||
| return _("URL lookup failed.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's more leaked data with the other exceptions.
1d2e063 to
53f2f33
Compare
Tracebacks can expose sensitive information from an exception via the API. This change stops this behavior by only logging tracebacks and not storing them inside of tasks.
53f2f33 to
da90358
Compare
Failed task tracebacks are currently a part of task model, it can expose sensitive information from an exception via the API. This change stops this behavior by only logging tracebacks and not storing them inside of tasks.
_execute_task and _aexecute_task are modified to log tracebacks for unknown exceptions but never save them to the Task record.
Task.set_failed() is updated to make the tb (traceback) argument optional.
A new PulpExceptionNoTraceback base class is added for known, user-facing errors (like a DNS failure) where the traceback is not useful and should not be logged.
A new DnsDomainNameException (inheriting from PulpExceptionNoTraceback) is added to handle DNS lookup failures (e.g., bad remote URLs) as a known user error.