Open AlexHimself opened 1 year ago
@AlexHimself Hi,
The IMAP backup assumes an uninterrupted socket connection to the IMAP server.
I run a few apps that require raw TCP sockets, and in all recent versions of Android there are serious problems holding a socket open for more than a few tens of minutes. Typically sockets will time out in less than an hour, but very occasionally I will see a session run uninterrupted all night.
I would be interested to know what's happening on your IMAP server end; how quickly are messages being transferred? Do they flow smoothly, or are there frequent pauses?
Does the "number of messages still to send" go down after each connection, or does it start over sending the same messages again? (Do you see duplicates on the server end?)
This should probably be modified to log out and back in again every so many messages or every so many minutes.
@AlexHimself Hi,
The IMAP backup assumes an uninterrupted socket connection to the IMAP server.
I run a few apps that require raw TCP sockets, and in all recent versions of Android there are serious problems holding a socket open for more than a few tens of minutes. Typically sockets will time out in less than an hour, but very occasionally I will see a session run uninterrupted all night.
I would be interested to know what's happening on your IMAP server end; how quickly are messages being transferred? Do they flow smoothly, or are there frequent pauses?
Does the "number of messages still to send" go down after each connection, or does it start over sending the same messages again? (Do you see duplicates on the server end?)
This should probably be modified to log out and back in again every so many messages or every so many minutes.
That makes sense and good questions.
On my end I see the number of items backed up steadily increase at maybe 1.5 texts/second. I do not see any messages make it to GMail with my SMS label though. I'm still frozen with the last successful one in 2020.
I'm surprised SMSBackup+ doesn't upload texts in batches for both performance and reliability. It could potentially do multiple threads and then each batch could be atomic. That way specific failures with some texts wouldn't impact the other texts from being backed up.
If I had to guess, I'd assume SMSBackup+ does this for the simplicity of tracking the last date/time of SMS's to resume from previously?
I don't suppose there's any solution to this? I haven't had a successful backup since 2020...
@AlexHimself the "IO Error" is simply that the TCP/IP network connection is unexpectedly broken.
Gmail IMAP connections have a time limit of about 70 minutes, after which the IMAP server process at Google's end is abruptly terminated.
This means it doesn't get a chance to send an IMAP BYE
notification, and once the process is dead, the OS on the server sends a TCP RST
to shut down the socket connection.
That in turn means that the client unexpected sees "End of File" when it tries to read from the socket, which it treats as an IO Error. (Or alternatively, that it gets an IO Error when it tries to send LOGOUT
to the server.)
Arguably this should be treated the same as a received BYE
; I will look and see if any patching is needed.
@AlexHimself the "IO Error" is simply that the TCP/IP network connection is unexpectedly broken.
Gmail IMAP connections have a time limit of about 70 minutes, after which the IMAP server process at Google's end is abruptly terminated.
This means it doesn't get a chance to send an IMAP
BYE
notification, and once the process is dead, the OS on the server sends a TCPRST
to shut down the socket connection.That in turn means that the client unexpected sees "End of File" when it tries to read from the socket, which it treats as an IO Error. (Or alternatively, that it gets an IO Error when it tries to send
LOGOUT
to the server.)Arguably this should be treated the same as a received
BYE
; I will look and see if any patching is needed.
Ahhh. If I'm understanding you correctly, it sounds like the app is opening a persistent connection, uploading, and then Google is forcing a timeout and disconnecting. It seems this is being treated like a SQL begin tran
/commit tran
except it never commits so it just discards everything uploaded?
Would a simple solution be to just close/reopen the connection every 10 minutes or so? Thanks for the great info/reply!
The timeout is sometimes a lot shorter. I suspect it's actually a process run-time limit, and if it's already been servicing other clients for 65 minutes, it'll die after only 5 minutes.
So several things need fixing:
LIMIT
into the SQL statement (this was broken by Android 11).That sounds like a true fix, but not a minor task I'd think. It would be tremendous if it can be done!
Expected behaviour
Backup should complete successfully or at least partially complete. It seems like it's ALL or nothing.
Actual behaviour
Attempted 5 times and it errored each time after a period of time (5-60 minutes?) with the following logs:
Attempt 1:
Attempt 2: I have many SMS message to backup and it would take a while, so I suspected battery optimization features may be putting the app to sleep or interfering in some way so for the second attempt I did:
Battery and Device Care> Memory > Excluded apps
- Exclude SMS Backup+Battery and Device Care > Battery > Background usage limits > Never sleeping apps
- Add SMS Backup+Attempts 3,4,5
Each of these I just clicked "backup now".
Reproduce by
Attempt to backup many SMS/MMS messages. Unsure how to reproduce.
Android version
13 (2022)
Phone brand
Samsung Galaxy
Phone model number
S22+
SMS Backup+ version
v1.5.11
Messaging app
Google Messages
Other details
It seems like SMS Backup+ should batch backup messages so that a failure doesn't prevent all progress. Or for large backups of many SMS's, it can chip away at it over time.