Notes icon indicating copy to clipboard operation
Notes copied to clipboard

Crash / hang when opening a big file without newline

Open Explorer09 opened this issue 1 year ago • 3 comments

Checklist

  • [X] I can reproduce the bug with the latest version given here.
  • [X] I made sure that there are no existing issues - open or closed - to which I could contribute my information.
  • [X] I made sure that there are no existing discussions - open or closed - to which I could contribute my information.
  • [X] I have read the FAQs inside the app (Menu -> About -> FAQs) and my problem isn't listed.
  • [X] I have taken the time to fill in all the required details. I understand that the bug report will be dismissed otherwise.
  • [X] This issue contains only one bug.
  • [X] I have read and understood the contribution guidelines.

Affected app version

1.1.0

Affected Android/Custom ROM version

Android 10

Affected device model

Samsung Galaxy Note 9

How did you install the app?

F-Droid / IzzyOnDroid

Steps to reproduce the bug

  1. Find a big file without newline to open...

The file I found that triggered the crash is the .json file produced by the "Export Notes" function of SimpleMobileTools Notes. (Yes, I tried opening it as a note rather than importing it into Fossify Notes.) The file was about 430000 bytes, without a single newline. Unfortunately for privacy reasons I cannot provide that file.

If you have Termux, you can generate such a file with a very long line, enough to reproduce a crash or hang:

for ((i=1; i<=4000; i++)); do printf '%100d' $((i * 100)); done | sed 's/ /-/g' >very-long-line.txt
for ((i=1; i<=4000; i++)); do printf '%99d\n' $((i * 100 - 1)); done | sed 's/ /-/g' >line-wrapped.txt
  1. In Fossify Notes, bring up the menu (the ellipsis icon in the upper right corner of the screen) → "Open file" function.
  2. Select and open the "very-long-line.txt" just generated within Termux.
  3. Select "Update the file itself at updating the note". (If you don't do this, you will be very difficult to escape the crash once reproduced.)
  4. "New note type: Text Note", then tap "OK".
  5. You should experience things slowing down by now.

Expected behavior

No crash at least. I can tolerate Fossify Notes not showing the whole line or not allowing to edit the file, but there should be no crash.

Actual behavior

Fossify Notes slows down significantly. After trying to bring up "Settings" or "About" from the menu, the app crashes.

Note that if you opened the "line-wrapped.txt" file instead of "very-long-line.txt", there would be no significant slowdown.

(Since Fossify Notes keeps the opened file when the app restarts, you might experience repeated hangs or crashes. To escape from that, delete the "very-long-line.txt" from within Termux.)

Screenshots/Screen recordings

No response

Additional information

No response

Explorer09 avatar Oct 02 '24 00:10 Explorer09

Actually, the file doesn't need to have no lines. Large multiline files (I've tested a 390 kB file with many lines on Android 14) also crash the app, especially if you already have some notes in the app.

Aga-C avatar Nov 20 '24 05:11 Aga-C

@Aga-C does it throw TransactionTooLargeException?

naveensingh avatar Nov 20 '24 06:11 naveensingh

@naveensingh I can't tell. My phone reports an exception in LogCat as java.lang.Throwable, and then there's a timeout on Fossify Notes.

Aga-C avatar Nov 20 '24 08:11 Aga-C