tika-python
tika-python copied to clipboard
killServer fails to stop tika
OS: MacOS 14.5 Python: 3.11.9 (CPython) tika-python: 2.6.0
test.py:
import tika
import time
from tika import parser, tika as server
import logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
)
tika.initVM()
parser.from_file("tests//resources/sample-complaint.pdf")
server.killServer()
Logging output:
NOTE: I adjusted the tika.py error logging in killServer to contain the PID and error message
2024-06-26 14:45:09,823 [MainThread ] [WARNI] Failed to see startup log message; retrying...
2024-06-26 14:45:09,823 - tika.tika - WARNING - Failed to see startup log message; retrying...
2024-06-26 14:45:15,458 [MainThread ] [ERROR] Failed to kill the current server session: pid=12595,message=[Errno 3] No such process
2024-06-26 14:45:15,458 - tika.tika - ERROR - Failed to kill the current server session: pid=12595,message=[Errno 3] No such process
2024-06-26 14:45:16,462 [MainThread ] [ERROR] Failed to kill the current server session: pid=12595,message=[Errno 3] No such process
2024-06-26 14:45:16,462 - tika.tika - ERROR - Failed to kill the current server session: pid=12595,message=[Errno 3] No such process
The process number is incorrect:
ps -eaf|grep java|grep tika
501 12596 1 0 2:45PM ?? 0:01.41 java -cp /var/folders/rv/b0gzwsyj2h15_vw9rgjhx5hm0000gn/T/tika-server.jar org.apache.tika.server.core.TikaServerCli --port 9998 --host localhost
501 12599 12596 0 2:45PM ?? 0:04.20 java -Djava.awt.headless=true -cp /var/folders/rv/b0gzwsyj2h15_vw9rgjhx5hm0000gn/T/tika-server.jar -Dtika.server.id=cc525374-f09c-4226-8e02-c078343f28f5 org.apache.tika.server.core.TikaServerProcess -h localhost -p 9998 -i cc525374-f09c-4226-8e02-c078343f28f5 -forkedStatusFile /var/folders/rv/b0gzwsyj2h15_vw9rgjhx5hm0000gn/T/apache-tika-server-forked-tmp-5802444130074528304 -numRestarts 0
The parent process is 12596 but the logger indicates that it's trying to use 12595.