[ts-gen] MacOS Shim problems

Paul C paulq2o0 at yahoo.co.uk
Fri May 22 06:54:30 EDT 2009


On Fri, May 22, 2009 at 01:04:39AM -0700, Mike Thornton wrote:
> Hi all,
> 
> I too am seeing lockup with the revisions that Bill suggests -- the lockup
> occurs after the shim header/account info is printed.  My entire python script
> subscribes to a EUR:USD contract right after connecting in order to keep data
> flowing through the linux pipe.  Right after the header info is printed, an
> uncommented "d.print_line(t[i - 1], a, b, x);" from "leaf.c" shows the
> following data below, and then a few lines of data on the EUR:USD contract are
> printed...then lockup occurs.  If I tail the "ShimText" file, I see that market
> data is not printing to the log file either.  My entire python code, as you
> would expect based on the "ShimText" behavior, does not progress passed a
> readline() statement from the stdout pipe.
> 
> The odd thing is that a separate python test script I emailed about last week
> (and which Paul suggested modifications which fixed the polling lock-up) does
> *not* lock-up, but my entire python code (which does not appear qualitatively
> different to me, but is too large to mail -- it includes some other statements
> for parsing the output, for saving recent history, etc.) does.  I have included
> the last stdout prints below from the lock-up and non-lock-up version if that
> helps you.  I have included my sample test python code below which does *not*
> lock up.  I have been trying to recreate a simple lock-up test-case based on
> the python code below, which *does* lock up, but have not been able to yet...

Mike,
1. You say the python code that does *not* lock-up does not appear qualitatively different, but
can you clarify whether it contains more than one shimProcess.stdin.write command?

2. You are trying to recreate 'lock-up' in the test-case python script you posted. Try this:
 
 import subprocess
 import select
 import time
 
 if __name__ == '__main__':
     shimProcess = subprocess.Popen('/usr/local/shim/shim --risk cout file save', bufsize=1, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
     orderSubmitted = False
     shimProcess.stdin.write("ping XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX;\n")
     shimProcess.stdin.flush()
     while True:
         select.select([shimProcess.stdout],[],[])
         line = shimProcess.stdout.readline().strip()
         if (len(line) > 0) and not orderSubmitted:
             shimProcess.stdin.write("select tick CASH:IDEALPRO:EUR:USD 1;\n")
             shimProcess.stdin.flush()
             orderSubmitted = True
         print "line = %s" % line

I've only added the one line (ping XXX...) and flush, but it's enough (on my
system) to create 'lock-up'. If it is this sort of sdtin problem causing 
'lock-up' in your other python code, it may be similar to what I've
seen elsewhere (which I may mention in a different thread).

regards

Paul


> 
> The lock-up and non-locked up code both print the same statements from the
> uncommented line in "leaf.c", suggesting to me that the cause of the lockup is
> not at the line in "leaf.c" as Ric suspects.  I would certainly be willing to
> poke around the source code, but I am not too familiar with it.  Bill, are
> there files you would recommend scrutinizing?
> 
> --Mike

<snipped>


More information about the ts-general mailing list