Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 333787 - [event] bad EventHandler with LogEntry topic can cause endless event dispatching
Summary: [event] bad EventHandler with LogEntry topic can cause endless event dispatching
Status: RESOLVED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: Compendium (show other bugs)
Version: 3.7   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: 3.7 M5   Edit
Assignee: Thomas Watson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-07 16:38 EST by Thomas Watson CLA
Modified: 2011-01-07 21:21 EST (History)
0 users

See Also:


Attachments
possible fix (1.77 KB, patch)
2011-01-07 16:45 EST, Thomas Watson CLA
no flags Details | Diff
possible fix (1.85 KB, patch)
2011-01-07 17:21 EST, Thomas Watson CLA
no flags Details | Diff
proposed fix (1.78 KB, patch)
2011-01-07 17:33 EST, Thomas Watson CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Watson CLA 2011-01-07 16:38:48 EST
If a LogService is present and a bad EventHandler listens for the org/osgi/service/log/LogEntry/* topic then endless event dispatching can occur if the EventHandler continually throws runtime exceptions.

The event admin implementation should probably try to handle this.
Comment 1 Thomas Watson CLA 2011-01-07 16:45:39 EST
Created attachment 186317 [details]
possible fix

This fix will detect a possible endless LogEntry event posting by wrapping the EventHanders exception in a special exception when the event topic starts with "org/osgi/service/log/LogEntry".  This way we can detect a second exception from a handler if the log call causes another exception from an EventHandler.
Comment 2 Thomas Watson CLA 2011-01-07 17:21:38 EST
Created attachment 186319 [details]
possible fix

The previous patch prevented endless events but had a bug.  It tried to cast the event property "exception" to Class which would cause a cast exception.  The property "exception" is not a Class but the actual exception.  This patch fixes that.
Comment 3 Thomas Watson CLA 2011-01-07 17:33:17 EST
Created attachment 186321 [details]
proposed fix

OK, lets try this again.  Same idea but with a simple instanceof check.
Comment 4 Thomas Watson CLA 2011-01-07 21:20:42 EST
patch released.