python - When timeout is more than 10,000 in pycorenlp I get "java.net.UnknownHostException: server: server: unknown error" on Linux (runs fine on OS X). Why? -
i trying run pycorenlp on long text. in order avoid getting corenlp request timed out. document may long
error message, increased stanford corenlp specifying timeout.
here code use (it's simplified version of pycorenlp's example.py):
from pycorenlp import stanfordcorenlp if __name__ == '__main__': nlp = stanfordcorenlp('http://localhost:9000') text = ( 'pusheen , smitha walked along beach. pusheen wanted surf,' 'but fell off surfboard.') output = nlp.annotate(text, properties={ 'timeout': '10001' # setting timeout 10000 or below "fixes" issue. 'annotators': 'tokenize,ssplit,pos,depparse,parse', 'outputformat': 'json' }) print(output)
it outputs server: unknown error
. server log contains:
java.net.unknownhostexception: server: server: unknown error @ java.net.inetaddress.getlocalhost(inetaddress.java:1505) @ edu.stanford.nlp.pipeline.stanfordcorenlpserver$corenlphandler.handle(stanfordcorenlpserver.java:393) @ com.sun.net.httpserver.filter$chain.dofilter(filter.java:79) @ sun.net.httpserver.authfilter.dofilter(authfilter.java:83) @ com.sun.net.httpserver.filter$chain.dofilter(filter.java:82) @ sun.net.httpserver.serverimpl$exchange$linkhandler.handle(serverimpl.java:675) @ com.sun.net.httpserver.filter$chain.dofilter(filter.java:79) @ sun.net.httpserver.serverimpl$exchange.run(serverimpl.java:647) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1142) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:617) @ java.lang.thread.run(thread.java:745) caused by: java.net.unknownhostexception: server: unknown error @ java.net.inet6addressimpl.lookupallhostaddr(native method) @ java.net.inetaddress$2.lookupallhostaddr(inetaddress.java:928) @ java.net.inetaddress.getaddressesfromnameservice(inetaddress.java:1323) @ java.net.inetaddress.getlocalhost(inetaddress.java:1500) ... 10 more
the stanford core nlp server launched using:
java -mx4g -cp "*" edu.stanford.nlp.pipeline.stanfordcorenlpserver 9000
i don't want segment text smaller texts.
is there way set timeout higher 10000? (i.e. higher 10 seconds)
it works fine on mac os x 10.10 (java version "1.8.0_60"): issue arises in ubuntu 14.04 (java version "1.8.0_77"). both have python 2.7 pycorenlp 0.2.0 , stanford corenlp version 3.6.0.
to clear, not seeing issue if run server on macbook?
then appears issue machine running server on. server code trying call:
inetaddress.getlocalhost().gethostname()
and getting exception.
here thread found had similar issue:
inetaddress.getlocalhost() throws unknownhostexception
what in /etc/hosts file on machine you're trying run server?
Comments
Post a Comment