Java program hangs on new PrintWriter

From: Oz Levanon (oz.levanon_at_philips.com)
Date: 02/29/04


Date: 29 Feb 2004 01:38:45 -0800

Hi.
I have a java program running on linux (Redhat 9, Java 1.4.2, build
1.4.2-b28).
The program periodically accesses a file on the hard disk using the
following code:

FileOutputStream fos = new FileOutputStream(filename);
PrintWriter pw = new PrintWriter(fos);
// ...
// writes stuff to the file.
// ...
pw.close();
fos.close();

Every now and then (sometimes after hundreds of times, sometimes after
less) the program hands. I can see from debug prints I've added that
it is stuck after the new FileOutputStream(filename) and before the
new PrintWriter(fos);
The program doesn't exit (and no throwable is thrown) but rather stays
up and running, but never gets past this line.
Does anyone have any idea what could cause a program to hang in this
line? Can anything on linux be done to a file that will cause a
program trying to access it hang?

TIA, oz.



Relevant Pages

  • Re: Java program hangs on new PrintWriter
    ... > The program periodically accesses a file on the hard disk using the ... > Does anyone have any idea what could cause a program to hang in this ... Can anything on linux be done to a file that will cause a ...
    (comp.lang.java.programmer)
  • Re: FS Error
    ... That must have been one Hell of a hang and one Hell of a power-off... ... If it's not the root filesystem, then boot up in single-user mode first. ... I'm not well versed in Linux, but how do I tell if it's the root file system at this point? ... Possibly I lost something in the app install, since I saw a message about 'delete missing in smodules.o', and that is an app module. ...
    (comp.os.linux.misc)
  • Re: System Hang...problem is HDD or OS.
    ... what can i do my pc have a hang problem. ... You can even get a copy of Prime95 that runs under Linux, ... If you have two cd/dvd drives, a writer and a ROM, boot the live cd from ... It has a collection of tools for testing hard drives, ...
    (microsoft.public.windowsxp.hardware)
  • Re: XFS: 2.6.26-rc6 link count mismatch for inode
    ... tar xjf mozilla-blabla. ... After a while linux 2.6.26-rc6 was ... seen this sort of directory corruption before when using volatile ... not because of the hang. ...
    (Linux-Kernel)
  • Re: Message from a guildy was a keylogger
    ... dealing with non-techie friends, customers, and relatives. ... most of the people I hang with are not most of the people. ... certainly give the Linux techs a nice boost in employment hours. ...
    (alt.games.warcraft)