[New-bugs-announce] [issue29168] multiprocessing pickle error

Simon Schuler report at bugs.python.org
Thu Jan 5 07:12:48 EST 2017

New submission from Simon Schuler:


the following code doesn't work any longer in the new Python version 3.6.

import sys
import os
import subprocess
from multiprocessing import Pool, Value, Queue
import multiprocessing
import logging
import logging.handlers
import pickle

queue = multiprocessing.Manager().Queue(-1)
qh = logging.handlers.QueueHandler(queue)

It raises the following exception.
>>> TypeError: can't pickle _thread.RLock objects

Furthermore, also for customized logging handler classes it doesn't work anymore.

class CustomHandler(logging.Handler):
    def __init__(self, queue):
        self.queue = queue
    def emit(self, record):
            ei = record.exc_info
            if ei:
                dummy = self.format(record)
                record.exc_info = None  
        except (KeyboardInterrupt, SystemExit):

For a centralized logging facility in a multiprocess environment this is a big problem. How can I handle this in the 3.6 version?

messages: 284738
nosy: cxss
priority: normal
severity: normal
status: open
title: multiprocessing pickle error
versions: Python 3.6

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list