Saturday, April 10, 2010

Google App Engine SDK needs python >= 2.6.4

If you're getting "ImportError: No module named _multiprocessing" when using the Google App Engine SDK:

$ ./google-appengine-sdk/ --debug itrs-test
/home/scottt/work/google-appengine/google_appengine_1.3.2/google/appengine/tools/ DeprecationWarning: the sha module is deprecated; use the hashlib module instead
import sha
/home/scottt/work/google-appengine/google_appengine_1.3.2/google/appengine/tools/ DeprecationWarning: the md5 module is deprecated; use hashlib instead
import md5
INFO 2010-04-09 21:08:33,956] Server:
Allow dev_appserver to check for updates on startup? (Y/n):
dev_appserver will check for updates on startup. To change this setting, edit /home/scottt/.appcfg_nag
INFO 2010-04-09 21:08:37,314] Checking for updates to the SDK.
DEBUG 2010-04-09 21:08:37,317] Sending HTTP request:
POST /api/updatecheck?release=1.3.2&timestamp=1266535890&api_versions=%5B%271%27%5D HTTPS/1.1
X-appcfg-api-version: 1
Content-type: application/octet-stream
User-agent: appcfg_py/1.3.2 Linux/ Python/

INFO 2010-04-09 21:08:38,355] The SDK is up to date.
WARNING 2010-04-09 21:08:38,355] Could not read datastore data from /tmp/dev_appserver.datastore
INFO 2010-04-09 21:08:38,458] Running application itrs-test on port 8080: http://localhost:8080
DEBUG 2010-04-09 21:08:47,801] Matched "/" to CGI dispatcher with path
DEBUG 2010-04-09 21:08:47,841] Could not import "_multiprocessing": Disallowed C-extension or built-in module
ERROR 2010-04-09 21:08:47,846] Exception encountered handling request
Traceback (most recent call last):
File "/home/scottt/work/google-appengine/google_appengine_1.3.2/google/appengine/tools/", line 3185, in _HandleRequest
self._Dispatch(dispatcher, self.rfile, outfile, env_dict)
File "/home/scottt/work/google-appengine/google_appengine_1.3.2/google/appengine/tools/", line 3128, in _Dispatch
File "/home/scottt/work/google-appengine/google_appengine_1.3.2/google/appengine/tools/", line 515, in Dispatch
File "/home/scottt/work/google-appengine/google_appengine_1.3.2/google/appengine/tools/", line 2387, in Dispatch
File "/home/scottt/work/google-appengine/google_appengine_1.3.2/google/appengine/tools/", line 2295, in ExecuteCGI
logging.debug('Executing CGI with env:\n%s', pprint.pformat(env))
File "/usr/lib64/python2.6/logging/", line 1459, in debug
root.debug(*((msg,)+args), **kwargs)
File "/usr/lib64/python2.6/logging/", line 1018, in debug
self._log(DEBUG, msg, args, **kwargs)
File "/usr/lib64/python2.6/logging/", line 1142, in _log
record = self.makeRecord(, level, fn, lno, msg, args, exc_info, func, extra)
File "/usr/lib64/python2.6/logging/", line 1117, in makeRecord
rv = LogRecord(name, level, fn, lno, msg, args, exc_info, func)
File "/usr/lib64/python2.6/logging/", line 272, in __init__
from multiprocessing import current_process
File "/home/scottt/work/google-appengine/google_appengine_1.3.2/google/appengine/tools/", line 1272, in Decorate
return func(self, *args, **kwargs)
File "/home/scottt/work/google-appengine/google_appengine_1.3.2/google/appengine/tools/", line 1922, in load_module
return self.FindAndLoadModule(submodule, fullname, search_path)
File "/home/scottt/work/google-appengine/google_appengine_1.3.2/google/appengine/tools/", line 1272, in Decorate
return func(self, *args, **kwargs)
File "/home/scottt/work/google-appengine/google_appengine_1.3.2/google/appengine/tools/", line 1824, in FindAndLoadModule
File "/home/scottt/work/google-appengine/google_appengine_1.3.2/google/appengine/tools/", line 1272, in Decorate
return func(self, *args, **kwargs)
File "/home/scottt/work/google-appengine/google_appengine_1.3.2/google/appengine/tools/", line 1775, in LoadModuleRestricted
File "/usr/lib64/python2.6/multiprocessing/", line 83, in
import _multiprocessing
ImportError: No module named _multiprocessing

Your options are:
  1. Apply this patch by hand
  2. Upgrade to python >= 2.6.4

See for the details.

Thursday, February 11, 2010

Ftrace Tutorials Ftrace Articles by Steven Rostedt

 Ever wanted to see what functions are called in a running Linux kernel?
    [tracing]# cd /sys/kernel/debug/tracing
[tracing]# echo function_graph > current_tracer
[tracing]# cat trace | head -20
# tracer: function_graph
# | | | | | | |
1) 1.015 us | _spin_lock_irqsave();
1) 0.476 us | internal_add_timer();
1) 0.423 us | wake_up_idle_cpu();
1) 0.461 us | _spin_unlock_irqrestore();
1) 4.770 us | }
1) 5.725 us | }
1) 0.450 us | mutex_unlock();
1) + 24.243 us | }
1) 0.483 us | _spin_lock_irq();
1) 0.517 us | _spin_unlock_irq();
1) | prepare_to_wait() {
1) 0.468 us | _spin_lock_irqsave();
1) 0.502 us | _spin_unlock_irqrestore();
1) 2.411 us | }
1) 0.449 us | kthread_should_stop();
1) | schedule() {

Friday, January 22, 2010

KGDB Tutorial

KGDB Tutorial

Upstrteam documentation: Using kgdb, kdb and the kernel debugger internals by Jason Wessel

Building a Kernel that supports KGDB

menuconfig KGDB
        bool "KGDB: kernel debugging with remote gdb"
        depends on HAVE_ARCH_KGDB
        depends on DEBUG_KERNEL && EXPERIMENTAL
          If you say Y here, it will be possible to remotely debug the
          kernel using gdb.  
        tristate "KGDB: use kgdb over the serial console"
        select CONSOLE_POLL
        select MAGIC_SYSRQ
        default y
          Share a serial console with kgdb. Sysrq-g must be used
          to break in initially.

KGDB Boot and Module Options

  1. Boot with kgdboc=<tty-device>,[baud] (e.g. kgdboc=ttyAMA1 for an integratorcp board emulated by qemu-system-arm, vport0p2 for virtio serial, ttyS0 for a 16550 UART on an x86 etc)
  2. (alternatively) From sysfs
    echo TTY_DEVICE > /sys/module/kgdboc/parameters/kgdboc

Connecting GDB to the Kernel through a QEMU Emulated Serial Port

  • [arm-cross: linux-2.6]$ qemu-system-arm -nographic -s -M integratorcp -kernel ./zImage-2.6.32-integratorcp-v5 -serial tcp:localhost:2345,server -append "console=ttyAMA0 root=/dev/nfs nfsroot=,nfsvers=3 rw ip= kgdboc=ttyAMA0 kgdbwait"
  • [arm-cross: linux-2.6]$ telnet localhost:2345
  • Wait till the telnet session shows "kgdb: Waiting for connection from remote gdb..." then terminate telnet with CTRL-] then CTRL-D
  • [arm-cross: linux-2.6]$ gdb ./vmlinux
  • (gdb) target remote localhost:2345
  • Trouble Shooting: (gdb) set debug remote 1

Connecting GDB to the Kernel through a Physical Serial Port

  • [scottt@2530p linux-2.6]$ gdb ./vmlinux
  • (gdb) set remotebaud 115200
  • (gdb) target remote /dev/ttyS0 # change ttyS0 to the actual serial device on your development machine