Groups | Search | Server Info | Login | Register


Groups > comp.databases.berkeley-db > #21

DB segfault on close, close method has null pointer ?

X-Received by 10.50.122.72 with SMTP id lq8mr15196655igb.0.1411053091961; Thu, 18 Sep 2014 08:11:31 -0700 (PDT)
X-Received by 10.182.1.202 with SMTP id 10mr16470obo.31.1411053091806; Thu, 18 Sep 2014 08:11:31 -0700 (PDT)
Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!h15no1036763igd.0!news-out.google.com!ef6ni14504igb.0!nntp.google.com!h15no1036761igd.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.databases.berkeley-db
Date Thu, 18 Sep 2014 08:11:31 -0700 (PDT)
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=66.227.10.178; posting-account=0eThBAoAAADZYhElwBL_5vuHUDS4oOJZ
NNTP-Posting-Host 66.227.10.178
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <36342634-57a8-4c60-9011-898ae75e2a29@googlegroups.com> (permalink)
Subject DB segfault on close, close method has null pointer ?
From Tim Putz <tim.putz@gmail.com>
Injection-Date Thu, 18 Sep 2014 15:11:31 +0000
Content-Type text/plain; charset=ISO-8859-1
Xref csiph.com comp.databases.berkeley-db:21

Show key headers only | View raw


Small Berkeley DB test program:

 

#include <db.h>
#include <string.h>
#include <stdio.h>
#include <sys/stat.h>

DB *db;

char dbpath[128] = "/home/v801480/C/jape.db";
char key[128] = "key";
char data[128] = "data";

int ret;

int main (int argc, char **argv) {

  ret = db_create(&db, NULL, 0);
  ret = db->open (db, NULL, dbpath, NULL, DB_HASH, DB_CREATE, S_IWUSR|S_IXUSR|S_IRGRP|S_IWGRP);
  ret = db->put (db, NULL, (DBT *)key, (DBT *)data, DB_APPEND);
  // ret = dbfile->del (db, NULL, (DBT *)key, 0);
  ret = db->close(db, 0);

}

 

Compiled as so


gcc -g berk.c -Llibs/lib -ldb-5.3

 
Segfault on db->close, I think because the "close" method pointer is null (wherea the put method has legit pointer )?

 

20        ret = db->open (db, NULL, dbpath, NULL, DB_HASH, DB_CREATE, S_IWUSR|S_IXUSR|S_IRGRP|S_IWGRP);

(gdb) p *db

$1 = {pgsize = 0, db_append_recno = 0, db_feedback = 0, dup_compare = 0, app_private = 0x0, dbenv = 0x601010, type = 6297664,
  mpf = 0x5, mutexp = 0x6023b0, fname = 0x0, dname = 0x0, open_flags = 0, fileid = '\000' <repeats 19 times>, adj_fileid = 0,
  log_filename = 0x0, meta_pgno = 0, lid = 0, cur_lid = 0, associate_lid = 0, handle_lock = {off = 0, ndx = 0, gen = 0,
    mode = DB_LOCK_NG}, cl_id = 0, timestamp = 0, my_rskey = {data = 0x0, size = 0, ulen = 0, dlen = 0, doff = 0, flags = 0},
  my_rkey = {data = 0x0, size = 0, ulen = 0, dlen = 0, doff = 0, flags = 0}, my_rdata = {data = 0x0, size = 0, ulen = 0, dlen = 0,
    doff = 0, flags = 0}, saved_open_fhp = 0x0, dblistlinks = {le_next = 0x0, le_prev = 0x0}, free_queue = {tqh_first = 0x0,
    tqh_last = 0x0}, active_queue = {tqh_first = 0x0, tqh_last = 0x0}, join_queue = {tqh_first = 0x0, tqh_last = 0x0},
  s_secondaries = {lh_first = 0x0}, s_links = {le_next = 0x0, le_prev = 0x0}, s_refcnt = 6299104, s_callback = 0,
  s_primary = 0x601df0, api_internal = 0x0, bt_internal = 0x601e00, h_internal = 0x0, q_internal = 0x0, xa_internal = 0x0,
  associate = 0, close = 0, cursor = 0, del = 0, dump = 0, err = 0, errx = 0, fd = 0, get = 0, pget = 0x602230,
  get_byteswapped = 0x6022b0, get_cachesize = 0x6022e0, get_dbname = 0, get_encrypt_flags = 0x602300,
  get_env = 0x7ffff7d49070 <__db_associate_pp>, get_errfile = 0x7ffff7d46470 <__db_associate_foreign_pp>,


Compiled DB stuff via the provided make (uses libtool).  Could this have anything to do with it ?  RHEL 2.6.32-358.11.1.el6.x86_64

Thanks, 
Tim 

Back to comp.databases.berkeley-db | Previous | Next | Find similar


Thread

DB segfault on close, close method has null pointer ? Tim Putz <tim.putz@gmail.com> - 2014-09-18 08:11 -0700

csiph-web