-
Notifications
You must be signed in to change notification settings - Fork 933
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ast_coredumper: Increase reliability #446
ast_coredumper: Increase reliability #446
Conversation
cherry-pick-to: 18 |
Found a few things debian/ubuntu related. need to fix. |
This is with the current core dumper, not with your change, but somehow it seems to fail on Debian sometimes, even with the standard paths:
|
2a6b512
to
dbd39a8
Compare
@InterLinked1 Try this version and see if it resolves your issues in various environments. |
@@ -411,7 +458,7 @@ find_pid() { | |||
# Now that we have the pids, let's get the command and | |||
# its args. We'll add them to an array indexed by pid. | |||
declare -a candidates | |||
while read LINE ; do | |||
while read -r LINE ; do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could potentially avoid the regex with:
while read -r pid prog args ; do
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did it this way so if for some reason the result didn't match the regex, we'd skip that line and continue otherwise we won't be sure that we got a valid line.
dbd39a8
to
b6cc3a2
Compare
Ignore me, I forgot to Works much better now:
|
Instead of searching for the asterisk binary and the modules in the filesystem, we now get their locations, along with libdir, from the coredump itself... For the binary, we can use `gdb -c <coredump> ... "info proc exe"`. gdb can print this even without having the executable and symbols. Once we have the binary, we can get the location of the modules with `gdb ... "print ast_config_AST_MODULE_DIR` If there was no result then either it's not an asterisk coredump or there were no symbols loaded. Either way, it's not usable. For libdir, we now run "strings" on the note0 section of the coredump (which has the shared library -> memory address xref) and search for "libasteriskssl|libasteriskpj", then take the dirname. Since we're now getting everything from the coredump, it has to be correct as long as we're not crossing namespace boundaries like running asterisk in a docker container but trying to run ast_coredumper from the host using a shared file system (which you shouldn't be doing). There is still a case for using --asterisk-bin and/or --libdir: If you've updated asterisk since the coredump was taken, the binary, libraries and modules won't match the coredump which will render it useless. If you can restore or rebuild the original files that match the coredump and place them in a temporary directory, you can use --asterisk-bin, --libdir, and a new --moddir option to point to them and they'll be correctly captured in a tarball created with --tarball-coredumps. If you also use --tarball-config, you can use a new --etcdir option to point to what normally would be the /etc/asterisk directory. Also addressed many "shellcheck" findings. Resolves: asterisk#445
b6cc3a2
to
bebfc2e
Compare
The |
@InterLinked1 Is this now in a working state for you? |
Sorry - yup, it is, and that other spurious warning is gone now, too. |
One more thing I just noticed now:
However, it seems the backtrace was successfully extracted, so whatever happened didn't impede it from working. |
1a0acab
into
asterisk:master
Successfully merged to branch master and cherry-picked to ["18","20","21"] |
Instead of searching for the asterisk binary and the modules in the
filesystem, we now get their locations, along with libdir, from
the coredump itself...
For the binary, we can use
gdb -c <coredump> ... "info proc exe"
.gdb can print this even without having the executable and symbols.
Once we have the binary, we can get the location of the modules with
gdb ... "print ast_config_AST_MODULE_DIR
If there was no result then either it's not an asterisk coredump
or there were no symbols loaded. Either way, it's not usable.
For libdir, we now run "strings" on the note0 section of the
coredump (which has the shared library -> memory address xref) and
search for "libasteriskssl|libasteriskpj", then take the dirname.
Since we're now getting everything from the coredump, it has to be
correct as long as we're not crossing namespace boundaries like
running asterisk in a docker container but trying to run
ast_coredumper from the host using a shared file system (which you
shouldn't be doing).
There is still a case for using --asterisk-bin and/or --libdir: If
you've updated asterisk since the coredump was taken, the binary,
libraries and modules won't match the coredump which will render it
useless. If you can restore or rebuild the original files that
match the coredump and place them in a temporary directory, you can
use --asterisk-bin, --libdir, and a new --moddir option to point to
them and they'll be correctly captured in a tarball created
with --tarball-coredumps. If you also use --tarball-config, you can
use a new --etcdir option to point to what normally would be the
/etc/asterisk directory.
Also addressed various "shellcheck" issues.
Resolves: #445