AssertionException

117 views
Skip to first unread message

gilles

unread,
Feb 16, 2011, 3:48:54 PM2/16/11
to mongodb-user
Hi

We're using mongodb version 1.6.3 and the C++ driver.

We've made hundreds of single datebase operations successfully. We use
GridFs to store files as well

When we try to make concurrent operations to the database we get the
following error message

Wed Feb 16 19:27:23 ********************
Wed Feb 16 19:27:23 ERROR: MessagingPort::call() wrong id got:bad96dc
expect:bad96df
Wed Feb 16 19:27:23 toSend op: 7d4 old id:0
Wed Feb 16 19:27:23 response msgid:de6fa734
Wed Feb 16 19:27:23 response len: 2e1
Wed Feb 16 19:27:23 response op: 1
Wed Feb 16 19:27:23 farEnd: 10.66.8.105:27017
Wed Feb 16 19:27:23 Assertion failure false util/message.cpp 467
Wed Feb 16 19:27:23 ********************
Wed Feb 16 19:27:23 ERROR: MessagingPort::call() wrong id got:bad96df
expect:bad96dc
Wed Feb 16 19:27:23 toSend op: 7d4 old id:0
Wed Feb 16 19:27:23 response msgid:de6fa735
Wed Feb 16 19:27:23 response len: 41
Wed Feb 16 19:27:23 response op: 1
Wed Feb 16 19:27:23 farEnd: 10.66.8.105:27017
Wed Feb 16 19:27:23 Assertion failure false util/message.cpp 467
0x7ff8893e6273 0x7ff8893e9dc1 0x7ff88941d27c 0x7ff8893edd79
0x7ff8894020dc 0x7ff8893f9669 0x7ff8893ffc7d 0x7ff8893f65d3
0x7ff8893fe43f 0x7ff8893ee4d9 0x7ff8893f16aa 0x7ff88938f618
0x7ff88939524e 0x7ff8893b3a0b 0x7ff8893ab39c 0x7ff88938d929
0x7ff88938df61 0x7ff89a6e48f0 0x7ff89a6e4e1b 0x7ff89a6e9cf2
/usr/local/freeswitch/mod/
mod_ooma_mongovm.so(_ZN5mongo12sayDbContextEPKc+0xb3) [0x7ff8893e6273]
/usr/local/freeswitch/mod/
mod_ooma_mongovm.so(_ZN5mongo8assertedEPKcS1_j+0xc1) [0x7ff8893e9dc1]
/usr/local/freeswitch/mod/
mod_ooma_mongovm.so(_ZN5mongo13MessagingPort4callERNS_7MessageES2_
+0x2dc) [0x7ff88941d27c]
/usr/local/freeswitch/mod/
mod_ooma_mongovm.so(_ZN5mongo18DBClientConnection4callERNS_7MessageES2_b
+0x19) [0x7ff8893edd79]
/usr/local/freeswitch/mod/
mod_ooma_mongovm.so(_ZN5mongo14DBClientCursor4initEv+0x11c)
[0x7ff8894020dc]
/usr/local/freeswitch/mod/
mod_ooma_mongovm.so(_ZN5mongo12DBClientBase5queryERKSsNS_5QueryEiiPKNS_7BSONObjEii
+0x5a9) [0x7ff8893f9669]
/usr/local/freeswitch/mod/
mod_ooma_mongovm.so(_ZN5mongo18DBClientConnection5queryERKSsNS_5QueryEiiPKNS_7BSONObjEii
+0x6d) [0x7ff8893ffc7d]
/usr/local/freeswitch/mod/
mod_ooma_mongovm.so(_ZN5mongo17DBClientInterface7findOneERKSsRKNS_5QueryEPKNS_7BSONObjEi
+0x83) [0x7ff8893f65d3]
/usr/local/freeswitch/mod/
mod_ooma_mongovm.so(_ZN5mongo20DBClientWithCommands10runCommandERKSsRKNS_7BSONObjERS3_i
+0x9f) [0x7ff8893fe43f]
/usr/local/freeswitch/mod/
mod_ooma_mongovm.so(_ZN5mongo20DBClientWithCommands20getLastErrorDetailedEv
+0x69) [0x7ff8893ee4d9]
/usr/local/freeswitch/mod/
mod_ooma_mongovm.so(_ZN5mongo20DBClientWithCommands12getLastErrorEv
+0x1a) [0x7ff8893f16aa]
/usr/local/freeswitch/mod/mod_ooma_mongovm.so(+0x4d618)
[0x7ff88938f618]
/usr/local/freeswitch/mod/mod_ooma_mongovm.so(+0x5324e)
[0x7ff88939524e]
/usr/local/freeswitch/mod/mod_ooma_mongovm.so(+0x71a0b)
[0x7ff8893b3a0b]
/usr/local/freeswitch/mod/mod_ooma_mongovm.so(+0x6939c)
[0x7ff8893ab39c]
/usr/local/freeswitch/mod/mod_ooma_mongovm.so(+0x4b929)
[0x7ff88938d929]
/usr/local/freeswitch/mod/mod_ooma_mongovm.so(+0x4bf61)
[0x7ff88938df61]
/usr/local/freeswitch/lib/libfreeswitch.so.1(switch_core_session_exec
+0x210) [0x7ff89a6e48f0]
/usr/local/freeswitch/lib/libfreeswitch.so.
1(switch_core_session_execute_application+0xeb) [0x7ff89a6e4e1b]
/usr/local/freeswitch/lib/libfreeswitch.so.1(switch_core_session_run
+0xea2) [0x7ff89a6e9cf2]
0x7ff8893e6273 0x7ff8893e9dc1 0x7ff88941d27c 0x7ff8893edd79
0x7ff8894020dc 0x7ff8893f9669 0x7ff8893ffc7d 0x7ff8893f65d3
0x7ff889398aa4 0x7ff88938dc0b 0x7ff89a6e48f0 0x7ff89a6e4e1b
0x7ff89a6e9cf2 0x7ff89a6e6910 0x37c1806a3a 0x37c0cddf3d
/usr/local/freeswitch/mod/
mod_ooma_mongovm.so(_ZN5mongo12sayDbContextEPKc+0xb3) [0x7ff8893e6273]
/usr/local/freeswitch/mod/
mod_ooma_mongovm.so(_ZN5mongo8assertedEPKcS1_j+0xc1) [0x7ff8893e9dc1]
/usr/local/freeswitch/mod/
mod_ooma_mongovm.so(_ZN5mongo13MessagingPort4callERNS_7MessageES2_
+0x2dc) [0x7ff88941d27c]
/usr/local/freeswitch/mod/
mod_ooma_mongovm.so(_ZN5mongo18DBClientConnection4callERNS_7MessageES2_b
+0x19) [0x7ff8893edd79]
/usr/local/freeswitch/mod/
mod_ooma_mongovm.so(_ZN5mongo14DBClientCursor4initEv+0x11c)
[0x7ff8894020dc]
/usr/local/freeswitch/mod/
mod_ooma_mongovm.so(_ZN5mongo12DBClientBase5queryERKSsNS_5QueryEiiPKNS_7BSONObjEii
+0x5a9) [0x7ff8893f9669]
/usr/local/freeswitch/mod/
mod_ooma_mongovm.so(_ZN5mongo18DBClientConnection5queryERKSsNS_5QueryEiiPKNS_7BSONObjEii
+0x6d) [0x7ff8893ffc7d]
/usr/local/freeswitch/mod/
mod_ooma_mongovm.so(_ZN5mongo17DBClientInterface7findOneERKSsRKNS_5QueryEPKNS_7BSONObjEi
+0x83) [0x7ff8893f65d3]
/usr/local/freeswitch/mod/mod_ooma_mongovm.so(userSupported+0x1b4)
[0x7ff889398aa4]
/usr/local/freeswitch/mod/mod_ooma_mongovm.so(+0x4bc0b)
[0x7ff88938dc0b]
/usr/local/freeswitch/lib/libfreeswitch.so.1(switch_core_session_exec
+0x210) [0x7ff89a6e48f0]
/usr/local/freeswitch/lib/libfreeswitch.so.
1(switch_core_session_execute_application+0xeb) [0x7ff89a6e4e1b]
/usr/local/freeswitch/lib/libfreeswitch.so.1(switch_core_session_run
+0xea2) [0x7ff89a6e9cf2]
/usr/local/freeswitch/lib/libfreeswitch.so.1(+0x5d910)
[0x7ff89a6e6910]
/lib64/libpthread.so.0() [0x37c1806a3a]
/lib64/libc.so.6(clone+0x6d) [0x37c0cddf3d]
terminate called after throwing an instance of
'mongo::AssertionException'
what(): assertion util/message.cpp:467
Aborted (core dumped)

******************************************************

There are no server logs associated with this error so the error seems
to be associated with the mongo C++ client

At this point we are running with a single MongoDB Server i.e. no
sharding or replica set or master/slave

Any ideas


sridhar

unread,
Feb 16, 2011, 4:31:45 PM2/16/11
to mongodb-user
You mention you see the error when you try to run concurrent
operations. You could see the error when using the c++ driver in a non-
thread safe manner. If you could create a small test app to reproduce
this and post the code then it would be easier to see the exact cause.
Thanks

Tony Hannan

unread,
Feb 16, 2011, 6:19:37 PM2/16/11
to mongod...@googlegroups.com, sridhar
Multiple threads cannot use the same DbClientConnection object, it is not thread safe. Create one for each thread.

--
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To post to this group, send email to mongod...@googlegroups.com.
To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.


gilles

unread,
Feb 17, 2011, 1:00:30 PM2/17/11
to mongodb-user
Thanks for making us aware that the DbClientConnection is not Thread
safe.

At this point, we are trying to avoid using multiple
DbClientConnection. I am having
some success trying to serialize all mongo operations across all
threads through the one
DbClientConnection using a lock. Is this viable? I've seen a vast
improvement but at a greater
stress level, it is still failing.

We're implementing a VoiceMail system, so conceivably there could be
hundreds of simultaneous queries and inserts to the Database.
If we did use a DbClientConnection per thread i.e. call, is there a
limit on the number of simultaneous connections to the MongoDb server?

Thanks

Gilles


On Feb 16, 6:19 pm, Tony Hannan <t...@10gen.com> wrote:
> Multiple threads cannot use the same DbClientConnection object, it is not
> thread safe. Create one for each thread.
>

Eliot Horowitz

unread,
Feb 17, 2011, 1:03:48 PM2/17/11
to mongod...@googlegroups.com, gilles
You should use
ScopedDBConnection which does thread pooling for you.
http://api.mongodb.org/cplusplus/1.7.7-pre-/classmongo_1_1_scoped_db_connection.html

gilles

unread,
Feb 25, 2011, 3:49:31 PM2/25/11
to mongodb-user
We re-worked our interfaces to use ScopedDBConnection instead of the
DbClientConnection
and we haven't seen an issue since. There is more testing that we need
to do but for the stress testing we have done so far, this particular
issue has not resurfaced

With this issue in mind, I was wondering about our Java based
interfaces where in that case we used the Java driver to connect to
MongoDb.

We share a single connection to the MongoDb Server in that case, and
similarly, we need to accomodate multiple concurrent Web requests from
users managing and making various requests to their own VoiceMail
accounts.

We haven't started any stress testing on those interfaces yet, but is
there something I should be made aware of before we do? Is there an
equivalent scheme to ScopedDBConnection that incorporates thread
pooling for the Java driver?

Thanks


On Feb 17, 1:03 pm, Eliot Horowitz <eliothorow...@gmail.com> wrote:
> You should use
> ScopedDBConnection which does thread pooling for you.http://api.mongodb.org/cplusplus/1.7.7-pre-/classmongo_1_1_scoped_db_...

gilles

unread,
Feb 25, 2011, 3:49:43 PM2/25/11
to mongodb-user
We re-worked our interfaces to use ScopedDBConnection instead of the
DbClientConnection
and we haven't seen an issue since. There is more testing that we need
to do but for the stress testing we have done so far, this particular
issue has not resurfaced

With this issue in mind, I was wondering about our Java based
interfaces where in that case we used the Java driver to connect to
MongoDb.

We share a single connection to the MongoDb Server in that case, and
similarly, we need to accomodate multiple concurrent Web requests from
users managing and making various requests to their own VoiceMail
accounts.

We haven't started any stress testing on those interfaces yet, but is
there something I should be made aware of before we do? Is there an
equivalent scheme to ScopedDBConnection that incorporates thread
pooling for the Java driver?

Thanks


On Feb 17, 1:03 pm, Eliot Horowitz <eliothorow...@gmail.com> wrote:
> You should use
> ScopedDBConnection which does thread pooling for you.http://api.mongodb.org/cplusplus/1.7.7-pre-/classmongo_1_1_scoped_db_...

gilles

unread,
Feb 25, 2011, 3:56:36 PM2/25/11
to mongodb-user
We re-worked our interfaces to use ScopedDBConnection instead of the
DbClientConnection
and we haven't seen an issue since. There is more testing that we need
to do but for the stress testing we have done so far, this particular
issue has not resurfaced

With this issue in mind, I was wondering about our Java based
interfaces where in that case we used the Java driver to connect to
MongoDb.

We share a single connection to the MongoDb Server in that case, and
similarly, we need to accomodate multiple concurrent Web requests from
users managing and making various requests to their own VoiceMail
accounts.

We haven't started any stress testing on those interfaces yet, but is
there something I should be made aware of before we do? Is there an
equivalent scheme to ScopedDBConnection that incorporates thread
pooling for the Java driver?

Thanks


On Feb 17, 1:03 pm, Eliot Horowitz <eliothorow...@gmail.com> wrote:
> You should use
> ScopedDBConnection which does thread pooling for you.http://api.mongodb.org/cplusplus/1.7.7-pre-/classmongo_1_1_scoped_db_...

sridhar

unread,
Feb 25, 2011, 5:30:52 PM2/25/11
to mongodb-user
The java driver is thread safe. Hence you can use objects such as
Database or Collection that you obtain from the driver in a
multithreaded env.
> ...
>
> read more »
Reply all
Reply to author
Forward
0 new messages