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

[Linux] psutil.NoSuchProcess exception can't be pickled #2272

Closed
anthonyryan1 opened this issue Jun 27, 2023 · 0 comments
Closed

[Linux] psutil.NoSuchProcess exception can't be pickled #2272

anthonyryan1 opened this issue Jun 27, 2023 · 0 comments

Comments

@anthonyryan1
Copy link
Contributor

Summary

  • OS: Linux
  • Architecture: 64bit
  • Psutil version: 5.9.5
  • Python version: 3.11.4
  • Type: core, tests

Description

psutil.NoSuchProcess exceptions can't be pickled and sent through a pipe. Normally, one would expect python exceptions to be pickleable so they can be moved.

#!/bin/env python3
import multiprocessing
import psutil

# err = Exception("A standard exception works")
err = psutil.NoSuchProcess(pid=123)

recv_pipe, send_pipe = multiprocessing.Pipe(duplex=False)

send_pipe.send(err)

output = recv_pipe.recv()
# assert isinstance(output, Exception)
assert isinstance(output, psutil.NoSuchProcess)
anthonyryan1 added a commit to anthonyryan1/psutil that referenced this issue Mar 14, 2024
Add __reduce__ method to exceptions commonly thrown, and start
testing that exceptions can be pickled in test_serialization.

Fixes giampaolo#2272

Signed-off-by: Anthony Ryan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant