Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mdb_page_search_root Bus error #12

Open
xlisp opened this issue Jan 18, 2019 · 5 comments
Open

mdb_page_search_root Bus error #12

xlisp opened this issue Jan 18, 2019 · 5 comments

Comments

@xlisp
Copy link

xlisp commented Jan 18, 2019

GDB debug:
6c362419-6c45-4ae9-b1fb-f10c50bd52fd

If the word can be found, then it won't bus error. If the word can't be found, it will Bus error.
image

  • This is mdb_page_search_root:
 /** Finish #mdb_page_search() / #mdb_page_search_lowest().
  *   The cursor is at the root page, set up the rest of it.
  */
 static int
 mdb_page_search_root(MDB_cursor *mc, MDB_val *key, int flags)
 {
      MDB_page        *mp = mc->mc_pg[mc->mc_top];
      int rc;
      DKBUF;

      while (IS_BRANCH(mp)) {
              MDB_node        *node;
              indx_t          i;

              DPRINTF(("branch page %"Yu" has %u keys", mp->mp_pgno, NUMKEYS(mp)));
              /* Don't assert on branch pages in the FreeDB. We can get here
               * while in the process of rebalancing a FreeDB branch page; we must
               * let that proceed. ITS#8336
               */
              mdb_cassert(mc, !mc->mc_dbi || NUMKEYS(mp) > 1);
              DPRINTF(("found index 0 to page %"Yu, NODEPGNO(NODEPTR(mp, 0))));

              if (flags & (MDB_PS_FIRST|MDB_PS_LAST)) {
                      i = 0;
                      if (flags & MDB_PS_LAST) {
                              i = NUMKEYS(mp) - 1;
                              /* if already init'd, see if we're already in right place */
                              if (mc->mc_flags & C_INITIALIZED) {
                                      if (mc->mc_ki[mc->mc_top] == i) {
                                              mc->mc_top = mc->mc_snum++;
                                              mp = mc->mc_pg[mc->mc_top];
                                              goto ready;
                                      }
                              }
                      }
              } else {
                      int      exact;
                      node = mdb_node_search(mc, key, &exact);
                      if (node == NULL)
                              i = NUMKEYS(mp) - 1;
                      else {
                              i = mc->mc_ki[mc->mc_top];
                              if (!exact) {
                                      mdb_cassert(mc, i > 0);
                                      i--;
                              }
                      }
                      DPRINTF(("following index %u for key [%s]", i, DKEY(key)));
              }

              mdb_cassert(mc, i < NUMKEYS(mp));
              node = NODEPTR(mp, i);

              if ((rc = mdb_page_get(mc, NODEPGNO(node), &mp, NULL)) != 0)
                      return rc;

              mc->mc_ki[mc->mc_top] = i;
              if ((rc = mdb_cursor_push(mc, mp)))
                      return rc;

 ready:
              if (flags & MDB_PS_MODIFY) {
                      if ((rc = mdb_page_touch(mc)) != 0)
                              return rc;
                      mp = mc->mc_pg[mc->mc_top];
              }
      }

      if (!IS_LEAF(mp)) {
              DPRINTF(("internal error, index points to a %02X page!?",
                  mp->mp_flags));
              mc->mc_txn->mt_flags |= MDB_TXN_ERROR;
              return MDB_CORRUPTED;
      }

      DPRINTF(("found leaf page %"Yu" for key [%s]", mp->mp_pgno,
          key ? DKEY(key) : "null"));
      mc->mc_flags |= C_INITIALIZED;
      mc->mc_flags &= ~C_EOF;

      return MDB_SUCCESS;
 }
@DomHudson
Copy link
Contributor

Hi, thanks for the report! Are you able to provide code or steps to replicate the error please?

Many thanks,
Dom

@xlisp
Copy link
Author

xlisp commented Jan 18, 2019

@DomHudson
Code is here:
image

@DomHudson
Copy link
Contributor

Hi, please can you paste the code into github with copy and paste? Have you tried querying with this input string in other models or just this one? It would be good to know if it is a characteristic of the model or a characteristic of the input. Once you've pasted the code I will try it on a model on my side but if it doesn't raise the error then I will need something to replicate it from scratch or access to the model that you're using.

Many thanks,
Dom

@xlisp
Copy link
Author

xlisp commented Jan 20, 2019

@DomHudson What is you email? I share you by google drive. Thanks for your help 👍

@xlisp
Copy link
Author

xlisp commented Jan 24, 2019

@DomHudson Hello :-D

@ThoughtRiver ThoughtRiver deleted a comment from xlisp Jul 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants