Slide 1

Slide 1 text

A Bug's Life What If select Is Broken After All? 8th Light, Inc. Colin Jones @trptcolin https://8thlight.com

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

Debugging @trptcolin

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

Tip: “Don’t panic"

Slide 7

Slide 7 text

Tip: “Failing test before fixing code”

Slide 8

Slide 8 text

Tip: “Don’t assume it - prove it”

Slide 9

Slide 9 text

VERY FAST CYCLES

Slide 10

Slide 10 text

Tip: “select isn’t broken”

Slide 11

Slide 11 text

REPL-y @trptcolin

Slide 12

Slide 12 text

REPL-y

Slide 13

Slide 13 text

REPL-y

Slide 14

Slide 14 text

Addressed pain points • Readline bindings in JLine (v1) were lacking • CTRL-C killed the whole REPL • Tab completion didn’t exist

Slide 15

Slide 15 text

Fun to implement!

Slide 16

Slide 16 text

Glue code reply nrepl sjacket clojure-complete jline2 leiningen boot

Slide 17

Slide 17 text

Dependencies!

Slide 18

Slide 18 text

Glue code reply nrepl sjacket clojure-complete jline2 leiningen boot

Slide 19

Slide 19 text

Upstream bugs/features

Slide 20

Slide 20 text

Upstream bugs/features

Slide 21

Slide 21 text

Upstream bugs/features

Slide 22

Slide 22 text

Upstream bugs/features

Slide 23

Slide 23 text

Eventually things were OK

Slide 24

Slide 24 text

Demotivated “Done”

Slide 25

Slide 25 text

The Bug @trptcolin

Slide 26

Slide 26 text

Demotivated “Done”

Slide 27

Slide 27 text

No content

Slide 28

Slide 28 text

IOException Recurso temporariamente indisponível java.io.FileInputStream.readBytes (FileInputStream.java:-2) java.io.FileInputStream.read (FileInputStream.java:255) java.io.BufferedInputStream.fill (BufferedInputStream.java:246) java.io.BufferedInputStream.read (BufferedInputStream.java:265) jline.internal.NonBlockingInputStream.run (NonBlockingInputStream.java:294) java.lang.Thread.run (Thread.java:748) Bye for now!

Slide 29

Slide 29 text

IOException Recurso te java.io.FileInputStrea java.io.FileInputStrea java.io.BufferedInputS java.io.BufferedInputS jline.internal.NonBloc java.lang.Thread.run ( Bye for now!

Slide 30

Slide 30 text

No content

Slide 31

Slide 31 text

No content

Slide 32

Slide 32 text

Tip: “Don’t panic"

Slide 33

Slide 33 text

Reproduce the issue? vs.

Slide 34

Slide 34 text

Reproduce the issue!

Slide 35

Slide 35 text

Reproduce the issue?!?

Slide 36

Slide 36 text

“Works on my machine”

Slide 37

Slide 37 text

“Works on my machine” “What is different between our setups?"

Slide 38

Slide 38 text

Tip: “Don’t panic"

Slide 39

Slide 39 text

Tip: “select isn’t broken”

Slide 40

Slide 40 text

Tip: “select isn’t broken”

Slide 41

Slide 41 text

Tip: “select isn’t broken”

Slide 42

Slide 42 text

No content

Slide 43

Slide 43 text

No content

Slide 44

Slide 44 text

Tip: “Don’t panic"

Slide 45

Slide 45 text

No content

Slide 46

Slide 46 text

No content

Slide 47

Slide 47 text

No content

Slide 48

Slide 48 text

No content

Slide 49

Slide 49 text

“Ubuntu has recently pushed what appears to be a bad kernel update to Ubuntu 18.04 users.”

Slide 50

Slide 50 text

“After lots of debugging and some brief discussion on the LKML, it appears that this is the result of a bug introduced in Linux on 1 November 2018, and fixed on 9 January 2019.”

Slide 51

Slide 51 text

No content

Slide 52

Slide 52 text

No content

Slide 53

Slide 53 text

No content

Slide 54

Slide 54 text

“have not applied the more recent https:// github.com/torvalds/linux/commit/ d3736d82e8169768218ee0ef687188759180 91a0 patch”

Slide 55

Slide 55 text

Tip: Use search • Use rare words • Use rare combinations of words • Use rare phrases

Slide 56

Slide 56 text

“ Broadly prior to the introduction of this bug (i.e for the last 5 years), the program would echo back console input (once enter is pressed), as expected.”

Slide 57

Slide 57 text

“After the introduction of this bug, the program immediately terminates with "Resource temporarily unavailable".”

Slide 58

Slide 58 text

“I have attached to this email a very short c program, which I believe shows the issue.”

Slide 59

Slide 59 text

No content

Slide 60

Slide 60 text

No content

Slide 61

Slide 61 text

No content

Slide 62

Slide 62 text

Tip: Write great bug reports • Omit everything that’s non-essential • Include everything that is essential

Slide 63

Slide 63 text

No content

Slide 64

Slide 64 text

“it optimizes fast-path for tty_reopen(), but more importantly it won't interrupt ongoing IO on the tty”

Slide 65

Slide 65 text

No content

Slide 66

Slide 66 text

No content

Slide 67

Slide 67 text

REPRODUCE THE ISSUE!

Slide 68

Slide 68 text

REPRODUCE THE ISSUE!

Slide 69

Slide 69 text

What now?!

Slide 70

Slide 70 text

What now?! “Not sure if it’s worth trying to build / release a workaround - update your kernels if this affects you?”

Slide 71

Slide 71 text

Best. Comment. Ever.

Slide 72

Slide 72 text

No content

Slide 73

Slide 73 text

What did we learn? @trptcolin

Slide 74

Slide 74 text

Tip: “select isn’t broken”

Slide 75

Slide 75 text

Search engines are your friends!

Slide 76

Slide 76 text

Ask for help!

Slide 77

Slide 77 text

We’re stronger together

Slide 78

Slide 78 text

Tip: “Don’t assume it - prove it”

Slide 79

Slide 79 text

Tip: “Don’t panic"

Slide 80

Slide 80 text

Recommended resources • Book by David Thomas & Andrew Hunt: The Pragmatic Programmer • Talk by Stuart Halloway: “Debugging with the Scientific Method” • Blog by Julia Evans: “What does debugging a program look like?” @trptcolin

Slide 81

Slide 81 text

Recommended resources • Leiningen report: https://github.com/technomancy/leiningen/issues/ 2533 • Spigot (Minecraft server) forum: https://www.spigotmc.org/threads/ ubuntu-18-04-bad-kernel-update.357871/ • Ubuntu bug report: https://bugs.launchpad.net/ubuntu/+source/ linux/+bug/1813873 • linux-console bug report: https://marc.info/?l=linux- console&m=154883021430618&w=2 About this bug @trptcolin

Slide 82

Slide 82 text

Thank you! 8th Light, Inc. Colin Jones @trptcolin https://8thlight.com