Debugging docker containers with gdb and nsenter.

Many a time you feel the need to debug a process running inside the container with gdb (or anything that uses ptrace). It is not as straightforward (at least for now) as attaching gdb to host pid of the container process or to docker client/daemon.


You can go about in following ways:

  • If you try to attach gdb to the hostpid (let us call it HPID) of the container process (ie. PID in host namespace), it gives following warning:

  • You can install gdb in container beforehand or with docker exec and attach to the process. However, for a non-privileged container or one which doesn’t have CAP_SYS_PTRACE capability this won’t work. You will get ‘Permission denied’ otherwise. More info on capabilities with docker here.

    Any of the following will do:

    docker run   -d  -i  --cap-add sys_ptrace ---name box centos:centos7 sleep 100000
    docker run   -d  -i  --privileged  --name box centos:centos7 sleep 100000

Continue reading “Debugging docker containers with gdb and nsenter.”

Slides from PLMCE 2014 breakout session

As many of you already know, PLMCE is an annual MySQL
community conference and Expo organized by Percona in the month of April
(usually). It is a great conference, not only to meet new and eminent people in
MySQL and related database fields, but also to attend interesting talks, and
also to give some.

This year I spoke about synchronous replication at a higher level. The talk was
titled “ACIDic Clusters: Review of current relational databases with synchronous replication”. Having previously given talks with boring titles (but interesting content), this time I decided to go with an interesting title, and it seemed to fit well with topic being discussed.
Continue reading “Slides from PLMCE 2014 breakout session”

My twitter setup

I have been using Twitter for a while under the handle randomsurfer.
I tend to use web interface sometimes, but regularly I use the command-line/ncurses interface.

There are two main clients that I use regularly. One is ttytter
which is a nice command-line client which offers advanced functionality such as
creating/editing lists and scripting. Refer to the linked page for more scoop. I
would say ttytter is one of the best implementations of Twitter API. It allows
for advanced scripting like:

The above invocation can be used to get the list of everyone you follow and
populate the configuration file to allow auto-completion at ttytter prompt. You
can also run ttytter as a daemon.
Continue reading “My twitter setup”

Annoying access keys on web pages

HTML access keys were introduced to improve web accessibility and
they still seem to serve that purpose. Wikipedia defines them
as “In a web browser, an access key or accesskey allows a computer user to
immediately jump to a specific part of a web page via the keyboard.”
If you
view hover over the link, it should show up in tooltip; for a wikipedia page,
for instance, the ‘view history’ is mapped to ‘alt-shift-h’ by default. In HTML
source, you can see them as accesskey attribute.

Having said that, they can be really annoying many a time. This is true
primarily when you have bound that access key to a mapping in the browser or in
a plugin or even to a global binding (say, with xbindkeys). What makes it even
more worse is that on almost every site it is impossible to disable them.
Continue reading “Annoying access keys on web pages”

MySQL file limit, table cache and max_connections

MySQL variables open_files_limit, table_open_cache and max_connections are
inter-related, and this is for obvious reasons: all deal with file descriptors
one way or another.

If one of the value is provided but others are left out, mysqld calculates
others using a formula and in some cases, emits a warning if not possible.

The whole calculation behind obtaining the final file descriptor limit is a bit
byzantine and is as follows (for Linux):

EDIT: This applies to MySQL 5.5, in 5.6, as Daniël in comments pointed out,
few things have changed, check comment for details. I will probably make a
followup post on the differences.

  1. First it tries to calculate a minimum requirement based on max_connections
    and table_open_cache. As for other variables, if it is not provided in cnf or
    on command line it uses defaults.

    <br />    /* MyISAM requires two file handles per table. */
        wanted_files= 10+max_connections+table_cache_size*2;

    Continue reading “MySQL file limit, table cache and max_connections”

Saving form data in firefox

When commenting on sites, I have sometimes, seen that the commenting system just swallows the comment, or there is a browser crash, or a system one. In these cases it would be great if you can recover it somehow, particularly when you typed quite a bit.

There are plugins for firefox and other browsers for this. But since I use Pentadactyl(site), I thought not to use any external plugin but write one for dactyl. But then, I realized a plugin may not be needed.

Following is what I use:
Continue reading “Saving form data in firefox”


I finally installed wordpress on my site, replacing the old home-brewed ‘blog’. The next question being why wordpress. Yes, there are many, and yes, WordPress has a history of vulnerabilities. But, I went for WordPress because I felt it was more feature complete and it didn’t require more work from my end, two good reasons for me. As one of my friends pointed out, spinning up a blogging platform based on Django or so wouldn’t have been hard but I didn’t go that way because I didn’t want to maintain it and also, I didn’t want to spend time on that (and I am not good at web ‘stuff). Also, there is another advantage: I can blog from inside emacs (like I did for this) with org2blog, which is awesome in itself. I have been using org-mode for quite a while for time tracking and other purposes, and have found it to be quite good at this; however, note that I still use Vim for everything else (code, editing etc.) though and I still fallback to Evil mode in Emacs.


This is where I will be dumping my mind every now and then. Stay tuned for updates!