Z-Push-contrib icon indicating copy to clipboard operation
Z-Push-contrib copied to clipboard

Resolve syncing loops without resync an entire folder.

Open albertosottile opened this issue 10 years ago • 5 comments

Is there a way to fix a loop on a message that was not delivered because of any reason? The most common cause is that the mobile device was not reachable at the delivery time, which is quite common since we are working with phones and tablets that might not be connected every time.

When a loop happens, the message is not delivered anymore, even if you manually refresh the mail account from the phone. If you check the status of the user (or of the device) from the z-push server (with "./z-push-admin.php -a list -u username" for example) you get something like this:

Attention needed: 1 messages need attention because they could not be synchronized Broken object: 'SyncMail' ignored on '2014-07-09 12:32' Information: Subject: 'subject' - From: 'Sender Name [email protected]' Reason: Message was causing loop (2) Item/Parent id: 361/72351b31

So far, I did not find a way to solve these loops and get the stuck message delivered to the phone. The only thing that solved these problem was to resync the whole account, launching this command from the server: ./z-push-admin.php -a resync -u username -d deviceid This of course takes time because the device has to download again all the messages from the server.

Is there a way to force the server to send again just the stuck message? I tried with options -a fixstates and -a clearloop but they did not work. It would be awesome if such method exists, so one could schedule the delivery of stuck messages and avoid to log on the server and resync everything manually just to get them.

albertosottile avatar Jul 09 '14 18:07 albertosottile

Hi, No, there isn't any method to force sync of a message. You could resync a folder type (messages or contacts or calendar) with z-push-admin.php. In the roadmap there is a feature to resync a folder, maybe for z-push 2.2.

fixestates repairs the state info if it's wrong, only needed to be used when changing versions.

clearloop removes the loop info. If you have "wrong" messages not synced, z-push will limit your sync rate to 1 item/request. Cleaning that info will remove that limit. But it will not retry the messages already marked as broken.

Loop and not synced messages are an issue, that really needs a huge review...

fmbiete avatar Jul 10 '14 03:07 fmbiete

So what do you do when you end with a stuck message? What is the best way with the current state of the program to get the message delivered to the phone?

Also, why the server does not try to deliver all the stuck messages again when the user manually refresh the account from a device?

Thanks :+1:

albertosottile avatar Jul 10 '14 09:07 albertosottile

With the current code, the only sure method to get a stuck message is to resync. You could also try to move the message to another folder, clearloop in the server and resync... but it's too much work.

Z-push tries to send the messages a number of times, after that time it gots marked as problematic and ignored, that info is stored in the status files or db. A refresh will read the info stored in the state files, so it won't retry that message.

Every case I have seen is caused by wrong encodings in the message, I'm trying to fix it in mailparse branch, you can test it :laughing:

Regards

fmbiete avatar Jul 10 '14 09:07 fmbiete

Actually, I am frequently have this problem in places with no wi-fi or cellular signal (e.g. during flights), when I receive a message and my phone does not have connection for, let's say, an hour. So i guess that trying that branch wouldn't work for my issue. Thanks, anyway.

I just increased the number of attempts from 3 to 8, let's see if that will work or not.

albertosottile avatar Jul 10 '14 09:07 albertosottile

is there anything new at this issue?

fpPierre avatar Dec 12 '14 20:12 fpPierre