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

Weird crash in production #71

Closed
PomepuyN opened this issue Mar 3, 2014 · 12 comments
Closed

Weird crash in production #71

PomepuyN opened this issue Mar 3, 2014 · 12 comments

Comments

@PomepuyN
Copy link

PomepuyN commented Mar 3, 2014

I don't really know where the issue may come from.
I'm getting this kind of crashes in my app:

android.database.sqlite.SQLiteException: no such column: SHADOWMONITOR (code 1): , while compiling: UPDATE USER SET SHADOWMONITOR=?,SHADOWKLASS=?,TOTAL=?,PAGE=?,CURRENT=?,USER_ID=?,USER_NAME=? WHERE ID = ?
       at android.database.sqlite.SQLiteConnection.nativePrepareStatement(SQLiteConnection.java)
       at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:889)
       at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:500)
       at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
       at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58)
       at android.database.sqlite.SQLiteStatement.<init>(SQLiteStatement.java:31)
       at android.database.sqlite.SQLiteDatabase.updateWithOnConflict(SQLiteDatabase.java:1572)
       at android.database.sqlite.SQLiteDatabase.update(SQLiteDatabase.java:1520)
       at com.orm.SugarRecord.save()
       at com.orm.SugarRecord.save()
       at com.npi.muzeiflickr.db.User.incrementCurrent(User.java:76)
       at com.npi.muzeiflickr.api.FlickrSource.onTryUpdate(FlickrSource.java:142)
       at com.google.android.apps.muzei.api.RemoteMuzeiArtSource.onUpdate(RemoteMuzeiArtSource.java:105)
       at com.google.android.apps.muzei.api.MuzeiArtSource.processHandleCommand(MuzeiArtSource.java:639)
       at com.google.android.apps.muzei.api.MuzeiArtSource.onHandleIntent(MuzeiArtSource.java:545)
       at com.npi.muzeiflickr.api.FlickrSource.onHandleIntent(FlickrSource.java:727)
       at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:136)
       at android.os.HandlerThread.run(HandlerThread.java:61)

I tried to search for "SHADOWMONITOR" in both my app the library. I ended up by searching it on Google and I cannot find a reference to this.

Here is the line where the issue comes from: https://github.com/PomepuyN/muzei-flickr/blob/Development/MuzeiFlickr/src/main/java/com/npi/muzeiflickr/db/User.java?source=c#L76

Is the "User" word allowed for DB Tables? If yes, do you have an idea what happens here?

@satyan
Copy link
Collaborator

satyan commented Mar 5, 2014

were you able to determine the cause? I don't see any reason for this error to come.. Is this occasional or regular error?

@PomepuyN
Copy link
Author

PomepuyN commented Mar 5, 2014

Unfortunately, it's not occasional. It's the first source of crashes for my app (21 occurrences today).
Here are the full information about it: http://crashes.to/s/84527a7975b
I made more search about it but I was unable to find where it may come from.

What I don't understand is why there is a mix of valid columns and invalid one.

SHADOWMONITOR (code 1): , while compiling: UPDATE F_GROUP SET SHADOWMONITOR=?,SHADOWKLASS=?,TOTAL=?,GROUP_ID=?,NAME=?,PAGE=?,CURRENT=? WHERE ID = ?

My entity:

public class FGroup extends SugarRecord<FGroup> implements RequestData {

    int total;
    int current;
    String name;
    public String groupId;
    public int page;

    public FGroup() {
        super();
    }

    public FGroup(Context context, String groupId, String name, int page, int current, int total) {
        super();
        this.name = name;
        this.groupId = groupId;
        this.current = current;
        this.total = total;
    }
}

It seems to only occur on "UPDATE" commands but on different entities.

@gaddas
Copy link
Contributor

gaddas commented Mar 5, 2014

It's because the users had ART activated (read more http://source.android.com/devices/tech/dalvik/art.html ). It implements the base type Object with 2 extra fields:

public class Object {
    private transient Class<?> shadow$_klass_;
    private transient int shadow$_monitor_;

I made a pull request, but have missed the 2nd field initially.

@satyan
Copy link
Collaborator

satyan commented Mar 5, 2014

ah.. that explains.. I did go through your pull request, but couldn't test it coz of lack of ART based device.

We could skip the transient fields.. that should be good enough. right?

@satyan
Copy link
Collaborator

satyan commented Mar 5, 2014

@PomepuyN @gaddas Would you be able to test it out.. in SugarRecord.java line no: 360

 for (Field field : typeFields) {
            if (!field.isAnnotationPresent(Ignore.class) && !Modifier.isStatic(field.getModifiers())&& !Modifier.isTransient(field.getModifiers())) {
                toStore.add(field);
            }
        }

@satyan
Copy link
Collaborator

satyan commented Mar 5, 2014

@PomepuyN you can try out the latest 1.3_beta jar.. it has the above change.

@gaddas
Copy link
Contributor

gaddas commented Mar 5, 2014

The example application is working - I tested without the change (got same error) and without (the error was gone).

@satyan
Copy link
Collaborator

satyan commented Mar 5, 2014

Cool.. Thanks

@PomepuyN
Copy link
Author

PomepuyN commented Mar 5, 2014

Great!
Thanks a lot @gaddas
@satyan I will include the new jar and let you know if it solved my issue. I think I will be able to release it tomorrow.

@PomepuyN
Copy link
Author

PomepuyN commented Mar 8, 2014

Ok.
After two days in production, there are no more crashes.
Once again thanks to @gaddas and @satyan 👍

@satyan
Copy link
Collaborator

satyan commented Mar 21, 2014

closing this.. as it looks fixed.

@satyan satyan closed this as completed Mar 21, 2014
@Giorgi
Copy link

Giorgi commented Mar 22, 2014

Perhaps it makes sense not to get fields on base class if the base class is Object so that we avoid crashes in future if Google adds other fields?

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

4 participants