[New-bugs-announce] [issue30829] 'Cannot serialize socket object' after ssl_wrap

Anderson report at bugs.python.org
Sun Jul 2 19:23:29 EDT 2017


New submission from Anderson:

---------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/socketserver.py", line 317, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/opt/storage_server/server_tcp.py", line 121, in process_request
    self.pipes[self.proc_turn][1].send((request, client_address))
  File "/usr/local/lib/python3.6/multiprocessing/connection.py", line 206, in send
    self._send_bytes(_ForkingPickler.dumps(obj))
  File "/usr/local/lib/python3.6/multiprocessing/reduction.py", line 51, in dumps
    cls(buf, protocol).dump(obj)
  File "/usr/local/lib/python3.6/socket.py", line 185, in __getstate__
    raise TypeError("Cannot serialize socket object")
TypeError: Cannot serialize socket object
---------------------------------------

I am trying to send a ssl wrapped socket object (server side) into a pipe to another process using multiprocessing.

Btw, without ssl_wrap it works.

Basically this:

newsocket, fromaddr = self.socket.accept()

connstream = ssl.wrap_socket(newsocket, server_side=True, certfile=self.certfile, keyfile=self.keyfile)

pipe = multiprocessing.Pipe()
proc = multiprocessing.Process(target=proc_run, args=(pipe[0],), daemon=False)
proc.start()

#Error here
pipe[1].send((connstream, fromaddr))

I am sorry if this is intentional.

----------
assignee: christian.heimes
components: SSL
messages: 297526
nosy: Anderseta, christian.heimes
priority: normal
severity: normal
status: open
title: 'Cannot serialize socket object' after ssl_wrap
versions: Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30829>
_______________________________________


More information about the New-bugs-announce mailing list