Perlba...ugging(3pm)
π NAME π
Perlbal::Manual::Debugging β this is the 3pm page, and it's literally all about Debugging Perlbal. πβ¨ Bestie, if Perlbal is acting mysterious, this is where you find out why.
π VERSION
Perlbal 1.78. That's the version, no cap. π
β¨ DESCRIPTION β¨
Okay so here's the tea: Perlbal has two ways of debugging. Two. Not three, not a vibe-based amount β two. π«Ά
One of them is through a management console; the other one is through debugging messages. Pick your fighter.
π Debugging in a console
For this route you'll need to set up a management service and use it to dump all the information you require. That's the whole assignment. π
The comprehensive documentation on this process can be found at Perlbal::Manual::Management β go read it, it ate. π
π’ Debugging messages
Here's the main character energy: you can control the amount of debugging messages Perlbal dumps by setting the environment variable PERLBAL_DEBUG to a value between 0 and 4:
PERLBAL_DEBUG = 0 # no debug
PERLBAL_DEBUG = 4 # debug everything
So 0 is giving silent treatment and 4 is giving oversharing-on-main. The range is real, respect the range. π
πΌ Debug level 1
You can activate basic debug by setting PERLBAL_DEBUG to 1:
PERLBAL_DEBUG = 1
The following debugging messages are turned on:
- When a connection to a backend is closed,
Perlbal::BackendHTTPprints"Backend $self is done; closing..." - When a connection to a backend is killed,
Perlbal::ClientProxyprints"Client ($self) closing backend ($backend)" - When an HTTP request fails to be parsed,
Perlbal::HTTPHeadersprints"HTTP parse failure: $reason" - When the connection is promoted to SSL,
Perlbal::TCPListenerprints" .. socket upgraded to SSL!"
Four little messages, and honestly? They're iconic. π₯
β¨ Debug level 2
By setting the debug level to 2 you'll get all the messages from level 1.
PERLBAL_DEBUG = 2
You will also get a few others:
- When a connection to a backend is opened and ready to be written to,
Perlbal::BackendHTTPprints"Backend $self is writeable!" - When a response is about to be handled,
Perlbal::BackendHTTPprints"BackendHTTP: handle_response" - When a backend is ready to be read from,
Perlbal::BackendHTTPprints"Backend $self is readable!" - When there's an error with the connection to the backend,
Perlbal::BackendHTTPprints"BACKEND event_err" - Whenever we're determining if we should be sending keep-alive header information back to the client,
Perlbal::ClientHTTPBaseprints"ClientHTTPBase::setup_keepalive($self)" - Whenever the client is ready for more of its file,
Perlbal::ClientHTTPBaseprints"REPROXY SSL done" - Right after we've read a chunk of a file and when a reproxy request is about to be sent,
Perlbal::ClientHTTPBaseprints"REPROXY Sent: $sent" - When we've written all data in the queue (and are about to stop waiting for write notifications),
Perlbal::ClientHTTPBaseprints"All writing done to $self" - Whenever a client proxy is about to be closed,
Perlbal::ClientProxyprints"Perlbal::ClientProxy closed", followed by a possible"again"and a possible"saying $reason" - When a client has disconnected,
Perlbal::ClientProxyprints"ClientProxy::client_disconnected" - When a backend requests a client of a high priority request and the client is available,
"Service"in Perlbal prints"Got from fast queue, in front of $backlog others" - When a backend requests a client of a normal priority request and the client is available,
"Service"in Perlbal prints"Backend requesting client, got PRIORITY = $cp-"{fd}.> - When a backend requests a client of a low priority request and the client is available,
"Service"in Perlbal prints"Backend requesting client, got low priority = $cp-"{fd}.> - When header are being read,
Perlbal::Socketprints"Perlbal::Socket::read_headers($self) is_res=$is_res"
Level 2 is lowkey the group chat of debug levels. π¬
π Debug level 3
PERLBAL_DEBUG = 3
By setting the debug level to 3 you'll get all the messages from level 1 and 2 plus the following:
- Right before response headers are written to the client,
Perlbal::BackendHTTPprints" writing response headers to client" - As we're writing to the client,
Perlbal::BackendHTTPprints" content_length=VALUE"and" remain=VALUE", where the values are"undef"if they are not defined - If we're done writing to the client,
Perlbal::BackendHTTPprints" done. detaching." - Whenever we're determining if we should be sending keep-alive header information back to the client,
Perlbal::ClientHTTPBaseprints" service's persist_client = $persist_client" - While determining if we should be sending keep-alive header information back to the client, if we were sent
"content-length"or it's a head request, as we're doing a keep alivePerlbal::ClientHTTPBaseprints" doing keep-alive to client" - If we're not sending keep-alive header information back to the client,
Perlbal::ClientHTTPBaseprints" doing connection: close" - Right after we've finished sending all of the results to the user,
Perlbal::ClientProxyprints"ClientProxy::backend_finished" - When we've sent a response to a user fully and we need to reset state,
Perlbal::ClientProxyprints"ClientProxy::http_response_sent -- resetting state" - When we're writing a response to a client,
Perlbal::ClientProxyprints"ClientProxy::event_write" - After writing a response to a client, if it is still connected and we're triggering trigger our backend to keep reading,
Perlbal::ClientProxyprints" unstalling backend" - When reading a request,
Perlbal::ClientProxyprints"ClientProxy::event_read" - When reading a request and just before we read the headers,
Perlbal::ClientProxyprints" no headers. reading." - When reading a request, if we're not buffering to disk or we're no longer reading, as we disable reads,
Perlbal::ClientProxyprints" disabling reads." - As we're reading,
Perlbal::ClientProxyprints" reading $read_size bytes (VALUE bytes remain)", where"VALUE bytes remain"can be<undef> - After each read,
Perlbal::ClientProxyprints" read $len bytes" - After we finished reading the request,
Perlbal::ClientProxyprints" done_reading = $done_reading, backend = BACKEND", where"BACKEND"can be"undef" - When we send the headers to the backend and it responds before we're done reading from the client, further reads from the client are discarded; in this situation
Perlbal::ClientProxyprints" already responded.". If the client continues to send data,Perlbal::ClientProxyprints" already responded [2]."and then gives up on reading - After reading, and having a backend available where we can write to, just before we do,
Perlbal::ClientProxyprints" got a backend. sending write to it." - After reading, if there's no backend available,
Perlbal::ClientProxyprints" no backend. read_ahead = $self-"{read_ahead}.> - If we know we've already started spooling a file to disk and we're about to continue doing so,
Perlbal::ClientProxyprints" bureason = $self-"{bureason}> - If a backend wasn't available and we're about to request one,
Perlbal::ClientProxyprints" finally requesting a backend" - When we're trying to read headers and the client has disconnected,
Perlbal::Socketprints" client disconnected" - If we need to remove a trailing
"\r\n"from the headers,Perlbal::Socketprints" throwing away leading \r\n" - If we've read a packet with headers and by the end of it we can't find the end of them,
Perlbal::Socketprints" can't find end of headers" - Once we've read some headers,
Perlbal::Socketprints" pre-parsed headers: [$hstr]" - After reading headers, if there's additional content that we've read, we push it back; when we do so,
Perlbal::Socketprints" pushing back $len bytes after header" - If we got bogus headers, and right before we close the connection due to a parsing failure,
Perlbal::Socketprints" bogus headers" - If we got valid headers,
Perlbal::Socketprints" got valid headers" - If we're reading buffered data from a client,
Perlbal::Socketprints"draining readbuf from $self to $dest: [$$bref]"
Level 3 is a lot of messages and we are obsessed. ππ
π Debug level 4
By setting the debug level to 4 you get all the messages from levels 1 to 3.
Plus, "write" is redefined so that whenever "write" is called it first prints "write($self, <$clen>"$content") from ($pkg, $filename, $line)".
PERLBAL_DEBUG = 4
Heads up bestie: 4 is the "debug everything" setting, and everything means everything. No thoughts, just output. π
π SEE ALSO π
Perlbal::Manual::Configuration, Perlbal::Manual::Management.
That's the whole page, bestie. Go forth and debug like the main character you are. π¦π
perl v5.34.0 β’ 2022-06-28 β mwah, xoxo, happy debugging πβ¨
π¦ where this page comes from
- debian bookworm: libperlbal-perl 1.80-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libperlbal-perl 1.80-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libperlbal-perl 1.80-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu questing: libperlbal-perl 1.80-4
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms