Skip to content

Util.readField is not thread-safe #28

@arjenvanderende

Description

@arjenvanderende

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions