47
Crash Fast & Furious Pierre-Yves Ricau / @Piwai Run Keeper / morning. End of run, save: crash

Crash Fast & Furious

Embed Size (px)

Citation preview

Page 1: Crash Fast & Furious

Crash Fast &

Furious

Pierre-Yves Ricau / @Piwai

Run Keeper / morning. End of run, save: crash

Page 2: Crash Fast & Furious
Page 3: Crash Fast & Furious

Source: https://t.co/uH1EqxqAow

* Study that’s available on hp.com* Stole slide from Doug Sillars

Page 4: Crash Fast & Furious

Not your fault. Fragmentation, bugs in manufacturer. Lifecycle. Fragments.

Page 5: Crash Fast & Furious

* “Why do they waste their time on this?”* “Why don’t they fix the crashes first?”* Crash: your fault. Even when not your own code is at fault.

Page 6: Crash Fast & Furious

What’s a crash?

Page 7: Crash Fast & Furious

Reminder: Android = linux, 1 app = 1 VM = 1 process

Crash: something bad happen, need to kill that process and restart it.

Page 8: Crash Fast & Furious

1

2

* Threads: exception handler per thread* Exceptions bubble up, delegated to exception handlers* If no handler, goes to static default

Page 9: Crash Fast & Furious

1

2

3

* Focus on crashes in Java land * Uncaught exception delegated to default handler

Page 10: Crash Fast & Furious

1

2

3

4

* main: when program starts * log, dialog, kill.

Page 11: Crash Fast & Furious

* How many people click “Report”? * What do most people do? * Can’t use Play Store Crash reports

Page 12: Crash Fast & Furious

1

2

* You can create your own. * Don’t do that. Client is easy, backend is hard.

Page 13: Crash Fast & Furious

* Crashlytics: closed source, UI for noobs * ACRA: OSS client, free, host your backend * Bugsnag: OSS client, small teams, small API, scaling issues

Page 14: Crash Fast & Furious

Native Crashes

1

2

* Signal sent to the process, need a signal handler * Uses Google breakpad * Fake exception

Page 15: Crash Fast & Furious

First thing to look at?

=> stack trace

Page 16: Crash Fast & Furious

* line numbers => checkout correct version of sources

* Smart stacktrace => stupid

Page 17: Crash Fast & Furious

* Stacktrace: quick fix of simple error * Who started animation, why? * Stacktrace on server: each frame is a layer * Callback => loss of info. Stacktrace not enough.

Page 18: Crash Fast & Furious

Reproducing

* How can we reproduce the crash?

Page 19: Crash Fast & Furious

* Associate customer id to crash* Best is to ask customer what they did.* Great for alpha / internal testing.

Page 20: Crash Fast & Furious

* Startup is the worst. Crash after work is second. * Asking for feedback channels frustration, avoids 1 star reviews.

Page 21: Crash Fast & Furious

* Custom crash dialog that asks for feedback.* Good idea: offer a link to contact support* Emotional connection to customer.

Page 22: Crash Fast & Furious

1

2

3

4

* Can’t ask for feedback while crashing: display popup on restart.* Risky: what if crash on restart. Don’t double restart. Maybe crash dedicated activity + different process.* Twitter & Fb seem to do that.

Page 23: Crash Fast & Furious

Static info

* diff UI, diff code path => isTablet helps identify problem * isTablet: sw600dp * app version number + SHA version numbers for dev builds

Page 24: Crash Fast & Furious

* Picture of what the screen look like at time of crash.* Bitmap? Too big. Upload description of view hierarchy.

Page 25: Crash Fast & Furious

Current screen

* What the user is looking at * Current screen

Page 26: Crash Fast & Furious

1

2

3

Find all windows: Espresso RootsOracle

Page 27: Crash Fast & Furious

* Black box.

Page 28: Crash Fast & Furious

History: high level log

1

2

* Steps of the user + internal state changes * Look at log, reproduce the steps * Navigation + Http calls

Page 29: Crash Fast & Furious

* OkHttp interceptor

Page 30: Crash Fast & Furious

OOM: Stack trace is useless.

Page 31: Crash Fast & Furious

squ.re/leakcanary

Detect memory leaks

Page 32: Crash Fast & Furious
Page 33: Crash Fast & Furious

* UI has validation rules * Bug: somehow not enforced * Crash time: too late to do something about it.

Page 34: Crash Fast & Furious

Exception =

something unexpected happened

What do you do when something unexpected happens and the app crashes?

* We somehow got a blank email

Page 35: Crash Fast & Furious

Defensive programming

* Can’t figure it out. * Fatal condition, shouldn’t happen. Problem ignored. * Payments.

Page 36: Crash Fast & Furious

Offensive programming Crash Fast

2

1

* Detect problems early * Complain as loudly as possible * Quality of code increases * If you can’t understand, make the problem happen earlier, and ship it.

Page 37: Crash Fast & Furious

Exception Grouping

* Exceptions thrown by a common Preconditions class might be grouped together in the crash reporting tool.

Page 38: Crash Fast & Furious

1

2

Page 39: Crash Fast & Furious

More assertions = more crashes.

How to keep low impact on customers?

Page 40: Crash Fast & Furious

Integrations tests

* Writing a feature = writing UI tests * Espresso * Run on VMs, no real devices. Parallelized * 20min total build

Page 41: Crash Fast & Furious

Smoke testing

* Manual QA * Testing parties * Internal and payed external testers

Page 42: Crash Fast & Furious

Dogfood / Beta

* Internal releases: hard, need use case => lunch. * Dogfood at sellers * Betas work better.

Page 43: Crash Fast & Furious

Staged Rollout

* Test the waters

* Ship to 5%, 10%, evaluate crash rate and do minor dot releases

Page 44: Crash Fast & Furious

* Raw crash numbers: not useful * Most important feature: take payments * Crash per transaction

Page 45: Crash Fast & Furious
Page 46: Crash Fast & Furious

• Reproducing • Static info • Flight Recorder • View hierarchy / state • Crash Fast • Staged rollout

Page 47: Crash Fast & Furious

Questions?

[email protected]

@Piwai* We are hiring. SF, NYC, Canada.