portkey

Portkey: from REPL to Serverless in one call
cgrand 2017-10-06T12:43:18.000259Z

Ok, it’s time for an update on “why does it take so long to fix this problem?”

cgrand 2017-10-06T12:44:06.000097Z

As an appetizer: kryo vs collections.

cgrand 2017-10-06T12:44:53.000394Z

When kryo serializes a map, it writes its class id followed by keys and values interleaved.

cgrand 2017-10-06T12:45:19.000103Z

Upon deserialization, it instanciates the class and then call .put for each entry

cgrand 2017-10-06T12:47:15.000287Z

This fails when the map is immutable since .put mutates (and is optional). That’s why we teach it to deal with IPersistentMap differently

cgrand 2017-10-06T12:47:49.000032Z

the other asumption is that from the class alone it can recreate an empty collection.

cgrand 2017-10-06T12:48:15.000144Z

Alas for some classes there’s no default constructor (not even a private one)

cgrand 2017-10-06T12:48:54.000243Z

so objenesis performs a bare allocation were all fields are uninitialized

cgrand 2017-10-06T12:49:31.000069Z

So this guy for example https://docs.oracle.com/javase/7/docs/api/java/security/Provider.html

cgrand 2017-10-06T12:49:52.000468Z

is created as a bare object

cgrand 2017-10-06T12:50:29.000215Z

but then .put is called and what this object does is that it delegates to one of its field which is... uninitialized.

cgrand 2017-10-06T12:52:12.000253Z

so I fixed this by “when no 0-arg ctor, uses field-by-field serialization”

cgrand 2017-10-06T12:52:35.000500Z

</appetizer>

cgrand 2017-10-06T12:54:52.000251Z

The current problem root are org.apache.http.config.Registry instances defined by clj-http

cgrand 2017-10-06T12:58:30.000027Z

which transitively refers many classes, especially in sun.security.*

cgrand 2017-10-06T12:59:18.000139Z

which have to be serialized field by field but apparently they differ between AWS and my JDK

viesti 2017-10-06T13:05:39.000258Z

didn’t yet read your response, but thinking that we don’t have SLA for fixes, working in a way that doesn’t put too much stress 🙂

viesti 2017-10-06T13:37:46.000271Z

hum

viesti 2017-10-06T13:38:08.000129Z

aws lambda uses amazon linux ami

viesti 2017-10-06T13:40:07.000492Z

not the latest AMI apparently, at least on the box that the above lambda lives

viesti 2017-10-06T13:42:21.000356Z

meh, unable to run “java -version” subprocess, apparently

cgrand 2017-10-06T13:43:08.000034Z

not going down this path

viesti 2017-10-06T13:43:15.000807Z

🙂

viesti 2017-10-06T13:43:30.000277Z

yeah well, just remembered that was playing with the above lambda

cgrand 2017-10-06T13:43:35.000584Z

maybe sane serialization can occur at a coarser level for all these security objects

viesti 2017-10-06T13:46:58.000588Z

hmm

viesti 2017-10-06T13:53:14.000379Z

would one have to write a Serializer for each class individually?

viesti 2017-10-06T13:57:34.000315Z

hum