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

Post fork-removal, remote exception fetching is incorrect #7810

Closed
stuhood opened this issue May 28, 2019 · 3 comments
Closed

Post fork-removal, remote exception fetching is incorrect #7810

stuhood opened this issue May 28, 2019 · 3 comments
Assignees
Labels

Comments

@stuhood
Copy link
Member

stuhood commented May 28, 2019

This code path:

def _extract_remote_exception(self, pantsd_pid, nailgun_error):
"""Given a NailgunError, returns a Terminated exception with additional info (where possible).
This method will include the entire exception log for either the `pid` in the NailgunError, or
failing that, the `pid` of the pantsd instance.
"""
sources = [pantsd_pid]
if nailgun_error.pid is not None:
sources = [abs(nailgun_error.pid)] + sources
exception_text = None
for source in sources:
log_path = ExceptionSink.exceptions_log_path(for_pid=source)
exception_text = maybe_read_file(log_path)
if exception_text:
break
exception_suffix = '\nRemote exception:\n{}'.format(exception_text) if exception_text else ''
return self.Terminated('abruptly lost active connection to pantsd runner: {!r}{}'.format(
nailgun_error, exception_suffix))

...handles fetching the remote exception after a connection is terminated. But because the PID transmitted on connections no longer changes, this strategy is no longer accurate (and in fact, sending the PID to the client this way may not be useful).

@blorente
Copy link
Contributor

I agree, if I understood the flow of NailgunError correctly, the pid in the error should always be the same pid as the daemon or None, which makes this code a bit redundant.

That means that in all cases, this code will fetch any exception triggered by the daemon.

@stuhood
Copy link
Member Author

stuhood commented May 29, 2019

Yep. Perhaps we would need to do something like sending a session id, and passing it around as thread local, similar to the logging settings, and the zipkin trace ids? cc @cattibrie, @illicitonion

@stuhood
Copy link
Member Author

stuhood commented May 11, 2020

This was resolved in d41acdf.

@stuhood stuhood closed this as completed May 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants