I am trying to track down a segfault in a Julia application. Currently I am
zooming in on "deserialize", as avoiding calling it seems to reliably cure
the problem, while calling it (even if not using the result) seems to
reliably trigger the segfault.
I am using many threads (tasks), and deserialize is called concurrently. Is
this safe? I've been bitten in the past by this; e.g. I've accidentally
added an "info" statement into a sequence of statements that needs to be
atomic, and I/O apparently switches threads. Is there a list of
known-to-be-safe or known-to-be-unsafe functions? Is deserialization
thread-safe in this respect?
I am in particular deserializing function calls and lambda expressions, and
I see global variables ("lambda_numbers", "known_lambda_data"). Are the
respective data structures (WeakKeyDict and Dict) thread-safe?
Is there a locking mechanism in Julia? This would temporarily only allow a
single thread (task) to run, aborting with an error if this thread becomes
unrunnable. In other words, calling "yield" when holding a lock would be a
no-op.
-erik