What's the latest on resource sizes / limits?

It seems like there's a bit of a mess regarding attachments, mostly due to restrictions made by various cloud providers. I've seen some docs say it's 10mb, forum posts saying its 4mb in onedrive, and that encryption can change the size of resources to make things unpredictable. Others say that they store quite large files without issues. Some docs say that the mobile apps will straight up crash if you try to open an 11mb resource, and it almost sounded like this was by design?

Is there a comprehensive document about this, or some kind of universal solution we can come up with? Maybe there's a method for breaking resources into multiple chunks, which can then be assembled and disassembled automatically

This part of Joplin seems like the most error prone and lacking. I think as users, the ideal workflow is "you can attach files as big as you want, and not worry about what sync system you're using"

While you are waiting answer from devs I can share my "knowledge".
There is no restriction on file size now. I had flawless syncronization with 50MB attachments on OneDrive, but I am sure it would be OK with GBs too.
The main problem with OneDrive is the size of note itself. Somehow it interferes with encryption. This bug can lead to creating a huge chunk of encrypted text in your note what is impossible to sync with OneDrive. This chink might be 2MB as it was in my issue. So you can experience problem with a small note without attachments and do not experience any problems with GBs attachments.

Another restriction is amount of files in one folder in OneDrive which is 150000. It might be achieved if you have many notes with many attachments.

In my very recent experience, decryption would fail or stall on Android very ungracefully for attachments over 10MB (or so).

I know decryption of attachments that large is not supported. However, my point is that if they try to decrypt, the ability of the system to work around them is very limited. Consequently, I'm ensuring I don't sync any attachment over 10MB.

There is on mobile, 100 MB: https://github.com/laurent22/joplin/blob/06f2fda94643ab20cfba08217a966059d049b030/packages/lib/Synchronizer.ts#L104

Due to the variety of devices and sync providers, it's a bit hard to know what the exact limits are. Before attachments were limited to 10MB because beyond that the fetch module we were using would make the app crash. This module has been fixed, so large attachments should not be a problem anymore.

The other issue is sync. OneDrive has an absurd limit of 4MB when downloading or uploading a file, and beyond that you need to use a separate complex API. A user added support for that API for resources, but not for the notes themselves. And it turns out some users have giant 4MB+ notes and are hitting this issue. I guess that's our main issue now.

As Roman mentioned, we've hard-coded a 100MB limit on mobile although I guess we could increase that.

1 Like

But anything over 10MB still is expected to fail decryption, right?

No but it can take a long time depending on the device.

1 Like

I have a flagship phone that's 2 years old. 9MB attachments work fine but 10, 20, or 30MB crashed the sync process after a file or two. I was on pace to finish decrypting 30 attachments in 2 weeks! Something is wrong I think.

After eliminating the attachments over 10MB, sync didn't crash at all.

It'd be interesting to see the crash log. Any change you could share one?

I reinstalled the app as part of my attempt to give Joplin another shot. That worked for me, but I lost the log on reinstall. Sorry.

I just tried to add a 17mb attachment to Joplin Android by direct Android file share. I got a pop-up telling me attachments larger than 10mb are unsupported because they may crash the app, and that this will be fixed in the future.

So, there's no 100mb limit. It's a 10mb limit currently.

Look's like the error is hard coded by mistake, should be an easy fix.

Are you going to create a PR or are we waiting for @laurent's input?

Do we actually have any limits anywhere else in the code, is this is just an oversight? Shall we keep it and set it to 100MB or remove the limit completely?

I wasn't planning on making a PR, I don't have a mobile environment set up at the moment, and since this is a fairly minor change I don't want to set one up just for it. I can make the change if laurent approves it, but I likely won't test it.

I guess there's the max supported resource size (100MB), and the max recommended resource size (10MB). I think we'll leave it as it is for now as changing this means we should add some UI to warn users if they try to attach a large resource, so it's not just a matter of changing a number.

Personally I do not see any reason to keep the 10Mb limit

Main reason is that some users have very old devices, and we don't want the app to run out of memory or to freeze the phone because they mistakenly attached a big resource to a note (when they could have used something more appropriate to store files).

1 Like

If I recall correctly memory usage does not depend on file size. I mean RAM, of course, not storage.
One exception is maybe when resizing images -- not sure how it's implemented. And maybe encryption as well.

Is it even possible to resize images using Joplin on mobile?

As for encryption, does that work by loaded and encrypting the entire attachment into memory at once?