Hi everyone,

It seems like I run into memory problems when using moses server even
though I have plenty of memory available.

I isolated the problem in a little script (attached). I start the server
and send strings for translation iteratively. At a certain point it will
send the request and wait for a reply forever. The number of iterations
decreases, when I increase the length of the string.
It seems as if the already sent requests are "piling up" somewhere in
the server's or client's memory and at a certain point it doesn't have
the capacity to process the new request.

Has anyone gone through anything similar?

Cheers
Sarah
-- 
Sarah Schulz
University of Stuttgart
Institute for Natural Language Processing (IMS)
Pfaffenwaldring 5B, 70569 Stuttgart
Germany

http://www.ims.uni-stuttgart.de/institut/mitarbeiter/schulzsh/
import random
import xmlrpclib as x
import time
import sys
import subprocess

#initialize random port and start moses server as subprocess
port_uni= str(random.randint(40000, 50000))
p1 = subprocess.Popen("/mount/arbeitsdaten13/users/schulzsh/tools/Moses/mosesdecoder/bin/mosesserver -f ../static/Moses/decoder_files/SMT_Werther_uni.ini --server-port "+ port_uni,stderr=subprocess.PIPE,bufsize=8000,shell=True,env={"LD_LIBRARY_PATH":"/mount/projekte/sfb-732/inf/users/sarah/tools/xmlrpc-c/lib"})

#wait for it to start sucessfully
elapsed_time=0
start_time = time.time()
           
err=''
out=''
for line in iter(p1.stderr.readline, ''):

    if "Listening on port" in line or elapsed_time > 150:
        print "loaded uni1"
        break
               
    elapsed_time = time.time() - start_time
            
    if elapsed_time >= 150:
        print "SMT Unigram Server Mode doesn't start."
        sys.exit()

#connect to ServerProxy
s_unigram = x.ServerProxy("http://localhost:"+port_uni+"/RPC2",allow_none=True,verbose=True)


#send a message to moses server for translation
#note: when message length increases, the bug appears after fewer iterations
for i in range(1000):

    trans= s_unigram.translate({"text":"# I c h j k k k # k k k k  k k k k k k k #","align":"true"})
    print trans
    print i
_______________________________________________
Moses-support mailing list
[email protected]
http://mailman.mit.edu/mailman/listinfo/moses-support

Reply via email to