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

Hawk.put app Freeze #54

Closed
LinkOut opened this issue Jul 17, 2015 · 21 comments
Closed

Hawk.put app Freeze #54

LinkOut opened this issue Jul 17, 2015 · 21 comments
Milestone

Comments

@LinkOut
Copy link

LinkOut commented Jul 17, 2015

App if freezing and what i am doing is :
Hawk.put("test", true);

Why this?

@orhanobut
Copy link
Owner

Do you have any output/stacktrace to find out the issue? Could be something else

@LinkOut
Copy link
Author

LinkOut commented Jul 17, 2015

This is what happening when arrives at the line "Hawk.put("test",true);"

07-17 14:00:13.236 8830-8845/com.showcase.myapp I/art﹕ Background sticky concurrent mark sweep GC freed 91636(6MB) AllocSpace objects, 1(16KB) LOS objects, 6% free, 95MB/101MB, paused 12.591ms total 56.190ms
07-17 14:00:13.250 8830-8842/com.showcase.myapp W/unknown:CloseableReference﹕ Finalized without closing: 147ad8a2 159bc933 (type = NativePooledByteBuffer)
07-17 14:00:13.254 8830-8842/com.showcase.myapp W/unknown:CloseableReference﹕ Finalized without closing: 3b1464f0 20104a69 (type = NativePooledByteBuffer)
07-17 14:00:13.735 8830-8840/com.showcase.myapp W/art﹕ Suspending all threads took: 46.784ms
07-17 14:00:13.741 8830-8845/com.showcase.myapp W/art﹕ Suspending all threads took: 5.518ms
07-17 14:00:13.780 8830-8845/com.showcase.myapp I/art﹕ Background partial concurrent mark sweep GC freed 141100(6MB) AllocSpace objects, 7(26MB) LOS objects, 18% free, 68MB/84MB, paused 11.053ms total 96.966ms
07-17 14:00:14.906 8830-8845/com.showcase.myapp I/art﹕ Background sticky concurrent mark sweep GC freed 321321(15MB) AllocSpace objects, 0(0B) LOS objects, 10% free, 70MB/78MB, paused 7.274ms total 91.327ms
07-17 14:00:15.510 8830-8845/com.showcase.myapp I/art﹕ Background partial concurrent mark sweep GC freed 169084(8MB) AllocSpace objects, 0(0B) LOS objects, 18% free, 70MB/86MB, paused 8.637ms total 105.739ms
07-17 14:00:16.838 8830-8845/com.showcase.myapp I/art﹕ Background sticky concurrent mark sweep GC freed 344093(15MB) AllocSpace objects, 15(181KB) LOS objects, 10% free, 71MB/79MB, paused 13.539ms total 128.486ms
07-17 14:00:17.538 8830-8845/com.showcase.myapp I/art﹕ Background partial concurrent mark sweep GC freed 188494(6MB) AllocSpace objects, 163(2MB) LOS objects, 18% free, 72MB/88MB, paused 12.890ms total 146.342ms
07-17 14:00:18.928 8830-8845/com.showcase.myapp I/art﹕ Background sticky concurrent mark sweep GC freed 355089(11MB) AllocSpace objects, 274(3MB) LOS objects, 9% free, 73MB/81MB, paused 15.859ms total 160.607ms
07-17 14:00:19.686 8830-8845/com.showcase.myapp I/art﹕ Background partial concurrent mark sweep GC freed 195600(6MB) AllocSpace objects, 141(2MB) LOS objects, 17% free, 74MB/90MB, paused 12.849ms total 178.069ms
07-17 14:00:21.182 8830-8845/com.showcase.myapp I/art﹕ Background sticky concurrent mark sweep GC freed 355547(11MB) AllocSpace objects, 230(3MB) LOS objects, 9% free, 75MB/83MB, paused 15.525ms total 169.280ms
07-17 14:00:21.976 8830-8845/com.showcase.myapp I/art﹕ Background partial concurrent mark sweep GC freed 198615(6MB) AllocSpace objects, 125(2MB) LOS objects, 17% free, 76MB/92MB, paused 14.885ms total 189.052ms
07-17 14:00:23.256 8830-8840/com.showcase.myapp W/art﹕ Suspending all threads took: 47.205ms
07-17 14:00:23.381 8830-8845/com.showcase.myapp I/art﹕ Background sticky concurrent mark sweep GC freed 341400(10MB) AllocSpace objects, 199(3MB) LOS objects, 9% free, 77MB/85MB, paused 22.363ms total 226.145ms
07-17 14:00:24.219 8830-8840/com.showcase.myapp W/art﹕ Suspending all threads took: 6.687ms
07-17 14:00:24.241 8830-8845/com.showcase.myapp I/art﹕ Background partial concurrent mark sweep GC freed 201712(6MB) AllocSpace objects, 114(2MB) LOS objects, 16% free, 78MB/94MB, paused 18.897ms total 231.284ms
07-17 14:00:25.640 8830-8845/com.showcase.myapp I/art﹕ Background sticky concurrent mark sweep GC freed 362159(11MB) AllocSpace objects, 191(4MB) LOS objects, 9% free, 80MB/88MB, paused 18.455ms total 196.896ms
07-17 14:00:26.508 8830-8845/com.showcase.myapp I/art﹕ Background partial concurrent mark sweep GC freed 207054(6MB) AllocSpace objects, 105(2MB) LOS objects, 16% free, 80MB/96MB, paused 19.524ms total 242.993ms
07-17 14:00:27.740 8830-8840/com.showcase.myapp W/art﹕ Suspending all threads took: 20.809ms
07-17 14:00:27.938 8830-8845/com.showcase.myapp I/art﹕ Background sticky concurrent mark sweep GC freed 359121(11MB) AllocSpace objects, 173(4MB) LOS objects, 8% free, 82MB/90MB, paused 22.227ms total 227.809ms
07-17 14:00:28.865 8830-8840/com.showcase.myapp W/art﹕ Suspending all threads took: 143.955ms
07-17 14:00:28.883 8830-8845/com.showcase.myapp W/art﹕ Suspending all threads took: 9.136ms
07-17 14:00:28.953 8830-8845/com.showcase.myapp I/art﹕ Background partial concurrent mark sweep GC freed 180135(5MB) AllocSpace objects, 89(2MB) LOS objects, 16% free, 82MB/98MB, paused 31.220ms total 285.652ms
07-17 14:00:30.535 8830-8845/com.showcase.myapp I/art﹕ Background sticky concurrent mark sweep GC freed 358941(10MB) AllocSpace objects, 161(4MB) LOS objects, 8% free, 84MB/92MB, paused 23.857ms total 205.565ms
07-17 14:00:31.552 8830-8845/com.showcase.myapp I/art﹕ Background partial concurrent mark sweep GC freed 209000(6MB) AllocSpace objects, 92(2MB) LOS objects, 15% free, 84MB/100MB, paused 21.562ms total 296.594ms
07-17 14:00:31.557 8830-8845/com.showcase.myapp W/art﹕ Suspending all threads took: 5.546ms
07-17 14:00:33.183 8830-8845/com.showcase.myapp I/art﹕ Background sticky concurrent mark sweep GC freed 359858(11MB) AllocSpace objects, 151(4MB) LOS objects, 8% free, 86MB/94MB, paused 23.724ms total 235.404ms
07-17 14:00:34.243 8830-8840/com.showcase.myapp W/art﹕ Suspending all threads took: 8.744ms
07-17 14:00:34.264 8830-8845/com.showcase.myapp I/art﹕ Background partial concurrent mark sweep GC freed 222670(7MB) AllocSpace objects, 96(2MB) LOS objects, 15% free, 87MB/103MB, paused 24.276ms total 425.424ms
07-17 14:00:34.271 8830-8845/com.showcase.myapp W/art﹕ Suspending all threads took: 6.900ms

@LinkOut
Copy link
Author

LinkOut commented Jul 17, 2015

I have also see something weird...
Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'byte[] com.orhanobut.hawk.Encoder.encode(java.lang.Object)' on a null object reference
at com.orhanobut.hawk.Hawk.zip(Hawk.java:225)
at com.orhanobut.hawk.Hawk.put(Hawk.java:177)

@LinkOut
Copy link
Author

LinkOut commented Jul 17, 2015

Another weird thing!!!!

E/dalvikvm﹕ Could not find class 'com.orhanobut.hawk.Hawk$2', referenced from method com.orhanobut.hawk.Hawk.putObservable

@orhanobut
Copy link
Owner

  • Do you have a large set of stored data already?
  • Did you use Hawk.putObservable() ?

@LinkOut
Copy link
Author

LinkOut commented Jul 18, 2015

  • Yes i have a large set of stored data (about 8000 records)
  • No i m not using Hawk.putObservable().

@orhanobut orhanobut added this to the v1.17 milestone Jul 18, 2015
@orhanobut
Copy link
Owner

Issue might be that a huge amount of data that sharedpreferences cannot handle. Can you try with the new version? I've added sqlite storage option, amount shouldn't be issue anymore.

@LinkOut
Copy link
Author

LinkOut commented Jul 21, 2015

Error:Could not find com.orhanobut:hawk:1.17.

@orhanobut
Copy link
Owner

I reupload the artifacts, apparently had some issues with maven central. It will be available in a few minutes

@LinkOut
Copy link
Author

LinkOut commented Jul 21, 2015

Problem is not solved:

java.lang.IllegalStateException: Couldn't read row 0, col 1 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it.

@LinkOut
Copy link
Author

LinkOut commented Jul 21, 2015

Actually what i am doind is this.

  • Hawk.init(this);
  • Put on hawk a list of 8000 + records
  • After that when i try: Hawk.put("test", true); <- freeze
  • if i dont do the last step i am able to access that 8k records i have saved .

@orhanobut
Copy link
Owner

With the new version you also need to call build()

Hawk.init(this).setStorage(HawkBuilder.newSqliteStorage(this)).build():

then can you put items and try?

@LinkOut
Copy link
Author

LinkOut commented Jul 21, 2015

I have called build
//Hawk.init(this).setStorage(HawkBuilder.newSqliteStorage(this)).build(); <- Thats how i did it.

@orhanobut
Copy link
Owner

and you still get the same error?

@LinkOut
Copy link
Author

LinkOut commented Jul 21, 2015

Yes, actually is not an error, the app is freezing and in the console i got the same "errors" i have posted you before.

@LinkOut
Copy link
Author

LinkOut commented Jul 23, 2015

Ok, after some deep research inside my code i have understand where the problem was. It happens when i try to save to Hawk an object that have a Drawable as an attribute.

So when i try to save that object, the application freeze and the LogCat shows the output i have posted you up there.

It is not important for me to save that Drawable, i can do it in other ways, removing that the problem is solved.

Thanks.

PS: Keep improving this awesome Lib!

@orhanobut
Copy link
Owner

That's great news, just for info, you can also use transient keyword to avoid drawable to be serialized/deserialized

@LinkOut
Copy link
Author

LinkOut commented Jul 28, 2015

When i read from Hawk my 8k Objects the application seems to go in OOM, what i can do to avoid that?

@orhanobut
Copy link
Owner

I cannot think of any good solution for this problem unfortunately.

@orhanobut
Copy link
Owner

I'll close this issue and we can create another oom enhancement maybe but still the problem is caused by memory which hawk cannot do anything apparently.

@LinkOut
Copy link
Author

LinkOut commented Aug 5, 2015

Now i am adding those objects as pieces of 50. No OOM happens anymore.

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