mirror of
https://github.com/jberkel/sms-backup-plus.git
synced 2026-04-25 17:05:59 +03:00
[GH-ISSUE #1095] [BUG] IO Error - Unable to complete backup; java.io.IOException / java.net.SocketException / com.fsck.k9.mail.MessagingException #876
Labels
No labels
AM+RCS
FAQ
awaiting response
backup
bespoke
bug
calendar
call log
cannot reproduce
cloudless
device-specific
documentation
dual- & multi-SIM
duplicate
feature-request
fixed in beta
good first issue
half-missing
help wanted
helpful
meta
misattribution
mms
other message sources
pull-request
question
rejuvenation
restore
schedule
security
stale
task
thanks
v1.5.1
v1.5.10
v1.5.11
v1.5.2
v1.5.3
v1.5.3
v1.5.4
v1.5.4
v1.5.5
v1.5.5
v1.5.6
v1.5.7
v1.5.8
v1.5.9
v1.6β
xoauth
~$ bounty $~
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/sms-backup-plus-jberkel#876
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @AlexHimself on GitHub (Feb 22, 2023).
Original GitHub issue: https://github.com/jberkel/sms-backup-plus/issues/1095
Originally assigned to: @jberkel on GitHub.
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.
@kurahaupo commented on GitHub (Mar 22, 2023):
@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 commented on GitHub (Mar 22, 2023):
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?
@AlexHimself commented on GitHub (Sep 13, 2023):
I don't suppose there's any solution to this? I haven't had a successful backup since 2020...
@kurahaupo commented on GitHub (Sep 21, 2023):
@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
BYEnotification, and once the process is dead, the OS on the server sends a TCPRSTto 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
LOGOUTto the server.)Arguably this should be treated the same as a received
BYE; I will look and see if any patching is needed.@AlexHimself commented on GitHub (Sep 21, 2023):
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 tranexcept 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!
@kurahaupo commented on GitHub (Sep 21, 2023):
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:
LIMITinto the SQL statement (this was broken by Android 11).@AlexHimself commented on GitHub (Sep 21, 2023):
That sounds like a true fix, but not a minor task I'd think. It would be tremendous if it can be done!