question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No server start error checking

See original GitHub issue

If attempted on a system without java, or if the server failed to start for whatever reason, no error is raised until an action is attempted (checkTikaServer does not fail if the server fails to start).

Also, there is a sleep in startServer. Should make some actual calls to the server to check that its running correctly, i.e. spin-loop a request until it succeeds, or time/max-retry out.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
mjbommarcommented, Jun 30, 2018

Just PR’d

On Sat, Jun 30, 2018, 10:27 Chris Mattmann notifications@github.com wrote:

@mjbommar https://github.com/mjbommar I’d be happy to review and yes please clean up and submit your PR with only the relevant lines. We should also include a README.md update in your PR with the new env vars

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/chrismattmann/tika-python/issues/113#issuecomment-401544572, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFMPfJHCB6hiUT5gYYYM1YBqxuHFeC9ks5uB4rogaJpZM4I6IAT .

1reaction
mjbommarcommented, Jun 30, 2018

happy saturday, @Purg and @chrismattmann!

i took a stab at this, adding:

  • custom java path (TIKA_JAVA env)
  • custom startup sleep (TIKA_STARTUP_SLEEP env)
  • custom startup retries (TIKA_STARTUP_MAX_RETRY env)
  • check for permission to write to tika-server.log (sometimes clients would touch/chmod to create tika.log but had not done so for tika-server.log)
  • check that TIKA_JAVA can be executed with subprocess.Popen
  • check that "INFO Started Apache Tika server at..." is present in log before return True

you can find it in my feature branch here: https://github.com/mjbommar/tika-python/tree/feature-check-java-exists

commits here: https://github.com/mjbommar/tika-python/commit/3ca6c2b144a54fa4531b9e048fcf8041ab2f4fb8

apologies for pycharm’s aggressive reformatting, but the real changes should be apparent in the constants, startServer, and checkTikaServer

if one of you would like to review and test, i can fix the cosmits and PR with just the relevant lines.

mjbommar@DESKTOP C:\Users\mjbommar\PycharmProjects\tika-python
$ set TIKA_JAVA=java11

mjbommar@DESKTOP C:\Users\mjbommar\PycharmProjects\tika-python
$ ipython
Python 3.6.1 |Anaconda 4.4.0 (64-bit)| (default, May 11 2017, 13:25:24) [MSC v.1900 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 6.3.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import tika.language

In [2]: tika.language.from_buffer("This is definitely English")
2018-06-30 09:08:16,077 [MainThread  ] [ERROR]  Unable to run java; is it installed?
2018-06-30 09:08:16,079 [MainThread  ] [ERROR]  Failed to receive startup confirmation from startServer.
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-2-dce7274abac5> in <module>()
----> 1 tika.language.from_buffer("This is definitely English")

~\PycharmProjects\tika-python\tika\language.py in from_buffer(string)
     35     '''
     36     status, response = callServer('put', ServerEndpoint, '/language/string', string,
---> 37                                   {'Accept': 'text/plain'}, False)
     38     return response

~\PycharmProjects\tika-python\tika\tika.py in callServer(verb, serverEndpoint, service, data, headers, verbose, tikaServerJar, httpVerbs, classpath, rawResponse)
    533     global TikaClientOnly
    534     if not TikaClientOnly:
--> 535         serverEndpoint = checkTikaServer(scheme, serverHost, port, tikaServerJar, classpath)
    536
    537     serviceUrl = serverEndpoint + service

~\PycharmProjects\tika-python\tika\tika.py in checkTikaServer(scheme, serverHost, port, tikaServerJar, classpath)
    591             if not status:
    592                 log.error("Failed to receive startup confirmation from startServer.")
--> 593                 raise RuntimeError("Unable to start Tika server.")
    594     return serverEndpoint
    595

RuntimeError: Unable to start Tika server.
Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to Start the Server Service - Microsoft Support
When you attempt to start the Server service from a command prompt, you may receive the following error message: System error 1058 has...
Read more >
How to Resolve 'Server Service Won't Start' Error in Pro-Watch
This video provides step by step instructions for how to resolve a common 'Windows could not start the Pro-Watch Server service on the...
Read more >
Error Checking Server Process Execution Privilege when ...
The container starts and I am able to access the GUI. What you expected to happen: Not getting the error. Not sure what...
Read more >
Error handling - Apollo GraphQL Docs
A client sent the hash of a query string to execute via automatic persisted queries, but the query was not in the APQ...
Read more >
How To Fix the “Server IP Address Could Not Be Found” Error
Check your internet connection and router. Restart your computer. Use an Incognito or private browsing window to navigate to the site. Set the ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found