drupal_add_js causes blocks to be executed twice
I finally discovered two circumstances when blocks are executed twice:

First is adding a missing javascript file, either in theme.info file or in theme_preprocess_page() function using drupal_add_js.

Second is by adding a broken url(..) image reference in a css file which is actually used on the page.

Here are the steps to recreate the problem with css, for javascript it's analogously:


install Drupal (it has Bartik theme as default) and log in, to see
the search box
in a debugger, set a breakpoint inside function search_block_view()
refresh the page and check that the breakpoint is reached once
go to /themes/bartik/css/styles.css line 1467 and change the line containing:


background: url(../images/search-button.png)

into something that does not exist:

background: url(../images/search-button1.png)


refresh the page with shift and check that the breakpoint is reached
twice


Maybe such behavior is obvious for someone more advanced and has rational explanation, but for me it is not obvious and took me a while to discover. Anyway the conclusion is just to make sure that all loaded css and javascript resources are available and nothing is missing, otherwise blocks will be silently executed twice and depending what they contain, the page may load longer.