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

Util.readField is not thread-safe #28

Open
arjenvanderende opened this issue Apr 25, 2016 · 1 comment
Open

Util.readField is not thread-safe #28

arjenvanderende opened this issue Apr 25, 2016 · 1 comment

Comments

@arjenvanderende
Copy link

We're running a high traffic website hosted on Google AppEngine. When saving an object to the datastore we frequently (every few minutes) run into the follow exception:

siena.SienaException: java.lang.SecurityException: Unable to access relation
    at siena.Util.readField(Util.java:307)
    at siena.gae.GaePersistenceManager.update(GaePersistenceManager.java:508)
    at siena.gae.GaePersistenceManager.save(GaePersistenceManager.java:905)
    at siena.core.PersistenceManagerLifeCycleWrapper.save(PersistenceManagerLifeCycleWrapper.java:110)
    at siena.Model.save(Model.java:87)

From the source I see that Util.readField temporarily makes a Field accessible when a field is non-accessible. I believe that the exception we see is a race condition between two threads where the second thread resets the access of a field (after completing it's .get), when the first thread is just about to .get the value of the same field.

I don't expect this issue to be resolved, but I'm documenting it here for future reference.

@ZiglioUK
Copy link
Collaborator

I've often seen this error. Good suggestion about a threading situation.
I must have surrounded it with a catch, you can see my latest version here:
https://github.com/siena/siena/tree/async

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

2 participants