tabulapdf / tabula-java

Extract tables from PDF files
MIT License
1.82k stars 425 forks source link

A command error occurred at some point. #537

Closed hihi7468 closed 9 months ago

hihi7468 commented 9 months ago

I have been reading PDFs well using tabula. I didn't change anything, and at some point it stopped working. tb.read_pdf(file_item, area= (self.certain__coordinate_list),pages='1', encoding='utf-8',stream=True) If you run this, an error occurs. 2023-12-15 10:07:46.934329 : tabula read pdf error : Command '['java', '-Dfile.encoding=UTF8', '-jar', 'C:\Users\ADMINI~1\AppData\Local\Temp\_MEI517202\tabula\tabula-1.0.5-jar-with-dependencies.jar', '--pages', '1', '--area', '98.116,58.339,108.723,156.986', '--area', '97.055,159.107,109.784,251.389', '--area', '97.639,252.45,109.519,344.52', '--area', '99.177,344.732,108.723,420.043', '--area', '122.318,58.091,133.773,198.818', '--area', '122.377,199.516,133.784,342.923', '--area', '121.888,420.836,134.11,538.984', '--area', '136.227,115.364,150.955,288.818', '--stream', '--format', 'JSON', 'D:\usr\sap\UNIPASS\pdf_data\IMP_1235623E60742M_2.pdf']' returned non-zero exit status 1. The file exists and the path is correct. It's not an attempt to read a file that doesn't exist. However, to reproduce this, I tried reading the file with the error in Windows 10, a 64-bit operating system, and an x64-based processor, but no error occurred. image It's just simple code. But it doesn't work. image

The Windows version is Windows Server 2012 R2 Standard. It is an x64-based processor with a 64-bit operating system. I don't know why it started working fine, but then suddenly stopped working.

hihi7468 commented 9 months ago

Ah... I solved it.

The cause of the error is as follows.

#

There is insufficient memory for the Java Runtime Environment to continue.

Native memory allocation (mmap) failed to map 1073741824 bytes for G1 virtual space

Possible reasons:

The system is out of physical RAM or swap space

The process is running with CompressedOops enabled, and the Java Heap may be blocking the growth of the native heap

Possible solutions:

Reduce memory load on the system

Increase physical memory or swap space

Check if swap backing store is full

Decrease Java heap size (-Xmx/-Xms)

Decrease number of Java threads

Decrease Java thread stack sizes (-Xss)

Set larger code cache with -XX:ReservedCodeCacheSize=

JVM is running with Zero Based Compressed Oops mode in which the Java heap is

placed in the first 32GB address space. The Java Heap base address is the

maximum limit for the native heap growth. Please use -XX:HeapBaseMinAddress

to set the Java Heap base and to place the Java Heap above 32GB virtual address.

This output file may be truncated or incomplete.

#

Out of Memory Error (os_windows.cpp:3528), pid=30648, tid=52612

#

JRE version: (20.0.1+9) (build )

Java VM: Java HotSpot(TM) 64-Bit Server VM (20.0.1+9-29, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, windows-amd64)

Core dump will be written. Default location: D:\usr\sap\UNIPASS\hs_err_pid30648.mdmp

#

--------------- S U M M A R Y ------------

Command Line: -Dfile.encoding=UTF8 C:\Users\ADMINI~1\AppData\Local\Temp_MEI532602\tabula\tabula-1.0.5-jar-with-dependencies.jar --pages 1 --area 98.116,58.339,108.723,156.986 --area 97.055,159.107,109.784,251.389 --area 97.639,252.45,109.519,344.52 --area 99.177,344.732,108.723,420.043 --area 122.318,58.091,133.773,198.818 --area 122.377,199.516,133.784,342.923 --area 121.888,420.836,134.11,538.984 --area 136.227,115.364,150.955,288.818 --stream --format JSON D:\usr\sap\UNIPASS\pdf_data\IMP_1235623E60742M_2.pdf

Host: Intel(R) Xeon(R) Silver 4110 CPU @ 2.10GHz, 32 cores, 63G, Windows Server 2012 R2 , 64 bit Build 9600 (6.3.9600.17415) Time: Fri Dec 15 10:29:11 2023 Windows Server 2012 R2 , 64 bit Build 9600 (6.3.9600.17415) elapsed time: 0.031115 seconds (0d 0h 0m 0s)

--------------- T H R E A D ---------------

Current thread (0x0000009cb8febfe0): JavaThread "Unknown thread" [_thread_in_vm, id=52612, stack(0x0000009cb8690000,0x0000009cb8790000)]

Stack: [0x0000009cb8690000,0x0000009cb8790000]

The problem was resolved by clearing the memory.