On 09/08/2011 05:54 PM, Martin Milata wrote:
The python exception handler used to send data to abrtd, print the traceback and then exit. If it finished sooner that abrt-server managed to read its /proc entry, the cmdline item ended up empty.
- seems ok, please push it.
Fixed it to wait for response from abrtd (and write to syslog if anything's wrong).
src/hooks/abrt_exception_handler.py.in | 23 ++++++++++++++++++++--- 1 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/src/hooks/abrt_exception_handler.py.in b/src/hooks/abrt_exception_handler.py.in index fc50436..e9d2e87 100644 --- a/src/hooks/abrt_exception_handler.py.in +++ b/src/hooks/abrt_exception_handler.py.in @@ -31,6 +31,8 @@ def write_dump(pid, tb): if sys.argv[0]: executable = os.path.abspath(sys.argv[0])
- import syslog
# Open ABRT daemon's socket and write data to it. try: s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
@@ -45,11 +47,26 @@ def write_dump(pid, tb): # CCMainWindow.py:1:<module>:ZeroDivisionError: integer division or modulo by zero s.sendall("REASON=%s\0" % tb.splitlines()[0]) s.sendall("BACKTRACE=%s\0" % tb)
# TODO: read back response and complain if it is not "xxx Created"
s.shutdown(socket.SHUT_WR)
# Read the response and log if there's anything wrong
response = ""
while True:
buf = s.recv(256)
if not buf:
break;
response += buf
s.close()
parts = response.split()
if (len(parts)< 2
or (not parts[0].startswith("HTTP/"))
or (not parts[1].isdigit())
or (int(parts[1])>= 400)):
syslog.syslog("Error sending data to ABRT daemon: %s" % response)
except Exception, ex:
import syslog
syslog.syslog("Can't communicate with ABRT daemon, is it running? %s", str(ex))
syslog.syslog("Can't communicate with ABRT daemon, is it running? %s" % str(ex))
def handleMyException((etype, value, tb)): """