Date | Commit message (Collapse) |
|
FreeBSD addr2line uses `?? at ??:0' for unresolved addresses, so
relax the regexp we use for handling unresolved output.
|
|
They're useful, IMHO. The ADDR2LINE environment can override
it, of course.
|
|
addr2line doesn't understand `+$ADDRESS' always, but `$ADDRESS'
is fine.
|
|
We can filter the HTML and CSV and run it through addr2line to
decode addresses from rproxy. We can't safely run another
process inside the embedded mwrap-httpd since that could
break `waitpid(-1, ...)' in the code we're being injected into.
|
|
We can check stderr in more places, avoid unused variable
warnings, and drop some debug code.
We'll allow the V=1 environment to make curl and rproxy verbose,
but verbosity tends to hide problems.
|
|
mwrap-httpd is inherently single-threaded, and the TSD pointer
needs to be alotted to every thread. So tie the request pointer
to the daemon itself instead of per-thread space.
If this were a dedicated multi-threaded httpd, I would be using
TSD for this. But this is only a single-threaded embedded httpd
with many threads doing completely unrelated things.
|
|
It's not worth the extra complexity, binary size, and icache
bloat for a AF_UNIX-only server.
|
|
Persistent connections and undrained input don't mix; so the
simplest thing is to drop the persistent connection when we
short-circuit out on /$PID/ prefix mismatches.
In retrospect, it's probably not worth supporting persistent
connections at all for a AF_UNIX-only server...
|
|
These non-mwrap-specific pieces are candidates for glibc
integration. So pick the same license as glibc for these
parts.
|
|
Fortunately, there aren't a lot of signalfd users right now
(except me :x). In any case, this problem should sort itself
out in a few years when new URCU releases replace old ones.
Also, only the EXTREMELY EXPENSIVE ENTERPRISE EDITION will be
able to support Perl files with over 16.7M lines in them :P
|
|
We can actually handle all RCU locking/unlocking inside
alloc_insert_rcu to simplify callers.
|
|
We can delay taking the RCU lock until the real_malloc() call
succeeds. This gives us accurate stats in case of ENOMEM
failures and reduces our LoC a bit, too.
|
|
We can simplify the error paths in calloc and call memset() outside
of the RCU critical section.
|
|
It's no longer needed with our embedded malloc and our
non-glibc ensure_initialization() mutex avoidance hack.
|
|
lineno shouldn't need more than 24-bits (or >= 16.7 million).
Our bt_len is capped at 32, and nobody should ever need to care
about tracking allocations if call stack depths exceed 256.
|
|
We can rely on the stable value of ->loc_hash to assign the
mutex at when it requires locking rather than relying on a
monotonically increasing counter.
|
|
Sometimes, stale sockets can stick around and the PID gets
recycled by a different process, so ensure we can actually
connect to it before listing it.
|
|
Lets try not to leave stale sockets lying around since they can
eat away at inode space.
|
|
Fix the comment regarding --no-deflate and describe PLACK_ENV, too.
|
|
mwrap_httpd will have online help :>
|
|
This is useful for users w/o root permissions.
|
|
This is a valuable tuning knob and allows users to forgo
restarting an app to change backtrace depth. A /reset is
recommended.
|
|
Let's not increase requirements for running this project, since
some users will be perfectly fine with curl and CSV output.
Furthermore, Plack::Middleware::Deflater is not included in
the main Plack distribution, so that requirement should be
further separated since it's not required.
|
|
Compilers don't like seeing `sl.bt[-1]', so we give backtrace(3)
the same address by another means. We'll also save allocating
one pointer off the stack by capping the union padding.
|
|
It's not worth it. Arguably, supporting persistent connections
for a AF_LOCAL-only daemon is overkill.
|
|
Better to have one implementation which works for all clients,
since curl may not be as readily available as socat or a naive
Perl socket implementation.
|
|
No need to prefix our project name into every individual source
file, especially since it's an auxilliary component.
|
|
We shouldn't abort the program due to resource limitations.
Instead, the least intrusive course of action is probably to
sleep and wait for other threads in the process to do cleanup
work.
|
|
Instead, we'll leak memory if the pthread_atfork handlers can't
stop httpd at fork due to resource limitations.
|
|
Ideally I want this in the main mwrap_httpd itself, but linking
zlib may conflict with whatever an application uses. This will
be useful for exposing the demo endpoint for public use.
|
|
CSV is well-supported by SQLite (and many other tools) so it can
be useful for offline analysis.
|
|
`long double' is excessive, not necessary, and a waste of RAM
and locality.
|
|
We'll keep each/2000 linked, but the /$PID/ root may provide a
better jumping point.
|
|
|
|
We only use unsigned chars, so we can let truncation do its
thing and not overflow.
|
|
It's slightly more readable IMHO, and perhaps it generates
better code on x86 (since URCU has x86-specific paths for it).
|
|
This can give users some quick info about their application.
We'll also show the MWRAP=bt: parameter to hint users about
the backtrace depth they expect.
|
|
I won't be developing Devel::Mwrap::PSGI further since
mwrap_httpd is less intrusive and faster.
|
|
No need to hog up screen space if we're not doing multi-level
traces.
|
|
This helps us avoid memory leaks after OOM.
|
|
Both gcc and clang have had __attribute__((__cleanup__)) for a
decade or more. This helps us avoid memory leaks and simplifies
our code.
|
|
We actually want to read total_bytes_dec before total_bytes_inc
to ensure a greater likelyhood of the resulting total being
positive (or not underflowed into SIZE_MAX territory)
|
|
It can be enlightening to see the machine backtrace (not the
Perl one) leading up to a particular malloc calls from a Perl
function.
"/$PID/at/$LOCATION" URLs now use the URL-safe Base 64 location
URLs to simplify parsing and reduce URL length for multi-level
backtraces.
Warning: increasing $NUM leads to large increases in memory
usage of mwrap itself. This is due to common malloc wrapper
functions (e.g. "Perl_safesysmalloc", "xmalloc") taking up the
first stack level while a diverse array of callers occupy higher
up ones.
|
|
ftello(3) may fail if out-of-memory.
|
|
|
|
FreeBSD, glibc both support it, as do minimalist libcs such as
uClibc and musl.
|
|
This adds error reporting to a few places where I forgot to
print errno on open_memstream failures.
|
|
A small tweak to simplify error reporting if we have any
problems due to OOM or bugs.
|
|
"'Tis better to emit than to parse"
Since FreeBSD has backtrace_symbols_fmt(3) and glibc does not,
we'll use the hard-coded glibc backtrace_symbols(3) format.
This saves us the trouble of maintaining separate parsers.
I consider the default glibc format superior, anyways, since the
important piece (%f - filename) is up front, since the %a
(address) is process-specific and not useful when viewed from a
different process.
|
|
Using a FIFO in Perl means our mwrap_ctor constructor has
already run and bound the listen socket. So using it as a
synchronization barrier means we can rely on it to ensure
the socket is connect-able.
|