-
-
Notifications
You must be signed in to change notification settings - Fork 34.3k
Closed
Description
Hello, I meet some bug when I use multiprocessing.shared_memory.ShareableList.
I want to save image bytes in a ShareableList, but some bytes are dropped. My codes are simple,
import numpy as np
fake_data = np.empty([720, 1280], dtype=np.uint8)
shm_list = ShareableList([fake_data.tobytes()])
...
def process(image_bytes: bytes):
data: np.ndarray[np.uint8] = np.frombuffer(image_bytes, np.uint8)
image = data.reshape((720, 1280))
shm_list[0] = image_bytes
print(np.frombuffer(list(shm_list)[0], np.uint8).shape)
print(np.frombuffer(image_bytes, np.uint8).shape)
...
shm_list.shm.close()
shm_list.shm.unlink()
this with the output

it seems some bytes are dropped.
My env
Description: Ubuntu 20.04.4 LTS
python version : Python 3.8.10
This bug can be reproduce on our 2 Thinkpad X1 PC wirh arch x86_64, but normal on aarch64 device.
Thanks for help!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels