Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

too many cat zombie processes #89

Closed
goog opened this issue Sep 5, 2013 · 5 comments
Closed

too many cat zombie processes #89

goog opened this issue Sep 5, 2013 · 5 comments

Comments

@goog
Copy link

goog commented Sep 5, 2013

the code is :

java = local["java"]
def seg(text):
    seged = (cat << text |java["-mx700m","-cp","/home/drill/segment/stanford-ner.jar:",
                               "edu.stanford.nlp.ie.NERServer","-port","9191","-client"])()
    seged = seged.split('\n',1)[1].strip()
    seged = seged.encode('utf8')
    return seged

I have thousands of short text to segment, so the seg function will be involved thousand times,but I found that there are too many cat processes in the current OS(ubuntu). how to solve it ?

@AndydeCleyre
Copy link
Contributor

What do you mean when you say that there are too many processes -- too many for what? As in, so many that ___.

Maybe you don't need to use cat at all. Can you write in English what the purpose of this code is? seg takes a string text -- are you using cat to write that to a file, and your java command needs a file as input?

@goog
Copy link
Author

goog commented Sep 6, 2013

it seems the java class needs a file as input.
the code snippet is a client handler, which involves a java class to handle the text, but the class will be a interactive shell and need to input a string as input, I don't want to write and read files repeatedly. before the code is finished there will be 2181 zombie processes

screenshot from 2013-09-06 11 16 48

@goog
Copy link
Author

goog commented Sep 6, 2013

does it exist a close function or smth like GC ? @tomerfiliba

@tomerfiliba
Copy link
Owner

first of all, why do you need to use cat to pass text to the java process? why not just:

(java["-mx700m","-cp","/home/drill/segment/stanford-ner.jar:", 
    "edu.stanford.nlp.ie.NERServer", "-port","9191","-client"] << text)()

that way there's second process involved. but you did uncover a bug, whereby the left hand side of the pipe was not waited on. i'm now pushing a fix for that. thanks for reporting.

but again, in your case, you most certainly don't need to use cat

@goog
Copy link
Author

goog commented Sep 6, 2013

yes, u r right. and I referenced input-output-redirection lol.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants