Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / February 2006

Tip: Looking for answers? Try searching our database.

My threads keep dying! Exceptions without stack traces? How to debug?

Thread view: 
Twisted - 23 Feb 2006 02:04 GMT
My thread factory is groaning under the load. It keeps having to create
new threads to replace ones that keep dying. The threads are all
identical code-wise, and their run() methods consist mainly of a big
try block that calls some other stuff and sleeps and such. The try
block doesn't bother recovering from most exceptions; there's an ending
catch (Exception e) that notifies the thread factory of a thread's
untimely demise, and exits.

I figured this would give the system some robustness, as well as
providing a way to debug. But I am having difficulty with the latter.
Noticing a lot of logged exceptions without any detail info, I tried
sticking a breakpoint in that catch block, just where it calls the
factory's thread death notifier, and inspecting the exception objects
when the breakpoint is tripped.

They have no stack trace. Some are NullPointerExceptions whose "cause"
field refers recursively to the same exception, with null detail and
stack trace fields. Others are IllegalArgumentExceptions with the same
property. Still more are like these last, but the detail field says
"java.lang.IllegalArgumentException: protocol = http host = null"...

Anyone know where they're coming from?
Twisted - 24 Feb 2006 20:13 GMT
I've got new information on some of the IllegalArgumentExceptions, and
think I've eliminated the NullPointerExceptions (things like
getContentType() on URLConnections were sometimes returning null for
some reason).

Removing the exception handler and letting the exceptions go uncaught
leads to a usable stack trace. The "protocol = http host = null" ones
look like this:

Exception in thread "Thread-135" java.lang.IllegalArgumentException:
protocol = http host = null
    at sun.net.spi.DefaultProxySelector.select(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown
Source)
    at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
    at imagesucker.ImagesuckerThread.spiderURL(ImagesuckerThread.java:153)
    at imagesucker.ImagesuckerThread.run(ImagesuckerThread.java:76)

Now the connect() URLConnection instance method isn't mentioned as
throwing anything but IO exceptions in the documentation...does anyone
have any information on what would cause this? Could the URL have had a
null host? If so, how?


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.