Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to get more info on an IO exception

6 views
Skip to first unread message

alejandrina

unread,
Aug 27, 2007, 2:36:34 PM8/27/07
to
Hi all,

We have a process that occassionally throws an I/O Exception when
trying to lock a Linux file for writing.

java.io.IOException: Input/output error
at sun.nio.ch.FileChannelImpl.lock0(Native Method)
at sun.nio.ch.FileChannelImpl.tryLock(FileChannelImpl.java:
882)
at java.nio.channels.FileChannel.tryLock(FileChannel.java:962)
at
com.pdx.science.utils.SyncFileWriter.write(SyncFileWriter.java:58)
at
com.pdx.science.pm.learning.PMResultRecorder.record(PMResultRecorder.java:
49)
at
com.pdx.science.pm.learning.SVMModelSelector.processValueSet(SVMModelSelector.java:
279)
at
com.pdx.science.pm.learning.SVMModelSelector.process(SVMModelSelector.java:
178)
at
com.pdx.science.pm.learning.SVMModelSelector.run(SVMModelSelector.java:
134)
at
com.pdx.science.pm.learning.SVMModelSelector.main(SVMModelSelector.java:
589)


We'd love to know what is actually happening (network error, NFS
error...) Is there any more information that can be obtained from the
I/O Exception? How does one get it?

Thanks,

Alejandrina

Martin Gregorie

unread,
Aug 27, 2007, 3:53:08 PM8/27/07
to
alejandrina wrote:
>
> We'd love to know what is actually happening (network error, NFS
> error...) Is there any more information that can be obtained from the
> I/O Exception? How does one get it?
>
As the error is in native code I'd guess that the OS might tell you more
that filters up through Exceptions. Have you looked at the system
logs, /var/log/messages in particular?


--
martin@ | Martin Gregorie
gregorie. | Essex, UK
org |

alejandrina

unread,
Aug 28, 2007, 10:00:01 AM8/28/07
to
On Aug 27, 3:53 pm, Martin Gregorie <mar...@see.sig.for.address>
wrote:


Nothing there that we can see. I wanted to see if there was a
mechanism to "unwrap" the exception to get more info, but I guess
there is no such thing.

Roedy Green

unread,
Aug 28, 2007, 10:44:46 PM8/28/07
to
On Mon, 27 Aug 2007 11:36:34 -0700, alejandrina <apa...@gmail.com>
wrote, quoted or indirectly quoted someone who said :

>We'd love to know what is actually happening (network error, NFS
>error...) Is there any more information that can be obtained from the
>I/O Exception? How does one get it?

I suppose you could discover the precise class of the IOExceptions you
are getting by dumping e.getClass in your catch block. , then add a
catch clause for that particular class ahead of the general
IOException catch,, then you have access to any additional fields or
methods it has.
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

Knute Johnson

unread,
Aug 28, 2007, 11:38:08 PM8/28/07
to

Did getCause() have any info?

--

Knute Johnson
email s/nospam/knute/

Andreas Leitgeb

unread,
Aug 29, 2007, 5:58:55 AM8/29/07
to
Roedy Green <see_w...@mindprod.com.invalid> wrote:
> On Mon, 27 Aug 2007 11:36:34 -0700, alejandrina <apa...@gmail.com>
> wrote, quoted or indirectly quoted someone who said :
>>We'd love to know what is actually happening (network error, NFS
>>error...) Is there any more information that can be obtained from the
>>I/O Exception? How does one get it?
> I suppose you could discover the precise class of the IOExceptions you
> are getting by dumping e.getClass in your catch block. , then add a
> catch clause for that particular class ahead of the general
> IOException catch,, then you have access to any additional fields or
> methods it has.

In case this doesn't work out (that is: the getClass() also returns
just IOException), then maybe further information is just an
ioExc.getCause() away :-)

alejandrina

unread,
Aug 29, 2007, 3:24:49 PM8/29/07
to
On Aug 28, 11:38 pm, Knute Johnson <nos...@rabbitbrush.frazmtn.com>
wrote:

I did a test with a manufactured IOEception. getCause() returned the
exception message. And of course now that we have a catch for
IOException, the app is not failing, so I don't know what a real
IOException yields...

Knute Johnson

unread,
Aug 29, 2007, 5:42:01 PM8/29/07
to
alejandrina wrote:
>> Did getCause() have any info?
>>
> I did a test with a manufactured IOEception. getCause() returned the
> exception message. And of course now that we have a catch for
> IOException, the app is not failing, so I don't know what a real
> IOException yields...

Sometimes it is just magic. I've got a program in the field that has
been running 24/7 for the last year. Then all of a sudden it starts
having problems. I make about six changes, requiring me to stay up to
all hours because they can't have it down in the daytime, and then it
stops just as mysteriously as it started.

And if it is running on Windows...

alejandrina

unread,
Aug 29, 2007, 9:51:30 PM8/29/07
to
On Aug 29, 5:42 pm, Knute Johnson <nos...@rabbitbrush.frazmtn.com>
wrote:

Yes, it's not quite software "engineering", eh?

0 new messages