Title: [122615] trunk/Tools
Revision
122615
Author
[email protected]
Date
2012-07-13 12:08:27 -0700 (Fri, 13 Jul 2012)

Log Message

NRWT doesn't print exceptions
https://bugs.webkit.org/show_bug.cgi?id=91129

Reviewed by Ojan Vafai.

Although we printed exceptions in most cases, if an unexpected
exception (like a runtime error) was raised when creating a
port, we wouldn't. This patch fixes that, and also cleans up
how we were logging exceptions from the workers to be less
verbose.

Because of the corner cases where these errors are occurring,
it's difficult to write automated unit tests for them. I've
tested it quite a bit by hand, though.

* Scripts/webkitpy/common/message_pool.py:
(_MessagePool._close):
(_MessagePool._handle_worker_exception):
(_Worker.run):
(_Worker._raise):
* Scripts/webkitpy/layout_tests/controllers/manager.py:
(Manager._run_tests):
* Scripts/webkitpy/layout_tests/run_webkit_tests.py:
(main):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (122614 => 122615)


--- trunk/Tools/ChangeLog	2012-07-13 19:05:21 UTC (rev 122614)
+++ trunk/Tools/ChangeLog	2012-07-13 19:08:27 UTC (rev 122615)
@@ -1,3 +1,30 @@
+2012-07-13  Dirk Pranke  <[email protected]>
+
+        NRWT doesn't print exceptions
+        https://bugs.webkit.org/show_bug.cgi?id=91129
+
+        Reviewed by Ojan Vafai.
+
+        Although we printed exceptions in most cases, if an unexpected
+        exception (like a runtime error) was raised when creating a
+        port, we wouldn't. This patch fixes that, and also cleans up
+        how we were logging exceptions from the workers to be less
+        verbose.
+
+        Because of the corner cases where these errors are occurring,
+        it's difficult to write automated unit tests for them. I've
+        tested it quite a bit by hand, though.
+
+        * Scripts/webkitpy/common/message_pool.py:
+        (_MessagePool._close):
+        (_MessagePool._handle_worker_exception):
+        (_Worker.run):
+        (_Worker._raise):
+        * Scripts/webkitpy/layout_tests/controllers/manager.py:
+        (Manager._run_tests):
+        * Scripts/webkitpy/layout_tests/run_webkit_tests.py:
+        (main):
+
 2012-07-13  Wei James  <[email protected]>
 
         enable TestWebKitAPI/webkit_unit_tests apk on x86 android platform by adding abi support

Modified: trunk/Tools/Scripts/webkitpy/common/message_pool.py (122614 => 122615)


--- trunk/Tools/Scripts/webkitpy/common/message_pool.py	2012-07-13 19:05:21 UTC (rev 122614)
+++ trunk/Tools/Scripts/webkitpy/common/message_pool.py	2012-07-13 19:08:27 UTC (rev 122615)
@@ -128,6 +128,8 @@
                 worker.join()
         self._workers = []
         if not self._running_inline:
+            # FIXME: This is a hack to get multiprocessing to not log tracebacks during shutdown :(.
+            multiprocessing.util._exiting = True
             if self._messages_to_worker:
                 self._messages_to_worker.close()
                 self._messages_to_worker = None
@@ -146,8 +148,6 @@
     def _handle_worker_exception(source, exception_type, exception_value, _):
         if exception_type == KeyboardInterrupt:
             raise exception_type(exception_value)
-        _log.error("%s raised %s('%s'):" % (
-                   source, exception_value.__class__.__name__, str(exception_value)))
         raise WorkerException(str(exception_value))
 
     def _can_pickle(self, host):
@@ -245,21 +245,14 @@
                     assert message.name == 'stop', 'bad message %s' % repr(message)
                     break
 
+            _log.debug("%s exiting" % self.name)
         except Queue.Empty:
             assert False, '%s: ran out of messages in worker queue.' % self.name
         except KeyboardInterrupt, e:
-            exception_msg = ", interrupted"
-            if not self._running_inline:
-                _log.warning('worker exception')
-                self._raise(sys.exc_info())
-            raise
+            self._raise(sys.exc_info())
         except Exception, e:
-            exception_msg = ", exception raised: %s" % str(e)
-            if not self._running_inline:
-                self._raise(sys.exc_info())
-            raise
+            self._raise(sys.exc_info())
         finally:
-            _log.debug("%s exiting%s" % (self.name, exception_msg))
             try:
                 worker.stop()
             finally:
@@ -279,9 +272,17 @@
         self._messages_to_manager.put(_Message(self.name, name, args, from_user, log_messages))
 
     def _raise(self, exc_info):
+        exception_type, exception_value, exception_traceback = exc_info
+        if self._running_inline:
+            raise exception_type, exception_value, exception_traceback
+
+        if exception_type == KeyboardInterrupt:
+            _log.debug("%s: interrupted, exiting" % self.name)
+            stack_utils.log_traceback(_log.debug, exception_traceback)
+        else:
+            _log.error("%s: %s('%s') raised:" % (self.name, exception_value.__class__.__name__, str(exception_value)))
+            stack_utils.log_traceback(_log.error, exception_traceback)
         # Since tracebacks aren't picklable, send the extracted stack instead.
-        exception_type, exception_value, exception_traceback = exc_info
-        stack_utils.log_traceback(_log.error, exception_traceback)
         stack = traceback.extract_tb(exception_traceback)
         self._post(name='worker_exception', args=(exception_type, exception_value, stack), from_user=False)
 

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py (122614 => 122615)


--- trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py	2012-07-13 19:05:21 UTC (rev 122614)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py	2012-07-13 19:08:27 UTC (rev 122615)
@@ -782,8 +782,8 @@
         except TestRunInterruptedException, e:
             _log.warning(e.reason)
             interrupted = True
-        except:
-            _log.error("Exception raised, exiting")
+        except Exception, e:
+            _log.debug('%s("%s") raised, exiting' % (e.__class__.__name__, str(e)))
             raise
         finally:
             self.stop_servers_with_lock()

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py (122614 => 122615)


--- trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py	2012-07-13 19:05:21 UTC (rev 122614)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py	2012-07-13 19:08:27 UTC (rev 122615)
@@ -35,6 +35,7 @@
 import os
 import signal
 import sys
+import traceback
 
 from webkitpy.common.host import Host
 from webkitpy.common.system import stack_utils
@@ -469,6 +470,9 @@
         # FIXME: is this the best way to handle unsupported port names?
         print >> sys.stderr, str(e)
         return EXCEPTIONAL_EXIT_STATUS
+    except:
+        traceback.print_exc(file=sys.stderr)
+        raise
 
     logging.getLogger().setLevel(logging.DEBUG if options.verbose else logging.INFO)
     return run(port, options, args)
@@ -477,7 +481,7 @@
 if '__main__' == __name__:
     try:
         sys.exit(main())
-    except Exception, e:
+    except BaseException, e:
         if e.__class__ in (KeyboardInterrupt, TestRunInterruptedException):
             sys.exit(INTERRUPTED_EXIT_STATUS)
         sys.exit(EXCEPTIONAL_EXIT_STATUS)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to