This forum has been archived. Please start a new discussion on GitHub.

Test failed with Berkerley DB 4.5,may be Berkerley DB BUG?

the failed test case is test/Freeze/dbmap,when testing sorting...,I got
MapI.cpp:258: Freeze::DatabaseException:
Dbc::get: Dbt not large enough for available data: DB_BUFFER_SMALL: User memory too small for return value
The error occured when call IteratorHelperI::find(const Key&), when I add
,the test is fine.

I notice that the dbKey is initialized by initializeInDbt(Key,Dbt) function,in initializeInDbt, ulen is set to 0.
according to Berkerley DB manual,the will be fine,I think this may be Berkerley DB's bug. But for the 'In Dbt' should be keep unchanged,so if we set_ulen() equal to set_size() maybe ok,too. Isn't It?


  • matthew
    matthew NL, Canada
    Note that we do not officially support BerkeleyDB 4.5 yet. However, we have been updating to the latest packages for the next release of Ice and ran into this problem ourselves. My colleague applied a fix for this issue yesterday, so I'll let him outline the fix.
  • dwayne
    dwayne St. John's, Newfoundland
    In order to get Ice to work with DB 4.5.x I changed the implementation of Freeze::IteratorHelperI::find in Freeze/MapI.cpp to use the same method as, for example, the lowerBound() method to resize the key if Berkeley throws a DB_BUFFER_SMALL database exception. IE...
                if(_dbc->get(&dbKey, &dbValue, DB_SET) == 0)
                    return true;
                    return false;
            catch(const ::DbDeadlockException& dx)
                if(_tx != 0)
                DeadlockException ex(__FILE__, __LINE__);
                ex.message = dx.what();
                throw ex;
            catch(const ::DbException& dx)
                handleDbException(dx, const_cast<Key&>(key), dbKey, __FILE__, __LINE__);
  • Thank you very much for your help!
  • Please note that dbmap::count( key ) has the same issue. There is workaround: dbmap.find( key ) != dbmap.end() which works fine