United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: 6499219 SIGXFSZ kills VM
6499219 : SIGXFSZ kills VM

Details
Type:
Bug
Submit Date:
2006-11-30
Status:
Closed
Updated Date:
2012-10-08
Project Name:
JDK
Resolved Date:
2007-02-17
Component:
hotspot
OS:
linux
Sub-Component:
runtime
CPU:
x86
Priority:
P3
Resolution:
Fixed
Affected Versions:
5.0u9
Fixed Versions:
hs10

Related Reports
Backport:
Backport:

Sub Tasks

Description
J2SE Version (please include all output from java -version flag):
  1.5.0_09

Does this problem occur on J2SE 1.3, 1.4.x or 1.5?  Yes / No (pick one)
  Yes


Operating System Configuration Information (be specific):
  Linux


Bug Description:
  When writing very large files on some Systems, the JVM is exiting stating 
  that 'File size limit exceeded'. On many Linux systems there is a file called
  /etc/security/limits.conf which by default puts a hard limit on users file 
  sizes to 100Mb.

  When Clients are uploading Files, we don't want the Server to crash because 
  of a very large file. We would expect Java to throw an IOException when this 
  signal is received instead of exiting the JVM.


Steps to Reproduce (be specific):
  Here is a test file which has been tested on Linux using jre 1.5.0_09
  with the limits.conf having a small hard file size limit of 1000 KBs

import static java.lang.System.*;
import java.io.*;

public class Test {
 public static void main(String[] args) {
   try {
     new FileOutputStream(new File("test.txt")).write(new byte[10000000]);
   }
   catch (Throwable ex) {
     ex.printStackTrace();
   }
   out.println("Done");
 }
}

  The first 1024000 bytes are written to the file, then the JVM simply exits 
  stating that 'File size limit exceeded'. There is no error log file (looked in 
  all the normal places and ran a locate hs_err_pid to double check).
  The word Done is never displayed.

                                    

Comments
EVALUATION

VM needs to handle SIGXFSZ signal.
                                     
2007-01-24
EVALUATION

Results of test with VM handling SIGXFSZ:
java Test
java.io.IOException: File too large
	at java.io.FileOutputStream.writeBytes(Native Method)
	at java.io.FileOutputStream.write(FileOutputStream.java:247)
	at Test.main(Test.java:10)
Done
                                     
2007-01-24
EVALUATION

The issue is that the SIGXFSZ signal is killing the VM. Here's the output from strace:

[pid  9470] write(10, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 8976000 <unfinished ...>
[pid  9472] <... fstat64 resumed> {st_mode=S_IFREG|0644, st_size=1569, ...}) = 0
[pid  9470] <... write resumed> )       = -1 EFBIG (File too large)
[pid  9472] read(11,  <unfinished ...>
[pid  9470] --- SIGXFSZ (File size limit exceeded) @ 0 (0) ---
Process 9470 detached
[pid  9472] <... read resumed> "\312\376\272\276\0\0\0001\0G\t\0\7\0*\t\0\7\0+\t\0\7\0"..., 1569) = 1569
[pid  9469] <... futex resumed> )       = -1 EINTR (Interrupted system call)
[pid  9471] <... futex resumed> )       = -1 EINTR (Interrupted system call)
[pid  9477] <... futex resumed> )       = -1 EINTR (Interrupted system call)
[pid  9473] <... futex resumed> )       = -1 EINTR (Interrupted system call)
[pid  9474] <... futex resumed> )       = -1 EINTR (Interrupted system call)
[pid  9475] <... futex resumed> )       = -1 EINTR (Interrupted system call)
[pid  9476] <... futex resumed> )       = -1 EINTR (Interrupted system call)
[pid  9471] +++ killed by SIGXFSZ (core dumped) +++
Process 9471 detached
[pid  9477] +++ killed by SIGXFSZ (core dumped) +++
Process 9477 detached
[pid  9472] +++ killed by SIGXFSZ (core dumped) +++
Process 9472 detached
[pid  9473] +++ killed by SIGXFSZ (core dumped) +++
Process 9473 detached
[pid  9474] +++ killed by SIGXFSZ (core dumped) +++
Process 9474 detached
[pid  9475] +++ killed by SIGXFSZ (core dumped) +++
Process 9475 detached
[pid  9476] +++ killed by SIGXFSZ (core dumped) +++
Process 9476 detached
+++ killed by SIGXFSZ (core dumped) +++
Process 9469 detached
                                     
2006-11-30



Hardware and Software, Engineered to Work Together