-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
RFC: allow serializing pointers. fixes #13122 #13190
Conversation
I think this error is too much of a slap on the wrist, and we should just SUASTFD (shut up and send the fancy data). There are cases where a pointer can be sent through no fault of the user, and the error is too brittle.
might need to add some sort of invalidation of many other objects then. For example, this currently protects the user from ub if they accidentally send STDOUT:
edit: although it does corrupt the remote worker's deserializer causing it to hang |
I know, it's problematic, but the approach we have now is "prior restraint" --- we give an error before anything actually goes wrong, causing problems where there wouldn't be otherwise. Would it help at all to serialize pointers as NULL? Maybe then more objects could detect that they are invalid? |
What about serializing pointers together with a node ID and then upon deserialization, deserialize to NULL if the ID is not that node's ID? That way a process could send pointers to itself but if it tried to send a pointer to another node where that pointer is presumably invalid, it would show up as a null pointer. You couldn't send a pointer to another process and get it back then, but I'm not sure how common that is. |
sounds too complicated to me. plus, what if the user serializes to disk? |
You could use some kind of UUID for each node. But maybe it's too complicated. |
Unless you are going to handle passing pointers (into shared memory) around to different processes on the same node by using offsets (and if you have multiple shared memory segments, use a table in each process with the base virtual address, and pass the index with the offset), then I think @StefanKarpinski's idea of just serializing pointers as NULL (or deserializing all pointers as NULL) would be the best thing to do for now. |
(you can have 0 mean NULL, and use a 64-bit value, with say 16-bit segment and 48 bit offset, to deal with multiple shared memory segments, where 1st valid segment is 1). (for 32-bit systems, simply use top 32 for segment, bottom 32 for offset) |
Can this one be merged? It would really make my life more joyful. |
I think this error is too much of a slap on the wrist, and we should just SUASTFD (shut up and send the fancy data). There are cases where a pointer can be sent through no fault of the user, and the error is too brittle.