laurent22 / joplin

Joplin - the privacy-focused note taking app with sync capabilities for Windows, macOS, Linux, Android and iOS.
https://joplinapp.org
Other
44.97k stars 4.89k forks source link

Mobile: Possible memory leak in `FsDriver.readFileChunk` (affects plugin loading) #10244

Open personalizedrefrigerator opened 5 months ago

personalizedrefrigerator commented 5 months ago

Operating system

iOS

Joplin version

3.0.2

Desktop version info

No response

Current behaviour

Joplin may crash when attempting to load a very large plugin file. (Note: The largest published plugin is about 35 MB).

See https://github.com/laurent22/joplin/pull/10243#issue-2218587807:

*This currently works with Android, testing with larger chunks leads to crashes since Joplin uses RNFS.read which has an unresolved memory leak, my approach works despite the memory leak because Joplin doesn't allow the attachment of +200MB on mobile.

Also see this comment on Joplin's Discord and the upstream issue.

Expected behaviour

It should be possible to quickly work with chunks of large data through FsDriver.readFileChunk.

Logs

No response

personalizedrefrigerator commented 5 months ago

Note that RNFetchBlob.fs.readStream may have a similar issue.

7adidaz commented 5 months ago

Note that RNFetchBlob.fs.readStream may have a similar issue.

it seems like the suggestion of adding readStream will not add anything new since all roads lead to memory leaks.