Using bitcoin tag v0.6.2.2, if I press Ctrl+C right after starting bitcoind, it crashes:
Core was generated by `./bitcoind -dns -connect=10.210.1.1'.
Program terminated with signal 6, Aborted.
[#0](/bitcoin-bitcoin/0/) 0x00007fa828e9e3a5 in __GI_raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
64 ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
in ../nptl/sysdeps/unix/sysv/linux/raise.c
(gdb) bt
[#0](/bitcoin-bitcoin/0/) 0x00007fa828e9e3a5 in __GI_raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
[#1](/bitcoin-bitcoin/1/) 0x00007fa828ea1b0b in __GI_abort () at abort.c:92
[#2](/bitcoin-bitcoin/2/) 0x00007fa82c382f38 in undefined_behavior_trap_handler ()
[#3](/bitcoin-bitcoin/3/) 0x00007fa82c139d79 in StopNode () at net.cpp:1707
[#4](/bitcoin-bitcoin/4/) 0x00007fa82bfcb6fb in Shutdown (parg=<optimized out>) at init.cpp:58
[#5](/bitcoin-bitcoin/5/) 0x00007fa82bfcbcd2 in AppInit (argc=<optimized out>, argv=<optimized out>) at init.cpp:118
[#6](/bitcoin-bitcoin/6/) 0x00007fa82bfcbc3a in main (argc=<optimized out>, argv=<optimized out>) at init.cpp:96
The relevant lines of code around net.cpp:1707:StopNode():
1700 bool StopNode()
1701 {
1702 printf("StopNode()\n");
1703 fShutdown = true;
1704 nTransactionsUpdated++;
1705 int64 nStart = GetTime();
1706 for (int i=0; i<MAX_OUTBOUND_CONNECTIONS; i++)
1707 semOutbound->post();
The reason seems to be that semOutbound has not been initialized yet:
(gdb) p semOutbound
$1 = 0
In other words, StopNode() is being called before StartNode().