Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

JeffBezanson
Copy link
Member

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.

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.
@vtjnash
Copy link
Member

vtjnash commented Sep 17, 2015

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:

julia> let STDOUT=STDOUT;
  @spawnat 2 println(STDOUT, "HI")
end

ERROR: cannot serialize a pointer

edit: although it does corrupt the remote worker's deserializer causing it to hang

@JeffBezanson
Copy link
Member Author

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?

@StefanKarpinski
Copy link
Member

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.

@vtjnash
Copy link
Member

vtjnash commented Sep 17, 2015

sounds too complicated to me. plus, what if the user serializes to disk?

@StefanKarpinski
Copy link
Member

You could use some kind of UUID for each node. But maybe it's too complicated.

@ScottPJones
Copy link
Contributor

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.

@ScottPJones
Copy link
Contributor

(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)

@andreasnoack
Copy link
Member

Can this one be merged? It would really make my life more joyful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants