1Perlbal::Manual::DebuggUisnegr(3C)ontributed Perl DocumePnetraltbiaoln::Manual::Debugging(3)
2
3
4
6 Perlbal::Manual::Debugging - Debugging Perlbal
7
8 VERSION
9 Perlbal 1.78.
10
11 DESCRIPTION
12 Perlbal has two ways of debugging.
13
14 One of them is through a management console; the other is through
15 debugging messages.
16
17 Debugging in a console
18 You'll need to set up a management service and use it to dump all the
19 information you require.
20
21 The comprehensive documentation on this process can be found at
22 Perlbal::Manual::Management.
23
24 Debugging messages
25 You can control the ammount of debugging messages Perlbal dumps by
26 setting the environment variable "PERLBAL_DEBUG" to a value between 0
27 and 4:
28
29 PERLBAL_DEBUG = 0 # no debug
30
31 PERLBAL_DEBUG = 4 # debug everything
32
33 Debug level 1
34
35 You can activate basic debug by setting "PERLBAL_DEBUG" to 1:
36
37 PERLBAL_DEBUG = 1
38
39 The following debugging messages are turned on:
40
41 • When a connection to a backend is closed, Perlbal::BackendHTTP
42 prints "Backend $self is done; closing..."
43
44 • When a connection to a backend is killed, Perlbal::ClientProxy
45 prints "Client ($self) closing backend ($backend)"
46
47 • When an HTTP request fails to be parsed, Perlbal::HTTPHeaders
48 prints "HTTP parse failure: $reason"
49
50 • When the connection is promoted to SSL, Perlbal::TCPListener prints
51 " .. socket upgraded to SSL!"
52
53 Debug level 2
54
55 By setting the debug level to 2 you'll get all the messages from level
56 1.
57
58 PERLBAL_DEBUG = 2
59
60 You will also get a few others:
61
62 • When a connection to a backend is opened and ready to be written
63 to, Perlbal::BackendHTTP prints "Backend $self is writeable!"
64
65 • When a response is about to be handled, Perlbal::BackendHTTP prints
66 "BackendHTTP: handle_response"
67
68 • When a backend is ready to be read from, Perlbal::BackendHTTP
69 prints "Backend $self is readable!"
70
71 • When there's an error with the connection to the backend,
72 Perlbal::BackendHTTP prints "BACKEND event_err"
73
74 • Whenever we're determining if we should be sending keep-alive
75 header information back to the client, Perlbal::ClientHTTPBase
76 prints ClientHTTPBase::setup_keepalive($self)
77
78 • Whenever the client is ready for more of its file,
79 Perlbal::ClientHTTPBase prints "REPROXY SSL done"
80
81 • Right after we've read a chunk of a file and when a reproxy request
82 is about to be sent, Perlbal::ClientHTTPBase prints "REPROXY Sent:
83 $sent"
84
85 • When we've written all data in the queue (and are about to stop
86 waiting for write notifications), Perlbal::ClientHTTPBase prints
87 "All writing done to $self"
88
89 • Whenever a client proxy is about to be closed, Perlbal::ClientProxy
90 prints "Perlbal::ClientProxy closed", followed by a possible
91 "again" and a possible "saying $reason"
92
93 • When a client has disconnected, Perlbal::ClientProxy prints
94 "ClientProxy::client_disconnected"
95
96 • When a backend requests a client of a high priority request and the
97 client is available, "Service" in Perlbal prints "Got from fast
98 queue, in front of $backlog others"
99
100 • When a backend requests a client of a normal priority request and
101 the client is available, "Service" in Perlbal prints "Backend
102 requesting client, got PRIORITY = $cp-"{fd}.>
103
104 • When a backend requests a client of a low priority request and the
105 client is available, "Service" in Perlbal prints "Backend
106 requesting client, got low priority = $cp-"{fd}.>
107
108 • When header are being read, Perlbal::Socket prints
109 "Perlbal::Socket::read_headers($self) is_res=$is_res"
110
111 Debug level 3
112
113 PERLBAL_DEBUG = 3
114
115 By setting the debug level to 3 you'll get all the messages from level
116 1 and 2 plus the following:
117
118 • Right before response headers are written to the client,
119 Perlbal::BackendHTTP prints " writing response headers to client"
120
121 • As we're writing to the client, Perlbal::BackendHTTP prints "
122 content_length=VALUE" and " remain=VALUE", where the values are
123 "undef" if they are not defined
124
125 • If we're done writing to the client, Perlbal::BackendHTTP prints "
126 done. detaching."
127
128 • Whenever we're determining if we should be sending keep-alive
129 header information back to the client, Perlbal::ClientHTTPBase
130 prints " service's persist_client = $persist_client"
131
132 • While determining if we should be sending keep-alive header
133 information back to the client, if we were sent "content-length" or
134 it's a head request, as we're doing a keep alive
135 Perlbal::ClientHTTPBase prints " doing keep-alive to client"
136
137 • If we're not sending keep-alive header information back ot the
138 client, Perlbal::ClientHTTPBase prints " doing connection: close"
139
140 • Right after we've finished sending all of the results to the user,
141 Perlbal::ClientProxy prints "ClientProxy::backend_finished"
142
143 • When we've sent a response to a user fully and we need to reset
144 state, Perlbal::ClientProxy prints "ClientProxy::http_response_sent
145 -- resetting state"
146
147 • When we're writing a response to a client, Perlbal::ClientProxy
148 prints "ClientProxy::event_write"
149
150 • After writing a response to a client, if it is still connected and
151 we're triggering trigger our backend to keep reading,
152 Perlbal::ClientProxy prints " unstalling backend"
153
154 • When reading a request, Perlbal::ClientProxy prints
155 "ClientProxy::event_read"
156
157 • When reading a request and just before we read the headers,
158 Perlbal::ClientProxy prints " no headers. reading."
159
160 • When reading a request, if we're not buffering to disk or we're no
161 longer reading, as we disable reads, Perlbal::ClientProxy prints "
162 disabling reads."
163
164 • As we're reading, Perlbal::ClientProxy prints " reading $read_size
165 bytes (VALUE bytes remain)", where "VALUE bytes remain" can be
166 <undef>
167
168 • After each read, Perlbal::ClientProxy prints " read $len bytes"
169
170 • After we finished reading the request, Perlbal::ClientProxy prints
171 " done_reading = $done_reading, backend = BACKEND", where
172 "BACKEND" can be "undef"
173
174 • When we send the headers to the backend and it responds before
175 we're done reading from the client, further reads from the client
176 are discarded; in this situation Perlbal::ClientProxy prints "
177 already responded.". If the client continues to send data,
178 Perlbal::ClientProxy prints " already responded [2]." and then
179 gives up on reading
180
181 • After reading, and having a backend available where we can write
182 to, just before we do, Perlbal::ClientProxy prints " got a
183 backend. sending write to it."
184
185 • After reading, if there's no backend available,
186 Perlbal::ClientProxy prints " no backend. read_ahead =
187 $self-"{read_ahead}.>
188
189 • If we know we've already started spooling a file to disk and we're
190 about to continue doing so, Perlbal::ClientProxy prints " bureason
191 = $self-"{bureason}>
192
193 • If a backend wasn't available and we're about to request one,
194 Perlbal::ClientProxy prints " finally requesting a backend"
195
196 • When we're trying to read headers and the client has disconnected,
197 Perlbal::Socket prints " client disconnected"
198
199 • If we need to remove a trailing "\r\n" from the headers,
200 Perlbal::Socket prints " throwing away leading \r\n"
201
202 • If we've read a packet with headers and by the end of it we can't
203 find the end of them, Perlbal::Socket prints " can't find end of
204 headers"
205
206 • Once we've read some headers, Perlbal::Socket prints " pre-parsed
207 headers: [$hstr]"
208
209 • After reading headers, if there's additional content that we've
210 read, we push it back; when we do so, Perlbal::Socket prints "
211 pushing back $len bytes after header"
212
213 • If we got bogus headers, and right before we close the connection
214 due to a parsing failure, Perlbal::Socket prints " bogus headers"
215
216 • If we got valid headers, Perlbal::Socket prints " got valid
217 headers"
218
219 • If we're reading buffered data from a client, Perlbal::Socket
220 prints "draining readbuf from $self to $dest: [$$bref]"
221
222 Debug level 4
223
224 By setting the debug level to 4 you get all the messages from levels 1
225 to 3.
226
227 Plus, "write" is redefined so that whenever "write" is called it first
228 prints "write($self, <$clen>"$content") from ($pkg, $filename, $line)".
229
230 PERLBAL_DEBUG = 4
231
232 SEE ALSO
233 Perlbal::Manual::Configuration, Perlbal::Manual::Management.
234
235
236
237perl v5.36.0 2023-01-18 Perlbal::Manual::Debugging(3)