Chris Quenelle's Weblog
Thoughts on developer tools.

All | Dbx | Development Tools | Life in General | OpenSolaris | plus | Software Philosophy | Sun Studio

fav comics

« Previous page | Main | Next page »
20070601 Friday June 01, 2007

Debugging tips for threaded programs on Solaris

Phil Harmon wrote a blog entry over a year ago ( Solaris Threads Tunables ) where he mentioned a list of tunable parameters that you can use to fiddle around with the implementation of Solaris libthread. You can fine tune the spin-lock timeouts, and other timing details. But one of the flags that he mentioned is NOT related to tuning libthread. It's more related to debugging your program! Someone on our internal dbx-interest alias asked why their program (which had a bug) was acting different when run under dbx, and the answer turns out to be related to a "sync tracking" flag that dbx turns on by default. It causes somewhat stricter checking of mutex bugs to be turned on.

Anyway, it turns out that if you set the environment variable _THREAD_ERROR_DETECTION to 1 or 2 you can get an extra level of error checking enabled inside libthread. 1 produces warning messages, and 2 produces warning messages and a core file for inspection.

The messages look like this:

*** _THREAD_ERROR_DETECTION: lock usage error detected ***
mutex_lock(0x8047d50): calling thread already owns the lock
calling thread is 0xfeea2000 thread-id 1

Most of the implementation is in libc/port/threads/assfail.c

Posted by Chris Quenelle ( Jun 01 2007, 05:49:21 PM PDT ) - Permalink - -

20070418 Wednesday April 18, 2007

gnome kstats From the department of <Projects I Wish I Had Time To Work On> comes  this gem. There are jillions of  clever applets that I can put on the Gnome panel, and there are lots of APIs (perl, java, etc) that I can use to access Solaris kstats. So why hasn't anyone put the two together yet? There's even a GUI available for kstats. It would be cool to start with some other charting applet (like this one), or you could start with the System Monitor applet that's already there. and hook it up to to kstats data from the Solaris kernel.  It would really show of the observability features of Solaris in a way that the average user can understand.
Posted by Chris Quenelle ( Apr 18 2007, 03:28:06 PM PDT ) - Permalink - Comments [2] -

Older blog entries:

mug shot Chris Quenelle is a tools developer at Sun Microsystems. He's worked on performance and debugging tools at Sun for more than 10 years. He reads comic books and science fiction, and has more tivos than he can keep track of.

Calendar

RSS Feeds

Search

Links

Navigation

Referers