This repository has been archived by the owner on Sep 18, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDIARY.txt
278 lines (172 loc) · 6.98 KB
/
DIARY.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
20:00
It starts! Yay!
20:06
First commit. Skeleton files, but whatever.
20:20
essen at Freenode recommended cowboy_examples as a quick to get up and
running Erlang program. It rocks! clone, make, ./start.sh and it's
up. Now I have something to kill...
20:23
Stupid computer! It rebooted from having a USB camera connected to
its USB port. Happens every now and then.
Oh, well. I'll head for Subway and get some food.
20:35
Sub acquired.
21:03
Program works. I can go home. :-)
Now let's make it a little bit more sophisticated.
22:00
It is fairly sophisticated at killing stuff. The chaos monkey ignores
system processes, and will not do suicide. Everything else is fair
bait.
Unfortunately it shouldn't really be allowed to kill supervisors,
because that breaks one of the Rules of Erlang. Let's see if I can
identify those.
22:12
Well that was ten minutes of making my printouts nicer looking. Hmm.
22:13
So, dear diary. I never told you what the program is supposed to do.
Well it's a process killer. I walks around in your system killing
random processes. Just to see if you will recover. What doesn't kill
you makes you stronger and all that. Well, except in this case it's
"what kills you makes you stronger". So now you know.
22:07
Support has been added for not killing supervisors. Yay!
And I rewrote the whole printout thing.
I have no idea how to avoid killing the Erlang shell.
00:05
Speed of development has slowed down.
lists:filter(fun({P, App, S}) -> App =:= undefined end, [{P, application:get_application(P), pman_process:is_system_process(P)} || P <- erlang:processes()]).
00:30
Freenode #spawnfest rocks. Once again very useful. I did not know
about sys:get_status(whereis(chaos_monkey_sup)). before this. Super.
I got tricked since I was so certain that supervisor was *not* a
gen_server. Which it is of course. Even though it shouldn't for so
many reasons.
00:50
I think I don't add usable code any more. Going home to sleep, and
think a bit about the design.
10:30
I'm back!
The code is sort of doing what it should. There is a huge lot of
improvements that can be made. I think it's time to write some
documentation to see
11:13
Still writing documentation about a future dream scenario. Time to
accept that it won't ever be perfect, and just go back to coding some
of those cool features that have just been described.
11:34
Ok. So *now* the documentation is done. Let's implement it.
Without adding a lot of features! Stay away from those. They are bad
for you.
12:34
Sweet. find_orphans/0 seems to work.
16:20
I forgot all about writing here.
chaos_monkey:on/0 and off/0 work as announced. This is awesome I
think. If I have time I will add configuration options and stuff.
For the time being it works great with some reasonable defaults. It
kills a process every five seconds on average. Should be good enough
to run in most production systems.
I've started looking at havoc/0,1,2 which is more of a single shot
thing. Aim everything at an application and see how it recovers.
Going slowly, but in the right direction.
Anderson Silva is fighting tonight, so there will be a fight break
later today. Hope I can finish a simple version of havoc until then.
16:26
I seriously need a way to identify the shell processes. What I have
found so far is that there are two of them. One which is the actual
shell, and the other which keeps track of the history. They don't
belong to any application.
It is possible to start multiple shells in the same shell session, but
there are still only two shell processes which are not flagged as
system processes.
17:03
Ok, so I know why the shell is so elusive. When running
pman_process:is_system_process in the shell, it is not a system
process. When running the same function from somewhere else, it is.
Gaah.
Anyway, it seems like the answer is inside shell.erl itself. I can us
group:interfaces/1 to find the shell.
17:27
YAY! Freaking rocks.
So the stupid shell process which is a system process when kindly
standing around waiting for something to run and then stops being a
system process as soon as it's doing something, has now been
discovered.
I now have a way of finding out whether a Pid refers to a shell or
not. Let's hope that it stands up in real life. I think so. See
chaos_monkey:is_shell/1 for details.
17:30
Let's have a small break.
17:49
Break over.
18:25
Lots of cleanup of code and documentation. Time to focus on having
some sort of version of havoc ready before going to bed.
20:04
Leaving to watch the UFC fight. The Chaos Monkey can wreck som very
minor havoc. More will have to wait until later.
00:50
Anderson Silva kept his belt. And I got to eat spare ribs. Everyone
is happy.
01:13
The good thing with working alone is that when a commit doesn't
compile, nobody complains. Took me 25 lines and five minutes to have
it compiling again. I hope it works too...
01:45
Major code improvements. Not really moving closer to the goal, but
the code *looks* much nicer.
02:45
I think I'll introduce more bugs than I fix by now. Time to sleep.
See you all tomorrow.
I'll write some placeholder documentation for later.
12:28
I'm back! And only seven and a half hours to go. Yikes! So maybe I
didn't go straight to bed when I wrote the above text. :-)
14:09
Apparently I'm leading the commit-race, and have more than 10% of the
total commits in the whole of Spawnfest. I think that by lines of
code I'm down by the bottom, and by functionality I'm probably around
whatever.
14:21
Now I have all the information I need to do the rest of what I have
planned. How come I can't even build a stupid tree!
15:40
There is a tree structure. Ugly, but hopefully works well enough for
my purposes. I could possibly have used digraph for this, but
whatever. Next time.
15:44
INSTALL written. Should explain things well enough I hope.
16:15
Yikes. 3 hours and change to go. And orphans get killed by the
monkey. The main issue is still a bit away.
17:07
Print a count of max number of processes at which point the tree would
die.
17:20
Better to keep the TODO list in a TODO file.
17:44
Killing 23 processes in cowboy. My system tells me everything goes
down at 23, but that it probably survives 22. Why doesn't this
happen?
17:57
Issue explained. It had to do with the restart strategy of the app.
FIXED!
And with zero lines of code (ok, so maybe ten lines of debug printout,
but who's counting).
18:08
I'm done!
Major cleanup coming up.
18:43
It feels like I'm done now.
Now I just have to wait for that box of Malbec wine to show up. :-)
19:16
Less than an hour to go. Just added more options for on/1, so that
the user can pick which applications to harass.
I'm not sure I dare adding more features. It would be silly to have a
broken application in there when the bell rings.
144 commits, 510 lines of chaos_monkey (excluding _app, _sup, and
app.src), 98 lines of README, 47 lines of INSTALL, and 279 lines of
diary. Lots of features. Heaps of fun.
All in all, two good days of awesome.