[ts-gen] segmentation faults

Bill Pippin pippin at owlriver.net
Tue Aug 19 19:23:51 EDT 2008


Nils,

Thank you much for this report, since I'd really like to track down
your problem.  It might well be due to problems with the shim's being
able to read out-of-date database tables, and although most such
problems are currently caught by exception, yours is not, which is
why it's so interesting.

> I am having problems with shim-080815. Appearenly it compiles fine, but
> quits with seg fault. Plain call ./shim is fine - shows the help
> message, but for example

> ./shim --data

>           The trading shim has connected to the database server
> Segmentation fault

Given the fractional banner display, the shim seems to have crashed
during the database read phase of startup.  What you should see
might be something like the following:

>           The trading shim has connected to the database server
>           and loaded 51649 products; connected to the IB tws as
>           client id  1; and queried for the account code, which
>           seems to be DU12345.  Program initialization has been
>           completed.

> For msg: Portfolio
> and sym: CASH:EUR:USD
> Problem: 418 could not post ambiguous order message
> quit;

Where: the banner continues on with a product count once the database
has been read in, after a noticeable delay, probably in the high
single digit seconds; there may be transient journal posting error
messages for foreign currency portfolio value events, which we know
about, and which can be ignored for now (the data is still in the
log, the error message here means that it didn't make it to the
journal); and the quit was entered by me to finish the session.

If you re-setup your database, you'll probably fix the problem, so
you might like to check the database version; from the mysql
interpreter, use "select * from Version;".  E.g.,

> mysql> select * from Version;
> +-----+---------+------------------------+
> | uid | current | text                   |
> +-----+---------+------------------------+
> |  58 | current | shim dbms version 1.58 |
> +-----+---------+------------------------+
> 1 row in set (0.00 sec)

Or, "cat sql/req/version.sql" works too, if you have the
sql directory that provided the sources for your actual
database:

> tsd$ cat sql/req/Version.sql
> insert into `Version`(uid, text)
> values
> (58, 'shim dbms version 1.58');

> tsd$
 
If the version is much prior to 1.58, then that is almost certainly
at least part of the problem.  Although the shim attempts to check
this, and quits for stale versions, it might well be crashing
during this check.

I'd like to ask that first, however, before running the database
setup scripts, you consider firing up the shim using gdb and
capturing a stack backtrace of the crash, e.g.

> gdb ./shim

> GNU gdb ...
> Copyright (C) 2006 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General Public License, ...
> welcome to change it and/or distribute copies of it under ...
> Type "show copying" to see the conditions.
> There is absolutely no warranty for GDB.  Type "show warranty" ...
> This GDB was configured as ...

> (gdb) run --data                

Then, when it crashes, you would type "where" to get a stack backtrace,
and either cut and paste that, or if that's problematic, start gdb
instead in the context of the script program, to dup everything to
a file.  If you choose to capture such a trace, then if you'd post
it to the list, along with the db version, I'd be very glad to see
what happened.

Once you've done that, you might as well re-setup your database,
since I suspect you have an old one and that that is the cause of
the problem.  And if capturing a stack backtrace is not feasible,
then no problem, just go ahead and re-setup right away, and in any
case please let us know if that fixes your problem.

As for help:

> same with ./shim --help.

Help is known broken right now; the text is out of date, so I crippled
it to avoid misleading users.  It's on our near-term list of things
to work on, since fixing it is not that hard, and we have some new
users who might like to see it work.  Right now, however, I'm still
dealing with some of the ramifications of the new order journalling
features, so help will probably continue to be disabled as we work
to get you up and running.

Thanks again for the report,

Bill



More information about the ts-general mailing list