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

Can this work without getClassLoader? #85

Closed
jeaye opened this issue Aug 28, 2016 · 15 comments
Closed

Can this work without getClassLoader? #85

jeaye opened this issue Aug 28, 2016 · 15 comments

Comments

@jeaye
Copy link

jeaye commented Aug 28, 2016

getClassLoader is apparently not allowed on Google App Engine, where I'd love to run nippy to interface with my datastore. Unfortunately, I get run-time permission errors along the lines of:

Caused by: java.security.AccessControlException:
access denied ("java.lang.RuntimePermission" "getClassLoader") at
java.security.AccessControlContext.checkPermission(AccessControlContext.java:484) at
java.security.AccessController.checkPermission(AccessController.java:698) at
java.lang.SecurityManager.checkPermission(SecurityManager.java:549) at
java.lang.ClassLoader.checkClassLoaderPermission(ClassLoader.java:1609) at
java.lang.ClassLoader.getSystemClassLoader(ClassLoader.java:1528) at
net.jpountz.lz4.LZ4Factory.fastestInstance(LZ4Factory.java:135) at
taoensso.nippy.compression__init.load(Unknown Source) at
taoensso.nippy.compression__init.<clinit>(Unknown Source)

Thanks for the awesome Clojure projects.

@ptaoussanis
Copy link
Member

Hi there, sorry - not familiar with Google App Engine so can't make a recommendation offhand.

@jeaye
Copy link
Author

jeaye commented Aug 29, 2016 via email

@ptaoussanis
Copy link
Member

It is possible to use different compressors and/or no compression, please
see the docs for details.

Not sure if this'll help in your case though assuming it's a compile-time
dependency error?

On Aug 30, 2016 00:05, "jeaye" notifications@github.com wrote:

It looks like nippy is using LZ4Factory to compress, which uses
getClassLoader. Is there a way to use nippy which doesn't compress, or
compresses using something which doesn't use getClassLoader?


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#85 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAJxC2T8RVHnPFKidxv76ibAK04vbY0Hks5qkxFTgaJpZM4JvC8v
.

@jeaye
Copy link
Author

jeaye commented Aug 30, 2016 via email

@ptaoussanis
Copy link
Member

Great, then disabling compression should do the trick.

On Aug 30, 2016 10:33, "jeaye" notifications@github.com wrote:

Not sure if this'll help in your case though assuming it's a compile-time
dependency error?

No, this is a run-time error which happens when I try to freeze data using
nippy's default configuration. Google App Engine prevents the usage of
getClassLoader, among other things, at run-time. Disabling compression
would likely do the trick.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#85 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAJxCxdS5skEwVCUs698VQzony1wnA0Wks5qk6R4gaJpZM4JvC8v
.

@jeaye
Copy link
Author

jeaye commented Aug 30, 2016

Bah, after further inspection this happens on load, at run-time, because of this: https://github.com/ptaoussanis/nippy/blob/master/src/taoensso/nippy/compression.clj#L101 Even if I don't enable encryption or compression, this def is evaluated on load. Ideally, there's a compile-time flag for this or the LZ4Factory isn't created until it's needed.

Can you see a way in which you'd be willing to support this?

@ptaoussanis
Copy link
Member

Happy to consider a PR, otherwise will need a few weeks to be able to look
at this myself.

First step will be confirming that this is the only thing stopping use on
GAE.

Cheers

On Aug 30, 2016 11:37 AM, "jeaye" notifications@github.com wrote:

Bah, after further inspection this happens on load, at run-time, because
of this: https://github.com/ptaoussanis/nippy/blob/master/
src/taoensso/nippy/compression.clj#L101 Even if I don't enable encryption
or compression, this def is evaluated on load. Ideally, there's a
compile-time flag for this or the LZ4Factory isn't created until it's
needed.

Can you see a way in which you'd be willing to support this?


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#85 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAJxC1mGyTZ3yMfhPhny8s7tZAv3Va3gks5qk7OYgaJpZM4JvC8v
.

@mpenet
Copy link
Collaborator

mpenet commented Aug 30, 2016

Just wrapping this global in a c.c/delay should fix that, no?

@ptaoussanis
Copy link
Member

Should do, just have my hands full with other priorities atm- PR welcome with confirmation that that's the only sticking issue for GAE.

@jeaye
Copy link
Author

jeaye commented Sep 1, 2016

On Tue, Aug 30, 2016 at 03:05:06AM -0700, Max Penet wrote:

Just wrapping this global in a c.c/delay should fix that, no?

delay does the trick, for sure; that, combined with some workarounds for tufte and I'm running on GAE now. I'll follow up with a PR.

@ptaoussanis
Copy link
Member

Fix merged, thanks.

@jeaye
Copy link
Author

jeaye commented Sep 11, 2016

Can we get a new version of this on clojars so I can stop using my fork? Thanks very much. 🙇

@ptaoussanis
Copy link
Member

Sure, just pushed [com.taoensso/nippy "2.12.3-alpha1"] to Clojars.

@jeaye
Copy link
Author

jeaye commented Sep 12, 2016 via email

@ptaoussanis
Copy link
Member

No problem :-)

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

No branches or pull requests

3 participants