Edgewall Software

Changes between Initial Version and Version 1 of TracTroubleshooting


Ignore:
Timestamp:
Oct 30, 2006, 11:06:31 AM (18 years ago)
Author:
Christian Boos
Comment:

Give some generic tips and tricks page for troubleshooting Trac

Legend:

Unmodified
Added
Removed
Modified
  • TracTroubleshooting

    v1 v1  
     1= Trac Troubleshooting or ''"When Things Go Wrong"'' =
     2
     3Here's a collection of advices you can put into profit when troubleshooting Trac and for helping us to fix bugs.
     4
     5== RTFW (''Read the Fine Wiki'') ==
     6
     7Trac comes with an extensive documentation in the form of a collection of Wiki pages.
     8Some are present in each Trac installation (those part of the TracGuide), most are in this Trac.
     9Among the latter, be sure to go through the TracFaq.
     10
     11A few subsystems have their dedicated page with a troubleshooting section:
     12 - PySqlite#Troubleshooting
     13 - TracSubversion#Troubleshooting
     14 - TracModPython#Troubleshooting
     15
     16Then, use the TracSearch to dig through existing tickets, looking for past issues similar to yours thanks to carefully selected keywords. The Trac ["MailingList"]s are also usually of some help.
     17
     18And don't forget it's a Wiki, so feel free to enhance its content while you're at it.
     19
     20Now, assuming you're facing a new problem, the next step is to try to find out what's really wrong.
     21
     22== Debugging Trac ==
     23
     24=== System Errors ===
     25
     26By system errors, we mean serious issues like segmentation faults or process hangs.
     27This usually involves some C extensions used by Trac, either due to a bug or a misconfiguration in those libraries, or to an incorrect usage within Trac.
     28
     29In this case, the first thing to do is to identify the subsystem involved, by getting the ''stack trace'' of the process. This can be done using `gdb` on Unix or [http://www.microsoft.com/whdc/devtools/debugging/default.mspx WinDbg] on Windows (or MS Developer Studio).
     30
     31==== Debugging Segmentation Faults ====
     32
     33Getting a backtrace for `tracd`
     34{{{
     35$ gdb $(which python)
     36(gdb) run /opt/trac-0.10/scripts/tracd -p 8080 /srv/trac/yourproject
     37}}}
     38(of course, adapt the paths and the options to match what's relevant for you)
     39
     40Getting a backtrace for Apache's `httpd` can be done in a similar way:
     41{{{
     42$ apachectl -k stop
     43$ gdb $(which httpd)
     44(gdb) run -X
     45}}}
     46
     47==== Debugging a Hanging Process ====
     48
     49Here it might be interesting to just "attach" to an already running process:
     50{{{
     51$ ps -ef | grep httpd
     52...
     53$ # note the PID of interest, e.g. 28221
     54$ gdb
     55(gdb) attach 28221
     56Attaching to process 28221
     57Reading symbols from /opt/apache-2.0.55/bin/httpd...done.
     58Using host libthread_db library "/lib64/tls/libthread_db.so.1".
     59Reading symbols from /opt/apache-2.0.55/lib/libaprutil-0.so.0...done.
     60Loaded symbols for ...
     61...
     62(gdb) bt
     63#0  0x0000002a962905af in __accept_nocancel () from /lib64/tls/libpthread.so.0
     64#1  0x0000002a95bc1a84 in apr_socket_accept (new=0x7fbfffd538, sock=0x5b27b0,
     65    connection_context=0xbd2d58) at sockets.c:164
     66#2  0x0000000000477c4d in unixd_accept (accepted=0x7fbfffd560,
     67...
     68(gdb) cont
     69Continuing.
     70
     71<here you can press Ctrl-C>
     72
     73Program received signal SIGINT, Interrupt.
     74[Switching to Thread 182911242432 (LWP 28221)]
     750x0000002a962905af in __accept_nocancel () from /lib64/tls/libpthread.so.0
     76(gdb) detach
     77Detaching from program: /opt/apache-2.0.55/bin/httpd, process 28221
     78(gdb) ^D
     79$
     80}}}
     81
     82In the above, the `Loaded symbols ... ` part usually already interesting.
     83You may find out that the libraries actually used are not the one that you expected, or you might notice interesting things, like the presence of mod_php triggering the load of an alternate sqlite library, etc.
     84That kind of information is also available without `gdb` by looking in the `/proc/28221/maps` file (to reuse the same pid from the above example).
     85
     86The `bt` command is what gives you the "backtrace" of the program, usually the most interesting bit of information. You can also resume execution of the program (using `cont`) and interrupt the process a bit later, to see if it remains hanged in the same area. In case there's no hang (you "attached" to it just for curiosity),  you can also `detach` from the process and it will continue to work unaffected.
     87
     88
     89
     90