| 1 |
= Bugs |
| 2 |
|
| 3 |
== Introduction |
| 4 |
|
| 5 |
The https://freeradius.org/[FreeRADIUS website] contains most of the |
| 6 |
information referenced in this document. |
| 7 |
|
| 8 |
This document is primarily for non-developers of the FreeRADIUS |
| 9 |
server. If you are able to patch the code to work correctly, then |
| 10 |
we invite you to join the development list to discuss it. If |
| 11 |
you’re the type who know little about how to code, then this is |
| 12 |
the place for you! |
| 13 |
|
| 14 |
== You found a bug |
| 15 |
|
| 16 |
Where the server terminates ungracefully due to a bus error, |
| 17 |
segmentation violation, or other memory error, you should create a new |
| 18 |
issue in the https://freeradius.org/[issue tracker], including |
| 19 |
information from the debugging sections below. |
| 20 |
|
| 21 |
For any other issues, first post and discuss them on the |
| 22 |
https://freeradius.org/support/[FreeRADIUS users list], to |
| 23 |
see if anyone can reproduce them. Often there’s a simple explanation of |
| 24 |
why the server behaves as it does, and it’s not necessarily a bug in the |
| 25 |
code, so browse the lists’ archives of the last two months, and if you |
| 26 |
don’t see messages about it, ask! |
| 27 |
|
| 28 |
If the behavior is correct but confusing, we think that’s a bug too, and |
| 29 |
you should file a bug against our documentation. |
| 30 |
|
| 31 |
For more information about the users list, the lists’ archives and the |
| 32 |
faq, please visit https://www.freeradius.org/list/users.html[FreeRADIUS org]. Please make |
| 33 |
sure to *read* and *respect* the house-rules. You will get much better |
| 34 |
response and much faster if you do! |
| 35 |
|
| 36 |
== Core dumps |
| 37 |
|
| 38 |
If the server (or one of the accompanying programs) core dumps, then you |
| 39 |
should rebuild the server as follows: |
| 40 |
|
| 41 |
``` |
| 42 |
$ ./configure --enable-developer |
| 43 |
$ make |
| 44 |
$ make install |
| 45 |
``` |
| 46 |
|
| 47 |
and then run the program again. You may have to to enable core dumps, |
| 48 |
via: |
| 49 |
|
| 50 |
``` |
| 51 |
$ ulimit -c unlimited |
| 52 |
``` |
| 53 |
|
| 54 |
When it core dumps, do: |
| 55 |
|
| 56 |
``` |
| 57 |
$ gdb /path/to/executable /path/to/core/file |
| 58 |
``` |
| 59 |
|
| 60 |
Enable logging in `gdb` via the following commands: |
| 61 |
|
| 62 |
``` |
| 63 |
(gdb) set logging file gdb-radiusd.log |
| 64 |
(gdb) set logging on |
| 65 |
``` |
| 66 |
|
| 67 |
and follow the instructions in the proceeding section. |
| 68 |
|
| 69 |
You can also enable the `panic_action` given in |
| 70 |
`raddb/radiusd.conf`. See the comments in that file for more details |
| 71 |
about automatically collecting gdb debugging information when the server |
| 72 |
crashes. |
| 73 |
|
| 74 |
== Debugging a live server |
| 75 |
|
| 76 |
If you can’t get a core dump, or the problem doesn’t result in a core |
| 77 |
dump, you may have to run the server under gdb. To do this, ensure that |
| 78 |
you have symbols in the binaries (i.e. a 'non-stripped' binary) by |
| 79 |
re-building the server as described in the previous section. Then, run |
| 80 |
the server under gdb as follows: |
| 81 |
|
| 82 |
``` |
| 83 |
$ gdb radiusd |
| 84 |
``` |
| 85 |
|
| 86 |
Enable logging in `gdb` via the following commands: |
| 87 |
|
| 88 |
``` |
| 89 |
(gdb) set logging file gdb-radiusd.log |
| 90 |
(gdb) set logging on |
| 91 |
``` |
| 92 |
|
| 93 |
Tell `gdb` to pass any necessary command-line arguments to the server: |
| 94 |
|
| 95 |
``` |
| 96 |
(gdb) set args ... |
| 97 |
``` |
| 98 |
|
| 99 |
Where the ``…'' are the command-line arguments you normally pass to |
| 100 |
radiusd. For debugging, you probably want to do: |
| 101 |
|
| 102 |
``` |
| 103 |
(gdb) set args -fxx |
| 104 |
``` |
| 105 |
|
| 106 |
Then, do: |
| 107 |
|
| 108 |
``` |
| 109 |
(gdb) run |
| 110 |
``` |
| 111 |
|
| 112 |
When something interesting happens, you can hit CTRL-C in the window, |
| 113 |
and you should be back at the gdb prompt: |
| 114 |
|
| 115 |
``` |
| 116 |
(gdb) |
| 117 |
``` |
| 118 |
|
| 119 |
And follow the instructions in the next section. |
| 120 |
|
| 121 |
== Obtaining useful information |
| 122 |
|
| 123 |
Once you have a core dump loaded into gdb, or FreeRADIUS running under |
| 124 |
gdb, you may use the commands below to get useful information about the |
| 125 |
state of the server. |
| 126 |
|
| 127 |
If the server was built with threads, you can do: |
| 128 |
|
| 129 |
``` |
| 130 |
(gdb) info threads |
| 131 |
``` |
| 132 |
|
| 133 |
Which will give you information about the threads. If the server isn’t |
| 134 |
threaded, that command-line will print a message saying so. |
| 135 |
|
| 136 |
Then, do: |
| 137 |
|
| 138 |
``` |
| 139 |
(gdb) thread apply all bt full |
| 140 |
``` |
| 141 |
|
| 142 |
If the server isn’t threaded, the `thread apply` section isn’t |
| 143 |
necessary |
| 144 |
|
| 145 |
The output should be printed to the screen, and also sent to the |
| 146 |
`gdb-radiusd.log` file. |
| 147 |
|
| 148 |
You should then submit the information from the log file, along with any |
| 149 |
server output, the output of `radiusd -xv`, and information about your |
| 150 |
operating system to: |
| 151 |
|
| 152 |
https://bugs.freeradius.org/ |
| 153 |
|
| 154 |
Submitting it to the bug database ensures that the bug report won’t get |
| 155 |
forgotten, and that it will be dealt with in due course. |
| 156 |
|
| 157 |
You should provide the issue number in any mail sent to the user’s list. |
| 158 |
|
| 159 |
== Valgrind |
| 160 |
|
| 161 |
On Linux systems, `valgrind` is a useful tool that can catch certain |
| 162 |
classes of bugs. To use it, run the server via: |
| 163 |
|
| 164 |
``` |
| 165 |
$ valgrind --tool=memcheck --leak-check=full radiusd -Xm |
| 166 |
``` |
| 167 |
|
| 168 |
It will print out certain kinds of errors to the screen. There may be a |
| 169 |
number of errors related to OpenSSL, dlopen(), or libtldl. We cannot do |
| 170 |
anything about those problems. However, any errors that are inside of |
| 171 |
the FreeRADIUS source should be brought to our attention. |
| 172 |
|
| 173 |
== Running with `screen` |
| 174 |
|
| 175 |
If the bug is a crash of the server, and it takes a long time for the |
| 176 |
crash to happen, perform the following steps: |
| 177 |
|
| 178 |
* Log in as root. |
| 179 |
* Open a https://www.gnu.org/software/screen/[screen] session: `$ screen bash`. |
| 180 |
* Make sure FreeRADIUS is not running. |
| 181 |
* Make sure you have all the debug symbols about, or a debugable version |
| 182 |
of the server installed (one built with `--enable-developer` as above). |
| 183 |
* Configure screen to log to a file by pressing `Ctrl+a`, then `h`. |
| 184 |
* Type `gdb /path/to/radiusd` (or /path/to/freeradius on Debian). |
| 185 |
* At the `(gdb)` prompt, type `run -X`. |
| 186 |
* Detach from screen with `Ctrl+a`, `d`. |
| 187 |
* When you notice FreeRADIUS has died, reconnect to your screen session |
| 188 |
`$ screen -D -r`. |
| 189 |
* At the `(gdb)` prompt type `where` or for _lots_ of info try |
| 190 |
`thread apply all bt full`. |
| 191 |
* Tell screen to stop logging, `Ctrl+a`, `h`. |
| 192 |
* Logout from screen. |
| 193 |
|
| 194 |
FreeRADIUS Project, copyright 2019 |