tolitius / chazel

Hazelcast bells and whistles under the Clojure belt
Eclipse Public License 1.0
72 stars 8 forks source link

Fun Times With Booleans #11

Open joinr opened 4 months ago

joinr commented 4 months ago

I ran into the fascinating case, where a boolean false was truthy according to clojure. Specifically, only when running on a node on the cluster (evaluating a task with some maps that were serialized as part of the task). The net effect is:

user> (if (java.lang.Boolean. false) "this should never occur" "this should always occur")
"this should never occur"

On the thread where the input map was created (with some boolean values), everything is fine. On cluster though, I am guessing that the serialization process invokes (java.lang.Boolean. false) instead of using the specific java.lang.Boolean/FALSE (which clojure seems to expect). This manifested in a filter using :Enabled allowing items with {:Enabled false} to pass, when invoked on a cluster peer.

Any ideas on how to work around this at the serialization level? From what I saw, all your stuff just uses the default Serializable interface and ships stuff over the wire. I have a specific fix for this case, but I wonder if there is a general alteration to the serialization path that can catch this.

Relevant thread:

https://groups.google.com/g/cascading-user/c/6N99titgkjY?pli=1