Re: [Crash-catcher] java reports by crash catcher
by Michal Nowak
----- "Mark Wielaard" <mjw(a)redhat.com> wrote:
> Hi,
>
> It would be nice if crash-catcher could be thought about the
> hs_pid*.log
> files that a crashed java process creates. That file contains much
> more
> information that is relevant to the crash than the gdb backtrace that
> is
> currently collected. If it can see if there is a hs_pid###.log file
> (where ### is the process id of the java process that crashed) and
> attached that to the bug report it files that would be appreciated.
>
I am afraid Java exceptions are not supported at the moment (just the
python ones) and thus ABRT is not being run in such cases.
Do you have some example crash, where ABRT stepped in?
Since Java apps exception handling is completely missing, perhaps
some of you guys can help?
> Thanks,
>
> Mark
Michal
>
> _______________________________________________
> Crash-catcher mailing list
> Crash-catcher(a)lists.fedorahosted.org
> https://fedorahosted.org/mailman/listinfo/crash-catcher
13 years, 6 months
trading program
by Wolfgang, Hoppe
Hi,
Individually managed accounts program, mainly in forex, precious metals and energy related assets, for investors who can pool a minimum of 10,000$.
The average monthly returns will be 15%.
Investor can open his own account and all I will do is operate the account.
At the end of the month, investor pays me 30% on the profits I make.
If it is less than 5%, the investor need not pay me anything.
Since the account is in the name of investor, there is no risk to him.
All accounts are held with a reputable broker
Any pay out given will lead the money to his own account.
The investor can track his account regularly as well.
If you wish to discontinue, you are free to do so at any point of time.
Statements provided upon request.
Contact me for details eurosfx(a)gmail.com
Regards
13 years, 9 months
[PATCH] discard headers from HTTP redirection
by Denys Vlasenko
Example where it is needed:
abrtd: save_headers: header 0: 'HTTP/1.1 301 Moved Permanently'
abrtd: save_headers: header 1: 'Connection: close'
abrtd: save_headers: header 2: 'Location: NEW_URL'
abrtd: save_headers: header 3: ''
...
If we will continue collecting headers, we might be fooled to think
that the following transaction had "Location: NEW_URL" header.
This patch discards headers when it sees new "HTTP/..." line
(note the count restarting from 0):
...
abrtd: save_headers: header 0: 'HTTP/1.1 200 OK'
abrtd: save_headers: header 1: 'Date: Wed, 28 Jul 2010 13:33:55 GMT'
abrtd: save_headers: header 2: 'Server: Apache'
abrtd: save_headers: header 3: 'Cache-Control: no-cache'
abrtd: save_headers: header 4: 'Pragma: no-cache'
abrtd: save_headers: header 5: 'Content-Type: text/html; charset=UTF-8'
abrtd: save_headers: header 6: 'Connection: close'
abrtd: save_headers: header 7: 'Transfer-Encoding: chunked'
abrtd: save_headers: header 8: ''
--
vda
diff -x '*.po' -d -urpN abrt.4/lib/Utils/abrt_curl.cpp abrt.5/lib/Utils/abrt_curl.cpp
--- abrt.4/lib/Utils/abrt_curl.cpp 2010-07-22 13:49:09.000000000 +0200
+++ abrt.5/lib/Utils/abrt_curl.cpp 2010-07-28 15:29:53.135925335 +0200
@@ -119,14 +119,34 @@ save_headers(void *buffer_pv, size_t cou
abrt_post_state_t* state = (abrt_post_state_t*)ptr;
size_t size = count * nmemb;
-
- unsigned cnt = state->header_cnt;
- state->headers = (char**)xrealloc(state->headers, (cnt+2) * sizeof(state->headers[0]));
-
char *h = xstrndup((char*)buffer_pv, size);
strchrnul(h, '\r')[0] = '\0';
strchrnul(h, '\n')[0] = '\0';
+
+ unsigned cnt = state->header_cnt;
+
+ /* Check for the case when curl follows a redirect:
+ * header 0: 'HTTP/1.1 301 Moved Permanently'
+ * header 1: 'Connection: close'
+ * header 2: 'Location: NEW_URL'
+ * header 3: ''
+ * header 0: 'HTTP/1.1 200 OK' <-- we need to forget all hdrs and start anew
+ */
+ if (cnt != 0
+ && strncmp(h, "HTTP/", 5) == 0
+ && state->headers[cnt-1][0] == '\0' /* prev header is an empty string */
+ ) {
+ char **headers = state->headers;
+ if (headers)
+ {
+ while (*headers)
+ free(*headers++);
+ }
+ cnt = 0;
+ }
+
VERB3 log("save_headers: header %d: '%s'", cnt, h);
+ state->headers = (char**)xrealloc(state->headers, (cnt+2) * sizeof(state->headers[0]));
state->headers[cnt] = h;
state->header_cnt = ++cnt;
state->headers[cnt] = NULL;
13 years, 9 months
[PATCH] moved abrt.socket and abrtd.lock into /var/run/abrt
by Jiri Moskovcak
selinux allows abrtd to do anything in /var/run/abrt, so moving .socket
and .lock there so we can unlink() them without writing a selinux
policy. I wanted to move even the .pid file there, but it seems that
it's supposed to be in /var/run/abrtd.pid as some init functions expects
it there (status abrtd won't find the pid file).
J.
13 years, 9 months
[PATCH] add a log message pyhook
by Jiri Moskovcak
It's a simple change, but since the exception handler is very dangerous
part, I'd like more people to test it.
Thanks,
Jirka
13 years, 9 months
[PATCH] pass old core pattern to cccp hook and use it for compat core
by Denys Vlasenko
Old core pattern is passed to the hook as argv[6], hex encoded
in order to preserve spaces and percents.
%p %s %u %c and %% specifiers are supported.
/proc/.../core_uses_pid has any effect only if old pattern is "core".
Patch is run tested.
--
vda
diff -x '*.po' -d -urpN abrt.2/inc/abrtlib.h abrt.3/inc/abrtlib.h
--- abrt.2/inc/abrtlib.h 2010-07-22 13:49:09.000000000 +0200
+++ abrt.3/inc/abrtlib.h 2010-07-23 16:06:40.587805661 +0200
@@ -37,10 +37,13 @@
#endif
#include <pwd.h>
#include <grp.h>
+
/* C++ bits */
-#include <string>
+#ifdef __cplusplus
+# include <string>
+# include "abrt_types.h"
+#endif
-#include "abrt_types.h"
#include "xfuncs.h"
/* Some libc's forget to declare these, do it ourself */
@@ -133,8 +136,8 @@ extern ssize_t full_write(int fd, const
enum {
COPYFD_SPARSE = 1 << 0,
};
-off_t copyfd_eof(int src_fd, int dst_fd, int flags = 0);
-off_t copyfd_size(int src_fd, int dst_fd, off_t size, int flags = 0);
+off_t copyfd_eof(int src_fd, int dst_fd, int flags);
+off_t copyfd_size(int src_fd, int dst_fd, off_t size, int flags);
void copyfd_exact_size(int src_fd, int dst_fd, off_t size);
off_t copy_file(const char *src_name, const char *dst_name, int mode);
@@ -214,6 +217,17 @@ char* xmalloc_sockaddr2dotted_noport(con
/* Random utility functions */
+#ifdef __cplusplus
+extern "C" {
+#endif
+/* Emit a string of hex representation of bytes */
+char* bin2hex(char *dst, const char *str, int count);
+/* Convert "xxxxxxxx" hex string to binary, no more than COUNT bytes */
+char* hex2bin(char *dst, const char *str, int count);
+#ifdef __cplusplus
+}
+#endif
+
/* Returns command line of running program.
* Caller is responsible to free() the returned value.
* If the pid is not valid or command line can not be obtained,
@@ -228,6 +242,7 @@ int daemon_is_ok();
char *encode_base64(const void *src, int length);
/* C++ style stuff */
+#ifdef __cplusplus
double get_dirsize(const char *pPath);
double get_dirsize_find_largest_dir(
const char *pPath,
@@ -246,5 +261,6 @@ std::string to_string(T x)
void parse_args(const char *psArgs, vector_string_t& pArgs, int quote = -1);
void parse_release(const char *pRelease, char **product, char **version);
+#endif
#endif
diff -x '*.po' -d -urpN abrt.2/lib/Plugins/CCpp.cpp abrt.3/lib/Plugins/CCpp.cpp
--- abrt.2/lib/Plugins/CCpp.cpp 2010-07-22 13:49:09.000000000 +0200
+++ abrt.3/lib/Plugins/CCpp.cpp 2010-07-23 16:14:11.820055971 +0200
@@ -923,7 +923,7 @@ void CAnalyzerCCpp::Init()
}
if (m_sOldCorePattern[0] == '|')
{
- if (m_sOldCorePattern == CORE_PATTERN)
+ if (strncmp(m_sOldCorePattern.c_str(), CORE_PATTERN, strlen(CORE_PATTERN)) == 0)
{
log("warning: %s already contains %s, "
"did abrt daemon crash recently?",
@@ -947,14 +947,30 @@ void CAnalyzerCCpp::Init()
fp = fopen(CORE_PATTERN_IFACE, "w");
if (fp)
{
- fputs(CORE_PATTERN, fp);
+ if (m_sOldCorePattern[0] != '|')
+ {
+ const char *old = m_sOldCorePattern.c_str();
+ unsigned len = strchrnul(old, '\n') - old;
+ char *hex_old = (char*)xmalloc(len * 2 + 1);
+ bin2hex(hex_old, old, len)[0] = '\0';
+ char *pattern = xasprintf("%s %s", CORE_PATTERN, hex_old);
+
+ fputs(pattern, fp);
+
+ free(pattern);
+ free(hex_old);
+ }
+ else
+ {
+ fputs(CORE_PATTERN, fp);
+ }
fclose(fp);
}
/* read the core_pipe_limit and change it if it's == 0
- otherwise the abrt-hook-ccpp won't be able to read /proc/<pid>
- of the crashing process
- */
+ * otherwise the abrt-hook-ccpp won't be able to read /proc/<pid>
+ * of the crashing process
+ */
fp = fopen(CORE_PIPE_LIMIT_IFACE, "r");
if (fp)
{
diff -x '*.po' -d -urpN abrt.2/lib/Utils/binhex.c abrt.3/lib/Utils/binhex.c
--- abrt.2/lib/Utils/binhex.c 1970-01-01 01:00:00.000000000 +0100
+++ abrt.3/lib/Utils/binhex.c 2010-07-23 15:58:51.868807377 +0200
@@ -0,0 +1,74 @@
+/*
+ Copyright (C) 2010 ABRT team
+ Copyright (C) 2010 RedHat Inc
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2
+ as published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+#include "abrtlib.h"
+
+static const char hexdigits_locase[] = "0123456789abcdef";
+
+/* Emit a string of hex representation of bytes */
+char *bin2hex(char *dst, const char *str, int count)
+{
+ while (count) {
+ unsigned char c = *str++;
+ /* put lowercase hex digits */
+ *dst++ = hexdigits_locase[c >> 4];
+ *dst++ = hexdigits_locase[c & 0xf];
+ count--;
+ }
+ return dst;
+}
+
+/* Convert "xxxxxxxx" hex string to binary, no more than COUNT bytes */
+char *hex2bin(char *dst, const char *str, int count)
+{
+ /* Parts commented out with // allow parsing
+ * of strings like "xx:x:x:xx:xx:xx:xxxxxx"
+ * (IPv6, ethernet addresses and the like).
+ */
+ errno = EINVAL;
+ while (*str && count) {
+ uint8_t val;
+ uint8_t c;
+
+ c = *str++;
+ if (isdigit(c))
+ val = c - '0';
+ else if ((c|0x20) >= 'a' && (c|0x20) <= 'f')
+ val = (c|0x20) - ('a' - 10);
+ else
+ return NULL;
+ val <<= 4;
+ c = *str;
+ if (isdigit(c))
+ val |= c - '0';
+ else if ((c|0x20) >= 'a' && (c|0x20) <= 'f')
+ val |= (c|0x20) - ('a' - 10);
+ //else if (c == ':' || c == '\0')
+ // val >>= 4;
+ else
+ return NULL;
+
+ *dst++ = val;
+ //if (c != '\0')
+ str++;
+ //if (*str == ':')
+ // str++;
+ count--;
+ }
+ errno = (*str ? ERANGE : 0);
+ return dst;
+}
diff -x '*.po' -d -urpN abrt.2/lib/Utils/copyfd.cpp abrt.3/lib/Utils/copyfd.cpp
--- abrt.2/lib/Utils/copyfd.cpp 2010-07-22 13:49:09.000000000 +0200
+++ abrt.3/lib/Utils/copyfd.cpp 2010-07-23 16:05:53.275805964 +0200
@@ -134,7 +134,7 @@ off_t copyfd_size(int fd1, int fd2, off_
void copyfd_exact_size(int fd1, int fd2, off_t size)
{
- off_t sz = copyfd_size(fd1, fd2, size);
+ off_t sz = copyfd_size(fd1, fd2, size, /*flags:*/ 0);
if (sz == size)
return;
if (sz != -1)
@@ -164,7 +164,7 @@ off_t copy_file(const char *src_name, co
perror_msg("Can't open '%s'", dst_name);
return -1;
}
- r = copyfd_eof(src, dst);
+ r = copyfd_eof(src, dst, /*flags:*/ 0);
close(src);
close(dst);
return r;
diff -x '*.po' -d -urpN abrt.2/lib/Utils/Makefile.am abrt.3/lib/Utils/Makefile.am
--- abrt.2/lib/Utils/Makefile.am 2010-07-22 13:49:09.000000000 +0200
+++ abrt.3/lib/Utils/Makefile.am 2010-07-23 15:55:54.137806382 +0200
@@ -12,6 +12,7 @@ AM_YFLAGS = --verbose
libABRTUtils_la_SOURCES = \
xfuncs.cpp \
encbase64.cpp \
+ binhex.c \
read_write.cpp \
logging.cpp \
copyfd.cpp \
diff -x '*.po' -d -urpN abrt.2/src/Hooks/abrt-hook-ccpp.cpp abrt.3/src/Hooks/abrt-hook-ccpp.cpp
--- abrt.2/src/Hooks/abrt-hook-ccpp.cpp 2010-07-22 13:49:09.000000000 +0200
+++ abrt.3/src/Hooks/abrt-hook-ccpp.cpp 2010-07-23 17:17:28.143133273 +0200
@@ -164,7 +164,9 @@ static char* get_cwd(pid_t pid)
return malloc_readlink(buf);
}
-static char core_basename[sizeof("core.%lu") + sizeof(long)*3] = "core";
+static const char percent_specifiers[] = "%psuc";
+static char **percent_values;
+static char *core_basename = "core";
static int open_user_core(const char *user_pwd, uid_t uid, pid_t pid)
{
@@ -182,16 +184,57 @@ static int open_user_core(const char *us
}
/* Mimic "core.PID" if requested */
- char buf[] = "0\n";
- int fd = open("/proc/sys/kernel/core_uses_pid", O_RDONLY);
- if (fd >= 0)
+ if (strcmp(core_basename, "core") == 0)
{
- read(fd, buf, sizeof(buf));
- close(fd);
+ char buf[] = "0\n";
+ int fd = open("/proc/sys/kernel/core_uses_pid", O_RDONLY);
+ if (fd >= 0)
+ {
+ read(fd, buf, sizeof(buf));
+ close(fd);
+ }
+ if (strcmp(buf, "1\n") == 0)
+ {
+ core_basename = xasprintf("%s.%lu", core_basename, (long)pid);
+ }
}
- if (strcmp(buf, "1\n") == 0)
+ else
{
- sprintf(core_basename, "core.%lu", (long)pid);
+ core_basename = xstrdup(core_basename);
+ unsigned idx = 0;
+ while (1)
+ {
+ char c = core_basename[idx];
+ if (!c)
+ break;
+ idx++;
+ if (c != '%')
+ continue;
+
+ /* We just copied % */
+ const char *val = "";
+ c = core_basename[idx];
+ unsigned specifier_num = strchrnul(percent_specifiers, c) - percent_specifiers;
+ if (specifier_num < strlen(percent_specifiers)) /* valid %c (might be %% too) */
+ {
+log("c:'%c'", c);
+ val = "%";
+ if (specifier_num > 0)
+ val = percent_values[specifier_num - 1];
+log("val:'%s'", val);
+
+ char *old = core_basename;
+ idx--;
+ core_basename = xasprintf("%.*s%s%s", idx, core_basename, val, core_basename + idx + 2);
+log("pos:'%*s|'", idx, "");
+log("new:'%s'", core_basename);
+log("old:'%s'", old);
+ free(old);
+
+ idx += strlen(val);
+ }
+ /* else: invalid %c, copy verbatim */
+ }
}
/* man core:
@@ -212,8 +255,7 @@ static int open_user_core(const char *us
*
* The RLIMIT_CORE or RLIMIT_FSIZE resource limits for the process
* are set to zero.
- * [shouldn't it be checked by kernel? 2.6.30.9-96 doesn't, still
- * calls us even if "ulimit -c 0"]
+ * [we check RLIMIT_CORE, but how can we check RLIMIT_FSIZE?]
*
* The binary being executed by the process does not have
* read permission enabled. [how we can check it here?]
@@ -262,6 +304,7 @@ int main(int argc, char** argv)
logmode = LOGMODE_SYSLOG;
errno = 0;
+ percent_values = &argv[2];
const char* dddir = argv[1];
pid_t pid = xatoi_u(argv[2]);
const char* signal_str = argv[3];
@@ -273,6 +316,17 @@ int main(int argc, char** argv)
/* set to max possible >0 value */
ulimit_c = ~((off_t)1 << (sizeof(off_t)*8-1));
}
+ if (argv[6])
+ {
+ char *end = hex2bin(argv[6], argv[6], strlen(argv[6]));
+ if (end)
+ {
+ *end = '\0';
+ core_basename = argv[6];
+log("core_basename:'%s'", core_basename);
+ }
+ }
+
if (errno || pid <= 0)
{
error_msg_and_die("pid '%s' or limit '%s' is bogus", argv[2], argv[5]);
13 years, 9 months