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

java.io.EOFException InternalCoreHarmony__HarmonyJsonUtilsKt.readHarmony #53

Open
sklinefelter opened this issue Jan 19, 2024 · 4 comments

Comments

@sklinefelter
Copy link

sklinefelter commented Jan 19, 2024

Hi @pablobaxter...it's me...again 🤣 😆 .

Have a nice stacktrace for you from _InternalCoreHarmony__HarmonyJsonUtilsKt.

Harmony: java.io.EOFException: End of input at android.util.JsonReader.nextNonWhitespace(JsonReader.java:835) at
  android.util.JsonReader.nextValue(JsonReader.java:697) at android.util.JsonReader.peek(JsonReader.java:336) at
  com.frybits.harmony.internal._InternalCoreHarmony__HarmonyJsonUtilsKt.readHarmony(HarmonyJsonUtils.kt:57) at
  com.frybits.harmony.internal._InternalCoreHarmony.readHarmony(Unknown Source:1) at
  com.frybits.harmony.HarmonyImpl.readHarmonyMapFromStream(Harmony.kt:291) at
  com.frybits.harmony.HarmonyImpl.initialLoad(Harmony.kt:337) at
  com.frybits.harmony.HarmonyImpl.isLoadedTask$lambda-4(Harmony.kt:173) at
  com.frybits.harmony.HarmonyImpl.$r8$lambda$JbZx2xhqu5H8w8MY6-eFqA-6GOI(Harmony.kt:0) at
  com.frybits.harmony.HarmonyImpl$$ExternalSyntheticLambda1.call(R8$$SyntheticClass:0) at
  java.util.concurrent.FutureTask.run(FutureTask.java:264) at android.os.Handler.handleCallback(Handler.java:938) at
  android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:201) at
  android.os.Looper.loop(Looper.java:288) at android.os.HandlerThread.run(HandlerThread.java:67)

We're getting this EOFException with 1.1.11, but I also believe the latest as well...we upgraded and then reverted.

@pablobaxter
Copy link
Owner

This one might be because the process was killed before the write was allowed to flush. Regular SharedPreferences forces Activities, Broadcast Receivers, and Services to block the main thread on exit if the write queue hasn't completed. (Example)

Either that, or maybe I need to move away from using the internal Android Utils library and use something like GSON or other serialization library that isn't at the whim of Android OS versions of devices.

@pablobaxter
Copy link
Owner

Hey @sklinefelter I have a PR up in #54 that should fix this issue. At the very least, it will provide some better logging, as the kotlinx serialization library provides a better exception message. Feel free to review it (or have the team review it). I won't be merging or publishing these changes until I fix another issue I'm investigating.

@pablobaxter
Copy link
Owner

@sklinefelter I made a release of v1.2.5. Please update and see if the issue is resolved with this verison.

@pablobaxter
Copy link
Owner

@sklinefelter Any update on this?

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