Bystroushaak's blog / English section / Weekly updates / Weekly update 2019/09/15; Finally the bug was found

Weekly update 2019/09/15; Finally the bug was found

Wow, I've got two patrons now. Thanks guys!

After some consideration, I've made a list of patrons visible. I am not sure whether this is smart idea or not.

Your contribution helps not just by giving me more resources to invest into this blog, but also psychologically. It really says out loud, that there are people who care about what I do and who can appreciate it.

I do keep ledger of investments, and I've decided to share information about new purchases with you. This week:

tinySelf progress

Finally, I've found out the bug I've been stuck on for a several weeks. First, I've added a new property .id. and after some consideration, I've changed it from id(self) (python function that returns unique, but quite high numbers like 94611680576792) to static counter from zero. So first created object returns id 0 and so on. This simplified debugging in the pycharm's debugger.

Then I've thrown out old debugging dump to plantuml and rewritten in to new method in Object base class. I've improved it, added much cleaner printout of parameters, slots and also source code.

Now when the code failed, I could invoke the debug method, save generated plantuml code into file and visualize the parent chain of the object.

I've had similar system before, but now I could also modify it to printout dump of all objects in the memory and relations between them:

Important part is in the upper right corner.

This confirmed, that the parent chain is indeed correct and everything should work, so I turned my attention towards the parent caching mechanism. And surely, when I've turned it off, everything worked as expected.

Caching mechanism is in place to prevent lookups via the whole parent chain. Instead, result of the slot lookup in parents is stored in the dictionary along with list of all parents and their versions. Each time the parent is updated (new slot is added, removed, or changed), version is increased. When the slot is resolved next time, versions of whole parent chains are compared (= only something like 5-20 numbers are compared) and only objects that had changed are used for lookups. This speeds the whole parent lookup really tremendously, as there is no need to lookup the value in several dictionaries in the parent chain. It is also source of really complicated bugs.

I did not yet have time to fix the bug, as I've found it late in the afternoon at Friday and I've had my daughter for the evening and also whole Saturday. Since then, I feel sick with cold and slept thru most of the today, so I didn't have time to fix the bug. But at least now I know where it is!


<rant>

I really wish for a different mental architecture of myself. The Coming Software Apocalypse is a little biased article about programmers and software in general, but it does have some really good points about how humans are not good at programming computers.

This bug is really nice example. I can debug one bug, no problem. But three different bugs where one negates the others and acts nondeterministically? I've suspected the caching mechanism from the beginning, but when I turned it off, different bug (which was later fixed) manifested itself and the code still failed. How do you debug stuff like this?

Debugging itself is really just a problem of visualization. If the complexity is too big, our mental architecture can't follow. 7Β±2 rule, limitations of short-term and long-term memory. Cognitive biases. Visualizations can help, because they go around most memory limitations.

Still, I really do feel limited in my mental architecture. It makes me wonder about future, when human will acquire tools like direct neural interface and will merge with AI. Then I get even more frustrated and I get more motivated to work on tinySelf, because that's part of my solution for this problem, with current technology. Rapid creation of user interface and debug visualizations.

</rant>

Book report

I've finished two books this week:

First one had really bad translation into the Czech language, but had some good tips. Not many, but some were important for me.

Second was generally pleasant story about alien artifacts, but I like Annihilation by VanderMeer on the same topic much more. Both books are about unknown and unknowable, but the VanderMeer really drives it much further; we live in the civilization based on repeatability and measurability of the environments and physical laws around us. If the measured object gives different results each time it is measured, it literally can't be understood.

<mild_spoiler>

For example, in the second novel - Authority, there is an artifact brought from the zone in form of a flower that refuses to die. It can live in the darkness of the desk drawer, and it can survive flames. When it is examined on the cellular level, everyone sees something different.

This is really a wonderful idea of something that is just masking itself as a flower. Is it a technology, or maybe something made of exotic matter? Or something that breaks the rules of physics, or maybe it just fucks with minds of the scientists, showing each of them something different on purpose?

I really lowed the Southern reach trilogy because it makes you think about our world, about scientific method and about the unknowable. It also makes me think about debugging, but that's a story for some other time.

</mild_spoiler>

Iterative explorations

I've created new node in the wiki called "Habits I wish I had", where I hope to collect all useful habits which I can then start building.

I've also created node "useful git aliases", where I collect latter. One I find particulary useful is

alias gitb="git branch --sort=-committerdate"

With the optional -r parameter for remote branches.

Results of the "I won't read articles for a week" experiment

I had some success, and I really didn't open RSS reader for a week. On the other hand, I failed miserably, because I've read a lot of articles that were sent to me by friends, or posted on a company's Slack server.

I've consumed a lot of youtube videos. I didn't read a much more books, because I mostly get the urge to read in the work when I am stuck or just want to clear my head.

I've decided to extend the experiment for another week.

Random stuff

I've discovered a lovely series called Carnival Row. It is really brutal, but I fell in love with the world and visuals. This really gives me hope that it would be possible to make a Perdido street station movie.

THE KNOWLEDGE PROJECT by Naval Ravikant is really interesting interview about learning and self improvements.

New episode of Interface. I really love the music:


Yes, my English is probably horrible, but this kind of blog post doesn't qualify for (paid) grammar corrections yet (there is stuff with higher precedence in queue). If you want to change this, subscribe to my patreon.


Relevant discussion

Become a Patron