Cannot pickle objects when using unix socket
See original GitHub issueOne of my use-cases is loading a list of containers in one process and then pushing them to be processed in another process, using a standard python queue.
While this method works well with the tcp://
socket, when using the unix://
socket the pickler will throw the following exception:
queue.put((QUEUE_OBJ, obj), block=block)
File "<string>", line 2, in put
File "/usr/local/lib/python3.6/multiprocessing/managers.py", line 756, in _callmethod
conn.send((self._id, methodname, args, kwds))
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)
AttributeError: Can't pickle local object 'UnixAdapter.__init__.<locals>.<lambda>'
On one hand I could just push the IDs of the objects downstream, but I need some of the attributes belonging to the Containers as well, and it makes for quite an inconvenient way of sharing them.
I am not sure if that is the expected behaviour; but the TCP protocol works well enough and I can’t see a reason why UNIX should not.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:4
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Cannot pickle objects when using unix socket -
One of my use-cases is loading a list of containers in one process and then pushing them to be processed in another process,...
Read more >A copied socket is not being pickled - python
The socket is created in rust and is shared as a Python object through PyO3. Here is the shared socket code use pyo3::prelude::*;...
Read more >Serialization of un-picklable objects
First, define functions which cannot be pickled with the standard pickle protocol. They cannot be serialized with pickle because they are defined in...
Read more >sending and receiving Python Objects with sockets
We've learned how to send and receive string data via sockets, and now I want to talk about is pickles. Not the food,...
Read more >How to set up a 'listening' Unix domain socket
import os from socketserver import UnixStreamServer, ... if os.path.exists(SOCKET): os.unlink(SOCKET) with ... Pickled object works fine
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
maintainers? I’m still annoyed of not being able to work on docker-py
containers
withinconcurrent
.Not being able to use multiprocess w/docker api calls is lame. Not doing it out of some misguided stubborn refusal when the fix is near-trivial is ridiculous.