FileNotFoundException (file too large)

I am getting this exception when I try to upload a file

Caused by: java.io.FileNotFoundException: /repository/PWWVFSYWDW0STLHYVEEKHMYBXZTTETGROCQ4FGdsadadaXR1407709207964905350810526.jpg (File too large)
at java.io.FileOutputStream.open(Native Method)

      

It is clear that the file exists. Also, this same program works correctly on my PC, but there is a problem with the server which is Unix

Any ideas what might be causing this?

+3


source to share


5 answers


I think this is an incomprehensible bug that actually comes from the OS layer or the JVM code implementation. File Too Large is the error you get if you use the perror

C library method to display the error number EFBIG

.

This shouldn't normally happen now. According to UNIX / Linux manual entries, various library calls open

should not interrupt with EFBIG.

However, I have seen various bug reports that imply that fopen

(etcetera) may crash on some filesystems and / or when a C / C ++ program was built to support 64-bit file size.


So what does this mean?



Unclear, but I suspect this means that you either:

  • using flaky Java implementation,

  • starts a debug version of UNIX / Linux, or

  • you are trying to use some type of filesystem that is not supported by your server OS. (Could this be on the FUSE filesystem?)

Possibly Java related error:

+1


source


So it is resolved. The problem is that the disk is full, because as a result the thread takes a long time, I clean up the disk after there is no problem,



+1


source


POSIX systems (and therefore Unix) can impose a maximum length on the path (what you get from File.getPath()

or path components (the last one you can get with File.getName()

). Seeing this issue because of the long filename.

In this scenario, the file open

will crash the operating system with an ENAMETOOLONG

error code .

However, the "File Too Large" message is usually associated with an error code EFBIG

. Most likely it will be triggered by a system call write

:

An attempt was made to write a file that exceeds the implementation-specific maximum file size or process file size limit.

Perhaps the file is being opened for appending, and the implied lseek

at the end of the file gives an error EFBIG

.

0


source


Regardless of the JVM error output (which can be misleading or slightly disabled), you can check that your Unix process has enough open files . Exhaustive process file files can lead to all types of FS-related error codes.

0


source


I got this message when trying to write a file to a directory on a RedHat server that already had the maximum number of files. I split my files into subdirectories and the error didn't appear again.

0


source







All Articles