Uploaded image for project: 'CUBRID APIs'
  1. CUBRID APIs
  2. APIS-465

[Perl] cubrid_lob_export throws Segmentation fault when export the second row

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: Perl-Aprium
    • Fix Version/s: Perl-Aprium
    • Component/s: Perl Driver
    • Labels:
    • Environment:

      Linux 64

      Description

      [Perl] cubrid_lob_export throws Segmentation fault when export the second row

      Test case: http://svn.cubrid.org/cubridapis/perl/branches/RB-9.1.0/t2/Perl/_38_cubrid_lob_export/cases/cubrid_lob_export_01.pl

      Test Environment:

      cubrid_rel:  9.1.0.0201
      perl driver: http://svn.cubrid.org/cubridapis/perl/branches/RB-9.1.0 1499
      perl:  5.14.2
      

      Test Codes:

      use DBI;
      use Test::More;
      use strict;
      use Cwd;
      use File::Basename;
      my $cwd;
      if ($0 =~ m{^/}) {
      $cwd = dirname($0);
      } else {
      $cwd = dirname(getcwd()."/$0");
      }
      
      use vars qw($db $port $hostname);
      
      $db=$ARGV[0];
      $port=$ARGV[2];
      $hostname=$ARGV[1];
      my $user="dba";
      my $pass="";
      
      my $dsn="dbi:cubrid:database=$db;host=$hostname;port=$port";
      my $dbh;
      $dbh=DBI->connect($dsn, $user, $pass,{RaiseError => 1}) or die "connect error: $dbh->errstr";
      $dbh -> do("drop table if EXISTS doc_t;") or die "drop error: $dbh->errstr";
      $dbh->do("CREATE TABLE doc_t (doc_id VARCHAR(64) PRIMARY KEY, content CLOB);") or die "create error:  $dbh->errstr";
      $dbh->do("INSERT INTO doc_t (doc_id, content) VALUES ('doc-1', CHAR_TO_CLOB('This is a Dog'));") or die "insert error: $dbh->errstr";
      $dbh->do("INSERT INTO doc_t (doc_id, content) VALUES ('doc-2', CHAR_TO_CLOB('This is a Cat'));") or die "insert error: $dbh->errstr";
      
      my $sth=$dbh->prepare("select * from doc_t") or die "prepare error: $dbh->errstr";
      $sth->execute() or die "execute error: $dbh->errstr";
      my $curpath=$cwd."/export2.txt";
      #print $curpath;
      $sth->cubrid_lob_get (2) or die "cubrid_lob_get error: $dbh->errstr\n";
      $sth->cubrid_lob_export(1,$cwd."/export1.txt") or die "cubrid_lob_export error: $dbh->errstr";
      $sth->cubrid_lob_export(2,$curpath) or die "cubrid_lob_export error: $dbh->errstr";
      

      I found the last line of codes above throws the Segmentation fault . And export2.txt has been exported successfully.

        Activity

        Hide
        jinhu 李金虎 added a comment -

        Analysis:
        In cubrid_lob_get(), the imp_sth->lob isn't allocated to point to a array.
        But in destroy phase, the imp_sth->lob is considered as a array. So, the segment fault occurs.

        Fixed in RB-9.1.0, revision: 1523
        Merge into trunk, revision: 1524

        Show
        jinhu 李金虎 added a comment - Analysis: In cubrid_lob_get(), the imp_sth->lob isn't allocated to point to a array. But in destroy phase, the imp_sth->lob is considered as a array. So, the segment fault occurs. Fixed in RB-9.1.0, revision: 1523 Merge into trunk, revision: 1524
        Hide
        cn14130 欧明宝[Bom Owen] added a comment -

        Test Build: 9.1.0.0206
        Test OS: Linux 64
        perl driver: 9.1.0.001
        Test Result: pass

        Show
        cn14130 欧明宝[Bom Owen] added a comment - Test Build: 9.1.0.0206 Test OS: Linux 64 perl driver: 9.1.0.001 Test Result: pass

          People

          • Assignee:
            cn14130 欧明宝[Bom Owen]
            Reporter:
            cn14130 欧明宝[Bom Owen]
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: