Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hard disk full but no IOException

 
Andi Schmidt
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

i have here a java programe which writes data using 30 threads from a DB (Oracle) into files. The workflow is:
Select unmarked data from DB
Write data to file
Mark data in DB (update) that the file was created

Last weekend the hard disk was full and nobody recognized that. I thought there is no problem and i can start the programe again (after cleaning up the hard disk) to write the unmarked data into files. After that i counted the files and the marked data from DB. I was sure that the results must be equal. I thought no data can be marked after a IOException will writing the file but i was wrong. How can this happen? There is no try/catch which catches the IOException (or other exceptions). I talked with some colleagues and they imagine that there can be problem for example with I/O-Buffers from the filesystem or operating system that sometimes no IOException was thrown.

What do you think? Is that possible? I'm sure there is no failure in the programe because it works since years without problems.

PS: Sorry again for my bad english. I'm really out of practice
 
Joe Ess
Bartender
Posts: 9319
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Andi Schmidt wrote:There is no try/catch which catches the IOException (or other exceptions).


There HAS to be a try/catch. File IO and database access both throw checked exceptions which must be caught or the compiler will flag them. You are not giving us all the details

Andi Schmidt wrote:I talked with some colleagues and they imagine that there can be problem for example with I/O-Buffers from the filesystem or operating system that sometimes no IOException was thrown.


I'm not aware of any such problems. Did you try searching the Java Bug Database?
 
Andi Schmidt
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joe Ess wrote:
There HAS to be a try/catch. File IO and database access both throw checked exceptions which must be caught or the compiler will flag them. You are not giving us all the details

There is a try/catch but later. I'll try to explain it with some code-snippets (it's an example!):



So it shouldn't be possible to reach markDB() when no more disk space is available. I got about 80000 IOExceptions but about in about 30 cases there wasn't thrown one (no file but marked in DB).

JDK version is 1.5.0_22-b03. More details?

Joe Ess wrote:

I'm not aware of any such problems. Did you try searching the Java Bug Database?


I can't find this problem there (and with Google). There are similar problems/bugs but not the same.
 
Peter Taucher
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe if you post your I/O code someone could find the problem?
 
Greg Charles
Sheriff
Posts: 2993
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What you're saying is that writeFile() can in certain cases fail silently. We don't know what's in writeFile() though, so we can't really diagnose it for you. It's possible that the actual Java call to create a file fails silently, but that would indicate a pretty serious bug in either the JVM or underlying OS, which seems unlikely to me. Not impossible, but unlikely.
 
Rob Spoor
Sheriff
Pie
Posts: 20667
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it perhaps possible that the doLogging method fails silently because the log file you're writing to is on the same full disk?
 
Andi Schmidt
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here the code from writeFile(); (with real name and parameters)



Rob Prime wrote:Is it perhaps possible that the doLogging method fails silently because the log file you're writing to is on the same full disk?


That's impossible. The errors are logged in DB too. And, when doLogging() was executed everything was ok, because the IOException was thrown

Btw.: The OS is Sun Solaris
 
Peter Taucher
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also zunächst einmal sollte für Variablen / Kommentare nicht gemischt Deutsch / Englisch verwenden ; - )

The code looks pretty straightforward. If there's any problem in my opinion it can only be in the JDOM Outputter. If you were able to try another method for writing the xml data (e.g. XmlSerializer or such), I'd say give it a try (just to be sure). Of course, you can always check the target file before writing the document ... just calling File#canWrite on it.
-> http://java.sun.com/javase/6/docs/api/java/io/File.html#canWrite()
 
Andi Schmidt
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Peter Taucher wrote:Also zunächst einmal sollte für Variablen / Kommentare nicht gemischt Deutsch / Englisch verwenden ; - )


Der Code stammt nicht von mir. Die damaligen Entwickler wollten halt auch keinen Schönheitspreis gewinnen

Peter Taucher wrote:
The code looks pretty straightforward. If there's any problem in my opinion it can only be in the JDOM Outputter. If you were able to try another method for writing the xml data (e.g. XmlSerializer or such), I'd say give it a try (just to be sure). Of course, you can always check the target file before writing the document ... just calling File#canWrite on it.
-> http://java.sun.com/javase/6/docs/api/java/io/File.html#canWrite()


I think the better solution would be to check after writing if the file really exists. I'm not sure at the moment but i think canWrite(), 30 threads and a disk with no space left can make some problems too.
But to search for the problem in the JDOM Outputter is a very good idea. It's more probably to find a bug there than somewhere else.
 
Peter Taucher
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you're right. Checking for file existence after writing the file may be the better solution. But nontetheless there has to be some reason why sporadically no IOException is thrown...
 
Rob Spoor
Sheriff
Pie
Posts: 20667
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Peter Taucher wrote:Also zunächst einmal sollte für Variablen / Kommentare nicht gemischt Deutsch / Englisch verwenden ; - )

Andi Schmidt wrote:Der Code stammt nicht von mir. Die damaligen Entwickler wollten halt auch keinen Schönheitspreis gewinnen

People, this is an international forum. I can read German (most of it anyway), but I'm sure I'm one of few here.
 
Andi Schmidt
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Prime wrote:
People, this is an international forum. I can read German (most of it anyway), but I'm sure I'm one of few here.


Sorry, but that was only off-topic stuff. All hard facts are in english.
 
Rob Spoor
Sheriff
Pie
Posts: 20667
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know, otherwise I would have added a translation myself
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic