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

logging can fail with pickling errors for log contents #93

Open
tomerd opened this issue May 6, 2024 · 2 comments
Open

logging can fail with pickling errors for log contents #93

tomerd opened this issue May 6, 2024 · 2 comments

Comments

@tomerd
Copy link

tomerd commented May 6, 2024

running into issues with the logging subsystem, and wanted to see what may be going on / what options one may have:

as background, one of my library dependencies is logging something that cannot be serialized (getting a pickle error), causing an exception in the logging stack and breaking my system. I am using the multiprocTCPBase system (on Linux) and setting ActorSystem::logDefs per the documentation. to avoid this, I can set ActorSystem::logDefs to None, but then getting no logs at all which is also sad

Is there a way to ask the actor system to not meddle with the logging system at all? looking at the code in multiprocCommon I could not see one

@tomerd
Copy link
Author

tomerd commented May 6, 2024

one thing that could help is to be able to filter out specific loggers. in this case, the issue comes from the websocket library that has this logger setup:

if logger is None:
    logger = logging.getLogger("websockets.protocol")
    self.logger: LoggerLike = logging.LoggerAdapter(logger, {"websocket": self})

having self containing attributes that cannot be serialized. this is all out of my control as it is a transitive dependency,

if it is possible to filter these log events from the actor system forwarding via config (leg level, filters etc) that could help solve such problems

@kquick
Copy link
Owner

kquick commented May 6, 2024

Ouch. First, this is clearly an issue Thespian should be able to deal with without crashing the logger. I've renamed this issue to capture that.

There's no filtering like you suggested, although that may be something I could figure out to add in the future along with fixing this issue.

For the immediate term, I believe commenting out these lines will stop the log forwarding (i.e. "meddling with the logging system") and allow you to get something mostly working: https://github.com/kquick/Thespian/blob/master/thespian/system/multiprocCommon.py#L651-L655

@kquick kquick changed the title logging question logging can fail with pickling errors for log contents May 6, 2024
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

2 participants