Hi,

We have seen sqlite segfault on OpenBSD/sparc64 in the context
of running Subversion's regression test suite:
https://ci.apache.org/builders/svn-bb-openbsd/builds/498

The log files show that a simple 'svn update' triggers the problem:
https://ci.apache.org/builders/svn-bb-openbsd/builds/498/steps/Cleanup/logs/stdio
https://ci.apache.org/builders/svn-bb-openbsd/builds/498/steps/svn/logs/stdio

The trace within sqlite for this crash looks like :

Reading symbols from svn...(no debugging symbols found)...done.
[New process 486437]
Core was generated by `svn'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  sqlite3VdbeRecordUnpack (pKeyInfo=0x4868586788, nKey=-538976289, 
pKey=0xdfdfdfdfdfdfdfdf, p=0x48d0b05008) at sqlite3.c:81298
81298     idx = getVarint32(aKey, szHdr);
(gdb) bt
#0  sqlite3VdbeRecordUnpack (pKeyInfo=0x4868586788, nKey=-538976289, 
pKey=0xdfdfdfdfdfdfdfdf, p=0x48d0b05008) at sqlite3.c:81298
#1  0x0000004951fca230 in sqlite3VdbeExec (p=0x48a9ed9208) at sqlite3.c:89382
#2  0x0000004951fcda40 in sqlite3Step (p=<optimized out>) at sqlite3.c:83210
#3  sqlite3_step (pStmt=0x48a9ed9208) at sqlite3.c:17739


Note that on OpenBSD 0xdfdfdfdfdfdfdfdf is written to memory which
has been freed.

With sqlite compiled with debugging enabled the problem triggers a
few lines f code earlier and manifests itself as an assertion failure:

#1  0x000000e27e089f48 in *_libc___assert2 (file=0xe2eb9d90e0 "sqlite3.c",
    line=89376, func=0xe2eb9ec9d8 <__func__.59513> "sqlite3VdbeExec",
    failedexpr=0xe2eb9ee570 "pIn3->flags & MEM_Blob")
    at /usr/src/lib/libc/gen/assert.c:52
#2  0x000000e2eb72d42c in sqlite3VdbeExec (p=0xe2a3d0a408) at sqlite3.c:89376


I have been trying to isolate the problem for a couple of hours and
don't believe I'll get much further without help.

What's going on in Subversion is that a 'base node' row is being
inserted into the NODES table in the working copy database.
The query being executed is "STMT_INSERT_NODE":
-- STMT_INSERT_NODE
INSERT OR REPLACE INTO nodes (
  wc_id, local_relpath, op_depth, parent_relpath, repos_id, repos_path,
  revision, presence, depth, kind, changed_revision, changed_date,
  changed_author, checksum, properties, translated_size, last_mod_time,
  dav_cache, symlink_target, file_external, moved_to, moved_here,
  inherited_props)
VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14,
        ?15, ?16, ?17, ?18, ?19, ?20, ?21, ?22, ?23)

The input values bound to this query by Subversion all seem fine.

I also know that Subversion was working fine before I upgraded this
sparc64 machine to a newer OpenBSD -current snapshot on March 8, at
which point among many unrelated updates the sqlite package on the
system was upgraded from 3.30.1 to 3.31.1. As you can see on this page,
builds were green before I upgraded the system:
https://ci.apache.org/builders/svn-bb-openbsd

Below is a full back trace with debug symbols, compiled from the
sqlite-autoconf-3310100 release. At the end I've included values from
some data structures that seem relevant.

Is this enough information? I can reproduce the problem reliably,
so if you need more information just let me know what you want to see.

Cheers,
Stefan


This trace is from 'svn up' in a working copy of svn.apache.org's
"repos/asf/apr/trunk" folder, which I happened to have available.

(gdb) bt
#0  *_libc_abort () at /usr/src/lib/libc/stdlib/abort.c:57
#1  0x000000e27e089f48 in *_libc___assert2 (file=0xe2eb9d90e0 "sqlite3.c",
    line=89376, func=0xe2eb9ec9d8 <__func__.59513> "sqlite3VdbeExec",
    failedexpr=0xe2eb9ee570 "pIn3->flags & MEM_Blob")
    at /usr/src/lib/libc/gen/assert.c:52
#2  0x000000e2eb72d42c in sqlite3VdbeExec (p=0xe2a3d0a408) at sqlite3.c:89376
#3  0x000000e2eb71a370 in sqlite3Step (p=0xe2a3d0a408) at sqlite3.c:83210
#4  0x000000e2eb71a894 in sqlite3_step (pStmt=0xe2a3d0a408) at sqlite3.c:83275
#5  0x000000e30cfff5fc in svn_sqlite__step (got_row=0xfffffffffffeb734,
    stmt=0xe332deb910) at subversion/libsvn_subr/sqlite.c:347
#6  0x000000e30cfff6d8 in svn_sqlite__insert (row_id=0x0, stmt=0xe332deb910)
    at subversion/libsvn_subr/sqlite.c:371
#7  0x000000e2896d9034 in insert_base_node (pibb=0xfffffffffffeb9a0,
    wcroot=0xe2754a2d60, local_relpath=0xe27a8481a1 "file_io/os2",
    scratch_pool=0xe27a848028) at subversion/libsvn_wc/wc_db.c:812
#8  0x000000e2896dd1a4 in svn_wc__db_base_add_directory (db=<optimized out>,
    local_abspath=0xe27a848188 "/home/stsp/src/apr-trunk/file_io/os2",
    wri_abspath=<optimized out>,
    repos_relpath=0xe27a8482d8 "apr/apr/trunk/file_io/os2",
    repos_root_url=0xe2754a7628 "https://svn.apache.org/repos/asf";,
    repos_uuid=0xe2754a7650 "13f79535-47bb-0310-9956-ffa450edef68",
    revision=1875042, props=0xe27a848890, changed_rev=1866019,
    changed_date=1566976038342098, changed_author=0xe27a848ba8 "jorton",
    children=0x0, depth=svn_depth_empty, dav_cache=0x0, update_actual_props=1,
    new_actual_props=0xe27a848988, new_iprops=0x0, conflict=0x0,
    work_items=0x0, scratch_pool=0xe27a848028)
#9  0x000000e2896b8d9c in close_directory (dir_baton=0xe27a8480a0,
    pool=0xe2e98b6028) at subversion/libsvn_wc/update_editor.c:2799
#10 0x000000e3055be394 in close_directory (dir_baton=0xe2e98b6188,
    pool=0xe2e98b6028) at subversion/libsvn_delta/cancel.c:281
#11 0x000000e304d9ffa0 in maybe_close_dir (dir=0xe2e98b60a0)
    at subversion/libsvn_ra_serf/update.c:738
#12 0x000000e304da0bb8 in update_closed (xes=0xe2433100a0, baton=0xe2754a7738,
    leaving_state=<optimized out>, cdata=0x0, attrs=0xe2433100e8,
    scratch_pool=0xe332df0028) at subversion/libsvn_ra_serf/update.c:1826
#13 0x000000e304da5a10 in xml_cb_end (raw_name=<optimized out>,
    xmlctx=0xe25fc30100) at subversion/libsvn_ra_serf/xml.c:813
#14 expat_end (baton=<optimized out>, raw_name=<optimized out>)
    at subversion/libsvn_ra_serf/xml.c:904
#15 0x000000e30d014994 in expat_end_handler (userData=0xe25fc302c0,
    name=0xe290d6fc60 "S:open-directory") at subversion/libsvn_subr/xml.c:371
#16 0x000000e32cdcd298 in doContent (parser=0xe2a6ecac00, startTagLevel=0,
    enc=0xe32d0d9e88 <utf8_encoding>,
    s=0xe289594a98 "</S:open-directory>\n<S:open-directory name=\"unix\" 
rev=\"1855812\">\n<D:checked-in><D:href>/repos/asf/!svn/rvr/1866019/apr/apr/trunk/file_io/unix</D:href></D:checked-in>\n<S:set-prop
 name=\"svn:entry:commit"...,
    end=0xe289595f40 "\n   rev=\"1855812\"\n   
depth=\"infinity\">threadproc/beos/proc.c</S:entry>\n", '\337' <repeats 120 
times>, <incomplete sequence \337>,
    nextPtr=0xe2a6ecac30, haveMore=1 '\001')
    at /usr/src/lib/libexpat/lib/xmlparse.c:2656
#17 0x000000e32cdce030 in contentProcessor (parser=0xe2a6ecac00,
    start=0xe289594027 "<S:update-report xmlns:S=\"svn:\" 
xmlns:V=\"http://subversion.tigris.org/xmlns/dav/\"; xmlns:D=\"DAV:\"  
inline-props=\"true\">\n<S:target-revision rev=\"1875042\"/>\n<S:open-directory 
rev=\"1875041\">\n<D:checked-in"...,
    end=0xe289595f40 "\n   rev=\"1855812\"\n   
depth=\"infinity\">threadproc/beos/proc.c</S:entry>\n", '\337' <repeats 120 
times>, <incomplete sequence \337>,
    endPtr=0xe2a6ecac30) at /usr/src/lib/libexpat/lib/xmlparse.c:2257
#18 0x000000e32cdce578 in doProlog (parser=0xe2a6ecac00,
    enc=0xe32d0d9e88 <utf8_encoding>,
    s=0xe289594027 "<S:update-report xmlns:S=\"svn:\" 
xmlns:V=\"http://subversion.tigris.org/xmlns/dav/\"; xmlns:D=\"DAV:\"  
inline-props=\"true\">\n<S:target-revision rev=\"1875042\"/>\n<S:open-directory 
rev=\"1875041\">\n<D:checked-in"...,
    end=0xe289595f40 "\n   rev=\"1855812\"\n   
depth=\"infinity\">threadproc/beos/proc.c</S:entry>\n", '\337' <repeats 120 
times>, <incomplete sequence \337>,
    tok=29,
    next=0xe289594027 "<S:update-report xmlns:S=\"svn:\" 
xmlns:V=\"http://subversion.tigris.org/xmlns/dav/\"; xmlns:D=\"DAV:\"  
inline-props=\"true\">\n<S:target-revision rev=\"1875042\"/>\n<S:open-directory 
rev=\"1875041\">\n<D:checked-in"..., nextPtr=0xe2a6ecac30, haveMore=1 '\001', 
allowClosingDoctype=0 '\000')
    at /usr/src/lib/libexpat/lib/xmlparse.c:4182
#19 0x000000e32cdcfea4 in prologProcessor (parser=0xe2a6ecac00,
    s=0xe289594000 "<?xml version=\"1.0\" 
encoding=\"utf-8\"?>\n<S:update-report xmlns:S=\"svn:\" 
xmlns:V=\"http://subversion.tigris.org/xmlns/dav/\"; xmlns:D=\"DAV:\"  
inline-props=\"true\">\n<S:target-revision rev=\"1875042\"/>\n<S:open"...,
    end=0xe289595f40 "\n   rev=\"1855812\"\n   
depth=\"infinity\">threadproc/beos/proc.c</S:entry>\n", '\337' <repeats 120 
times>, <incomplete sequence \337>,
---Type <return> to continue, or q <return> to quit---
    nextPtr=0xe2a6ecac30) at /usr/src/lib/libexpat/lib/xmlparse.c:3905
#20 0x000000e32cdc9b0c in XML_ParseBuffer (parser=0xe2a6ecac00, len=8000,
    isFinal=0) at /usr/src/lib/libexpat/lib/xmlparse.c:1704
#21 0x000000e30d014748 in svn_xml_parse (svn_parser=0xe25fc302c0,
    buf=0xe3266940ca "<?xml version=\"1.0\" 
encoding=\"utf-8\"?>\n<S:update-report xmlns:S=\"svn:\" 
xmlns:V=\"http://subversion.tigris.org/xmlns/dav/\"; xmlns:D=\"DAV:\"  
inline-props=\"true\">\n<S:target-revision rev=\"1875042\"/>\n<S:open"..., 
len=0, is_final=0) at subversion/libsvn_subr/xml.c:500
#22 0x000000e304da6508 in parse_xml (is_final=<optimized out>,
    len=<optimized out>, data=<optimized out>, ectx=<optimized out>)
    at subversion/libsvn_ra_serf/xml.c:874
#23 expat_response_handler (request=0xe326690038, response=0xe33a079138,
    baton=0xe25fc30190, scratch_pool=<optimized out>)
    at subversion/libsvn_ra_serf/xml.c:989
#24 0x000000e304d9f640 in process_buffer (udb=0xe25fc30298,
    request=0xe326690038, data=0xe3266940ca, len=8000, at_eof=0,
    alloc=<optimized out>, pool=0xe27a84c028)
    at subversion/libsvn_ra_serf/update.c:2215
#25 0x000000e304d9fdb0 in update_delay_handler (request=0xe326690038,
    response=0xe33a078a38, handler_baton=0xe25fc30298,
    scratch_pool=0xe324ee8028) at subversion/libsvn_ra_serf/update.c:2275
#26 0x000000e304da428c in handle_response (scratch_pool=<optimized out>,
    serf_status=<optimized out>, handler=<optimized out>,
    response=<optimized out>, request=<optimized out>)
    at subversion/libsvn_ra_serf/util.c:1487
#27 handle_response_cb (request=0xe326690038, response=0xe33a078a38,
    baton=0xe25fc301b8, response_pool=0xe324ee8028)
    at subversion/libsvn_ra_serf/util.c:1521
#28 0x000000e31bc9ed60 in serf.process_connection ()
   from /usr/local/lib/libserf-1.so.1.0
#29 0x000000e31bc9ca18 in serf_event_trigger ()
   from /usr/local/lib/libserf-1.so.1.0
#30 0x000000e31bc9cc4c in serf_context_run ()
   from /usr/local/lib/libserf-1.so.1.0
#31 0x000000e304da46f0 in svn_ra_serf__context_run (sess=0xe2ca7e6258,
    waittime_left=0xfffffffffffecf40, scratch_pool=0xe283b32028)
    at subversion/libsvn_ra_serf/util.c:913
#32 0x000000e304d9f8f4 in process_editor_report (scratch_pool=<optimized out>,
    handler=<optimized out>, ctx=<optimized out>)
    at subversion/libsvn_ra_serf/update.c:2429
#33 finish_report (report_baton=0xe2754a7738, pool=<optimized out>)
    at subversion/libsvn_ra_serf/update.c:2504
#34 0x000000e28967df0c in svn_wc_crawl_revisions5 (wc_ctx=0x0,
    local_abspath=0xe2754a6160 "/home/stsp/src/apr-trunk",
    reporter=0xe3050c4198 <ra_serf_reporter>, report_baton=0xe2754a7738,
    restore_files=0, depth=svn_depth_unknown, honor_depth_exclude=1,
    depth_compatibility_trick=0, use_commit_times=0,
    cancel_func=0xe30cfcd840 <check_cancel>, cancel_baton=0x0,
    notify_func=0xe041912f40 <svn_cl__check_externals_failed_notify_wrapper>,
    notify_baton=0xfffffffffffed848, scratch_pool=0xe2754a6028)
    at subversion/libsvn_wc/adm_crawler.c:859
#35 0x000000e2df098fd4 in update_internal (result_rev=0xfffffffffffed710,
    timestamp_sleep=0xfffffffffffed724, conflicted_paths=0x0,
    ra_session_p=<optimized out>,
    local_abspath=0xe2754a6160 "/home/stsp/src/apr-trunk",
    anchor_abspath=0xe2754a6288 "/home/stsp/src/apr-trunk",
    revision=0xfffffffffffed5d0, depth=svn_depth_unknown, depth_is_sticky=0,
    ignore_externals=0, allow_unver_obstructions=0, adds_as_modification=0,
    notify_summary=<optimized out>, ctx=0xe24f173650,
    result_pool=0xe2754a6028, scratch_pool=0xe2754a6028)
    at subversion/libsvn_client/update.c:560
#36 0x000000e2df099620 in svn_client__update_internal (
    result_rev=0xfffffffffffed710, timestamp_sleep=0xfffffffffffed724,
    local_abspath=0xe2754a6160 "/home/stsp/src/apr-trunk",
    revision=<optimized out>, depth=svn_depth_exclude, depth_is_sticky=0,
    ignore_externals=0, allow_unver_obstructions=0, adds_as_modification=0,
    make_parents=<optimized out>, innerupdate=0, ra_session=0xe2ca7e6230,
    ctx=0xe24f173650, pool=0xe2754a6028)
    at subversion/libsvn_client/update.c:696
#37 0x000000e2df099884 in svn_client_update4 (result_revs=0xfffffffffffed878,
    paths=0xe2754a24f0, revision=0xfffffffffffeda58, depth=svn_depth_exclude,
    depth_is_sticky=0, ignore_externals=0, allow_unver_obstructions=0,
    adds_as_modification=0, make_parents=0, ctx=0xe24f173650,
    pool=0xe24f172028) at subversion/libsvn_client/update.c:770
#38 0x000000e041920220 in svn_cl__update (os=<optimized out>,
    baton=<optimized out>, scratch_pool=0xe24f172028)
    at subversion/svn/update-cmd.c:169
#39 0x000000e04191f26c in sub_main (pool=<optimized out>,
    argv=<optimized out>, argc=<optimized out>, exit_code=<optimized out>)
    at subversion/svn/svn.c:3459
#40 main (argc=<optimized out>, argv=0xfffffffffffedeb8)
    at subversion/svn/svn.c:3544
(gdb) p /x *pIn3
$7 = {u = {r = 0x0, i = 0x1, nZero = 0x0, zPType = 0x1, pDef = 0x1},
  flags = 0x844, enc = 0x0, eSubtype = 0x0, n = 0x0, z = 0xfffffff90000002b,
  zMalloc = 0x0, szMalloc = 0x0, uTemp = 0x9, db = 0xe31cd40008, xDel = 0x0,
  pScopyFrom = 0x0, mScopyFlags = 0x844}
(gdb) p *aMem
$8 = {u = {r = 0, i = 0, nZero = 0, zPType = 0x0, pDef = 0x0}, flags = 128,
  enc = 0 '\000', eSubtype = 0 '\000', n = 0, z = 0xe332def008 "",
  zMalloc = 0xe332def008 "", szMalloc = 600, uTemp = 0, db = 0xe31cd40008,
  xDel = 0x0, pScopyFrom = 0x0, mScopyFlags = 0}
(gdb) p *p
$9 = {db = 0xe31cd40008, pPrev = 0x0, pNext = 0xe2ca5c3408,
  pParse = 0xfffffffffffeb1f0, nVar = 23, magic = 770837923, nMem = 141,
  nCursor = 4, cacheCtr = 1, pc = 0, rc = 0, nChange = 0, iStatement = 1,
  iCurrentTime = 0, nFkConstraint = 0, nStmtDefCons = 0, nStmtDefImmCons = 0,
  aMem = 0xe27f332008, apArg = 0xe28959d990, apCsr = 0xe28959d970,
  aVar = 0xe28959d990, aOp = 0xe28959c008, nOp = 144, nOpAlloc = 256,
  aColName = 0x0, pResultSet = 0x0, zErrMsg = 0x0, pVList = 0xe2bc593008,
  startTime = 0, rcApp = 0, nWrite = 4, nResColumn = 0,
  errorAction = 2 '\002', minWriteFileFormat = 4 '\004',
  prepFlags = 128 '\200', expired = 0, explain = 0, doingRerun = 0,
  changeCntOn = 1, runOnlyOnce = 0, usesStmtJournal = 1, readOnly = 0,
  bIsReader = 1, btreeMask = 1, lockMask = 1, aCounter = {0, 0, 0, 0, 0, 0,
    2},
  zSql = 0xe2a3d0a608 "INSERT OR REPLACE INTO nodes (   wc_id, local_relpath, 
op_depth, parent_relpath, repos_id, repos_path,   revision, presence, depth, 
kind, changed_revision, changed_date,   changed_author, checksum, pr"...,
  pFree = 0xe27f332008, pFrame = 0x0, pDelFrame = 0x0, nFrame = 0,
  expmask = 0, pProgram = 0xe31eeacdc8, pAuxData = 0x0}
(gdb)

_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to