Hi

I have some simple app, that segfaults on exit. Here is the
code(simplifid, with unrelated parts removed):

    class CMysteryDatabasePoolData : public SomeLocalSingleton {
        shared_ptr<connection_pool> _pool;
    public:
        CMysteryDatabasePoolData() {
                   this->_pool=shared_ptr<connection_pool>(new
connection_pool(poolSize));
                   for (size_t i=0; i !=poolSize; ++i) {
                     session &sql=_pool->at(i);
                     sql.open(type,dsnURL.str());
                   }
        };
        connection_pool& pool() const {return *(this->_pool) };
    };

    class CMysteryDatabaseGateway : public boost::noncopyable {
    protected:
        shared_ptr<session> sql;
    public:
        CMysteryDatabaseGateway() {
                sql=shared_ptr<session>(new
session(CMysteryDatabasePool().pool()));
        }
    };

class CMysteryTestGateway : public CMysteryDatabaseGateway {
public:
    string getTest() {
        string ret;
        *sql<<"select 'Test' from SYSIBM.SYSDUMMY1",into(ret);
        return ret;
    }
};

and finally:

int main(int,char**) {
        CMysteryTestGateway tgw;
        return !tgw.getTest().compare("Test");
}


This code will fail on clean-uo with following backtrace:
#0  0xf536c97e in sqloxltc_app () from /opt/ibm/db2/V9.7/lib32/libdb2.so
#1  0xf547d7d4 in CLI_dstRequestHLatch () from /opt/ibm/db2/V9.7/lib32/libdb2.so
#2  0xf53f0e73 in SQLDisconnect () from /opt/ibm/db2/V9.7/lib32/libdb2.so
#3  0xf6503f2f in SQLDisconnect () from /usr/lib/libodbc.so.1
#4  0xf7676992 in soci::odbc_session_backend::clean_up () from 
/usr/lib/libsoci_odbc.so
#5  0xf7676d5d in soci::odbc_session_backend::~odbc_session_backend () from 
/usr/lib/libsoci_odbc.so
#6  0xf748bde6 in soci::session::~session () from 
/usr/lib/libsoci_core-gcc-3_0-3.0.0.so
#7  0xf7485bf0 in soci::connection_pool::~connection_pool () from 
/usr/lib/libsoci_core-gcc-3_0-3.0.0.so
#8  0xf77316b8 in boost::checked_delete<soci::connection_pool> (x=0x99904c8) at 
/usr/include/boost/checked_delete.hpp:34
#9  0xf77317c4 in 
boost::detail::sp_counted_impl_p<soci::connection_pool>::dispose 
(this=0x99910b0)
    at /usr/include/boost/smart_ptr/detail/sp_counted_impl.hpp:78
#10 0x0808cb0e in boost::detail::sp_counted_base::release (this=0x99910b0) at 
/usr/include/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp:145
#11 0x0808cb46 in ~shared_count (this=0xf777f26c) at 
/usr/include/boost/smart_ptr/detail/shared_count.hpp:217
#12 0xf7730f96 in ~shared_ptr (this=0xf777f268) at 
/usr/include/boost/smart_ptr/shared_ptr.hpp:169
#13 0xf77313a3 in ~CMysteryDatabasePoolData (this=0xf777f268) at 
/home/chollya/Mystery/src/libmysterycommon/database.h:19
#14 0xf7223ab9 in exit () from /lib/i686/cmov/libc.so.6
#15 0xf720b45d in __libc_start_main () from /lib/i686/cmov/libc.so.6
#16 0x0808b9f1 in _start ()

-- 
                                                Denis Chapligin

------------------------------------------------------------------------------
Centralized Desktop Delivery: Dell and VMware Reference Architecture
Simplifying enterprise desktop deployment and management using
Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
client virtualization framework. Read more!
http://p.sf.net/sfu/dell-eql-dev2dev
_______________________________________________
Soci-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/soci-users

Reply via email to