http://www.perlmonks.org?node_id=1039612


in reply to DBD::Sybase query execute hangs randomly for Sybase IQ 15.4

Ditto.   Since the code “runs fine,” there is really no reason to presume that the root cause of the problem is within this code.   Next time the program freezes, list the active connections and find yours; then, list the units-of-work for that connection.   This, and really only this, will tell you what is actually going on.   It’s going to be resource-contention, or a lock that is bigger than it needs to be, or simply a throttling parameter of some kind, all of which are not “bugs in your code.”

Replies are listed 'Best First'.
Re^2: DBD::Sybase query execute hangs randomly for Sybase IQ 15.4
by cmahajan (Initiate) on Jun 19, 2013 at 15:26 UTC
    I've tried running the SQL separately and unfortunately it always runs to completion, giving me the expected result. In my original post I've only posted a small fragment of a much larger code which executes many similar SQL statements within a very short time (like within 1 minute). The code is in fact used in a Datastage parallel job which spawns at least 4 instances of my Perl code in parallel. The code always gets stuck for the same SQL rather than for random (similar) SQLs. I'm also consulting Sybase DBAs to see if there is a limitation on the number of active connections at any time (which may be a setting specific to my database, set by the DBA or may be a Sybase IQ 15.4 default behavior). Since DBD::Sybase works fine with Sybase IQ, I'm inclined to believe that the problem may be related to the database rather than the code itself. Since Sybase 15.4 is a pretty recent iteration of the IQ product, perhaps some default behavior may have changed, I'm really not sure at the moment.

      In case your dbas need information on the Config file. In particular, look at:

      1. -iqgovern Number of concurrent queries (default is 2*num_cpu+10)
      2. -gm Number of connections that can be active at one time

      You might be running into blocking locks if the parallel runs of your Perl code are hitting the same pages.

      As far as Perl goes, you may want to enable DBI Tracing to determine if there is something funky going on.

      Jason L. Froebe

      Blog, Tech Blog

        I'm going to enable DBI tracing and will check the trace file for any hints. Will update the results here.
        I enabled DBI Tracing in my script and here's the error message I got in the trace file. I was lucky enough that the issue occurred shortly after I added the tracing code in my code. From the error message I believe that this is related to the network configuration on my Unix machine (IBM AIX). Any ideas on how to go about fixing this? =================================== -> FETCH for DBD::Sybase::db (DBI::db=HASH(0x30844064)~INNER 'Driver') ERROR: 50 'OpenClient message: LAYER = (4) ORIGIN = (1) SEVERITY = (5) NUMBER = (28) Server bhedw_dev, database Message String: ct_results(): protocol specific layer: external error: There is a tds protocol error. An illegal token was received. OpenClient message: LAYER = (1) ORIGIN = (1) SEVERITY = (1) NUMBER = (50) Server bhedw_dev, database Message String: ct_cmd_drop(): user api layer: external error: The connection has been marked dead. ===================================