z-push debugging

13
Z-Push: advanced debugging Sebastian Kummer

Upload: zarafa

Post on 07-Dec-2014

2.606 views

Category:

Technology


0 download

DESCRIPTION

Presentation of Sebastian Kummer about debugging Z-Push at Zarafa SummerCamp 2011

TRANSCRIPT

Page 1: Z-Push debugging

Z-Push: advanced debuggingSebastian Kummer

Page 2: Z-Push debugging

Debugging Z-Push

Most of the time you don't see issues immediately!

Debugging is not that easy:

You need logs, they will be

Page 3: Z-Push debugging

What “usually” goes wrong – States Problems with states

• missing permissions• missing states after upgrading

States represent the synchronization state of mobile & folder on server

Missing states mean:• Server “does not know” what is already on the mobile, sends

EVERYTHING again → duplications on mobile• Some stuff (like sending, creating & editing items) “works” somehow• Could cause loops

In Z-Push 2 a mobile will be fully resynchronized when states are missing or invalid → missing states for many users could cause HIGH LOAD!

Page 4: Z-Push debugging

What “usually” goes wrong – Old versions

Old versions – especially 1.2.x and 1.3.x:• Compatibility issues

• Fields not being synchronized• Some invitations/recurrences broken (also with 1.4.x)

• Unimplemented features• Broken encodings - “Vielen Dank fÃŒr Ihre – Reservierung”

• Nokia issues (duplicated folders)

Page 5: Z-Push debugging

What “usually” goes wrong – Loops

Loops• Creating 1000000(0000000000) duplicates• High load on server• High use of mobile bandwidth (could $$$$)

Loops are nasty and dynamic! Requests are triggered BY THE MOBILE.

Most common causes:• Broken items (most of times calendar, e.g. recurrences)• Timeouts (server takes to long to process request)• Fatal errors or Apache/PHP Segfaults (rarely)• Incompatibilities (mobile tries over and over again)

Page 6: Z-Push debugging

Approaching loops - I

time

Mobile Server

Idle Has a change

Synch. request

Waits for answer

Idle

1. Reads state2. calculates delta3. exports change4. MAPI → ActiveSync5. streams change to mobile6. writes new state

Failure!

Any step (1-6) can fail!Any step could take to long!Segfault could occur!Connection could fail (entering tunnel?)

This is what you see in the log

TimeoutSEGFAULT

Retry

Page 7: Z-Push debugging

Approaching loops - II

time

Mobile Server

Idle Has a 'broken' change

Synch. request

Waits for answer

ERROR

1. Reads state2. calculates delta3. exports change4. MAPI → ActiveSync5. streams change to mobile6. writes new state

Success!

Faulty item is sent to the mobile!Mobile does not know how to interpret item → error!

Processes answer

This is what you see in the log – looks great!

Retry

Page 8: Z-Push debugging

Approaching loops - II

time

Mobile Server

Idle Has a 'broken' change

Synch. request

Waits for answer

ERROR

1. Reads state2. calculates delta3. exports change4. MAPI → ActiveSync5. streams change to mobile6. writes new state

Success!

Faulty item is sent to the mobile!Mobile does not know how to interpret item → error!

Processes answer

This is what you see in the log – looks great!

'Broken' ...?

Syntactical errors - Missing elementary properties, like subject - Missing start or end date of calendar item

Semantic errors - start date after end date - value not as expected (e.g. string vs. hex) - Recurrence exception: - missing/faulty basedate - not a recurrence at all (syntax)

Retry

Page 9: Z-Push debugging

'Kamikaze loop' - III

time

Mobile Server

Has NEW item Has a ('broken') change

Synch. request

Waits for answer

ERROR

1. Reads state2. creates item on server3. calculates delta4. exports changes5. MAPI → ActiveSync6. streams new ID 7. streams changes8. writes new state

Success/failure!

Anything after 2 fails..Anything else goes wrong (previous slides)

This is what you see in the log – looks great!

Retry

or timeout...

Doesn't reallymatter...

Page 10: Z-Push debugging

Kamikaze user

Page 11: Z-Push debugging

How an iPhone receives an email“ I can see the first lines of the mail in the preview, but when I open it

just says 'no body available'.....! “

time

iPhone Server

Idle Has a change

Synch. request

Fetch entire mail

Idle

Waits and processesSuccess

Retrieving and processing

Only 1K of plain email

ProcessingFailure

1. Retrieving 2. Processing as RFC822

Fetch with HTML

SEGFAULT

Page 12: Z-Push debugging

How to fix?

Error checking in loops• some syntax checking• only few semantics checks possible• Force lower maxItems

• Logging on user level • New log levels, incl. Deviceid (when synching several devices with same account

Page 13: Z-Push debugging

Questions?

Thank you for your attention!

More information at:http://z-push.sf.net/forumshttp://z-push.sf.net/trackerhttp://z-push.sf.net/downloadhttp://z-push.sf.net/compatibility

Contact: [email protected]