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

ModelCache can be unloaded by the VM #31

Open
clydebarrow opened this issue Dec 16, 2012 · 3 comments
Open

ModelCache can be unloaded by the VM #31

clydebarrow opened this issue Dec 16, 2012 · 3 comments

Comments

@clydebarrow
Copy link

ModelCache is an abstract class that is only ever used through static method calls. It has static initiializers and also requires an explicit call to populate the cache. However, since no instance of ModelCache ever exists, it is possible for the VM to unload the class. It then gets reloaded the next time one of the static methods is called, but at this time the cache is re-created, and is empty. This leads to an exception, e.g

com.orm.androrm.NoSuchFieldException: No field named hasNew was found in class     ForumThread! Choices are: [date, endpoint, forum, hasNew, lastFetched, mine, nextToRead, nextUpdated, ordinal, postId, posts, subject, synced, totalPosts, unseen, url, watched, mId]
    at com.orm.androrm.Model.raiseFieldExecption(Model.java:181)
    at com.orm.androrm.Model.getField(Model.java:208)
    at com.orm.androrm.Model.getField(Model.java:204)
    at com.orm.androrm.QueryBuilder.getFieldInstance(QueryBuilder.java:169)
    at com.orm.androrm.QueryBuilder.buildQuery(QueryBuilder.java:101)
    at com.orm.androrm.QueryBuilder.buildQuery(QueryBuilder.java:74)
    at com.orm.androrm.QuerySet.filter(QuerySet.java:113)

This bug has been observed in production code when the app has been paused for some time.

@OnlyInAmerica
Copy link

I've experienced this issue.

@clydebarrow
Copy link
Author

I have fixed this in the Androrm fork I have on Github. I'm not sure it can be easily merged back to the original fork since there have been major changes on both forks.

@frontendphil
Copy link
Member

Thanks for the work you have put into this! I won't be able to have a look at it until after the holidays but I will try to integrate it ASAP when I'm back :)

So long, merry Christmas to you and your loved ones!

Sent from my iPhone

On 23.12.2012, at 11:41, clydebarrow notifications@github.com wrote:

I have fixed this in the Androrm fork I have on Github. I'm not sure it can be easily merged back to the original fork since there have been major changes on both forks.


Reply to this email directly or view it on GitHub.

@ghost ghost assigned frontendphil Dec 23, 2012
@frontendphil frontendphil removed their assignment Dec 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants