mongos messages

51 views
Skip to first unread message

Oded Maimon

unread,
Feb 5, 2012, 11:46:28 AM2/5/12
to mongod...@googlegroups.com
Hi,
we are getting this messages in mongos and at the same time our application returns error that it didn't get the data it expected:
14:35:08 [conn20129] ns: prod.msgs could not initialize cursor across all shards because : stale config detected for ns: prod.msgs ClusteredCursor::_checkCursor @ shard001/db0101:19281,db0102:19281 attempt: 0
14:35:08 [conn20129] ns: prod.msgs could not initialize cursor across all shards because : stale config detected for ns: prod.msgs ClusteredCursor::_checkCursor @ shard001/db0101:19281,db0102:19281 attempt: 1
14:35:09 [conn20129] ns: prod.msgs could not initialize cursor across all shards because : stale config detected for ns: prod.msgs ClusteredCursor::_checkCursor @ shard001/db0101:19281,db0102:19281 attempt: 2
14:35:11 [conn20129] created new distributed lock for prod.msgs on db0101:19282,db0201:19282,db0102:19282 ( lock timeout : 900000, ping interval : 30000, process : 0 )


can we know what causing it? how the application should handle such issues?

Eliot Horowitz

unread,
Feb 5, 2012, 6:12:16 PM2/5/12
to mongod...@googlegroups.com
Can you send the client error?
Those are ok in mongos, just indicate meta data changed.

> --
> You received this message because you are subscribed to the Google Groups
> "mongodb-user" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/mongodb-user/-/VjYSs6eKD8EJ.
> 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.

Oded Maimon

unread,
Feb 29, 2012, 4:43:30 AM2/29/12
to mongodb-user
well, actually the error is getting a null object when we expect to
get the data itself (and we know the data is in the db)

On Feb 6, 1:12 am, Eliot Horowitz <el...@10gen.com> wrote:
> Can you send the client error?
> Those are ok in mongos, just indicate meta data changed.
>
>
>
>
>
>
>
> On Sun, Feb 5, 2012 at 11:46 AM,OdedMaimon <oded.mai...@gmail.com> wrote:
> > Hi,
> > we are getting this messages in mongos and at the same time our application
> > returns error that it didn't get the data it expected:
> > 14:35:08 [conn20129] ns: prod.msgs could not initialize cursor across all
> > shards because :staleconfigdetected for ns: prod.msgs
> > ClusteredCursor::_checkCursor @ shard001/db0101:19281,db0102:19281 attempt:
> > 0
> > 14:35:08 [conn20129] ns: prod.msgs could not initialize cursor across all
> > shards because :staleconfigdetected for ns: prod.msgs
> > ClusteredCursor::_checkCursor @ shard001/db0101:19281,db0102:19281 attempt:
> > 1
> > 14:35:09 [conn20129] ns: prod.msgs could not initialize cursor across all
> > shards because :staleconfigdetected for ns: prod.msgs

Mathias Stearn

unread,
Feb 29, 2012, 7:32:42 PM2/29/12
to mongod...@googlegroups.com
If you run the same query again do you get null or the correct object? What is the query and what is the shard key for that collection? Which version are you using?

Rajkishore Singh

unread,
Mar 1, 2012, 7:48:37 AM3/1/12
to mongodb-user
Hi Eliot,

we are also facing similar Error ...

ERROR:
URL /root/recoly/crons/send_mailer.php 1 Uncaught exception
'MongoCursorException' with message 'setShardVersion failed host:
x.x.x.x:10011 { oldVersion: Timestamp 0|0, ns: "recommendly.pages",
version: Timestamp 3000|0, globalVersion: Timestamp 2000|0, errmsg:
"client version differs from config's for collection
'recommendly.pages'", ok: 0.0 }' in /root/recoly/crons/send_mailer.php:
21 Stack trace: #0 /root/recoly/crons/send_mailer.php(21): MongoCursor-
>rewind() #1 {main} thrown in /root/recoly/crons/send_mailer.php:21

as per error which is at line no 21 in our code, we tried to find the
issue..
here some partial code with line no

LNo: 17 $pages = $pages_model->find(array('status' => 4, 'is_active'
=> 1, 'mail_time' => array('$gte'=> $min, '$lt'=> $max), 'subscribed'
=> 1));
LNo: 18 //$pages = $pages_model->find(array('status' => 4, 'id' =>
'249343554283')); // for testing
LNo: 19 $pages_count = $pages->count();
LNo: 20 if($pages_count > 0) {
LNo: 21 foreach ($pages as $page) {
LNo: 22 var_dump($page);
LNo: 23 $stats = Load::Library('mailerStats', array('page_id'
=> $page['id'], 'user_id' => $page['user_id']));
LNo: 24 $stats->dataExists($page);
LNo: 25 $stats->sendEmail($page);
LNo: 26 }
LNo: 27 }

shard key for $pages_model collection is "id" and at LNo: 17 we are
not using shard_key in find query.
so, you would you say, will this error because we are not using
shard_key in find wuery

Thanks
Raj

----------

Barrie

unread,
Mar 1, 2012, 11:18:32 AM3/1/12
to mongodb-user
Rajkishore -- I'd like to redirect conversation re: your question to
its own thread here: http://groups.google.com/group/mongodb-user/browse_thread/thread/cdba58b9694d202b
to distinguish the two issues.

Thanks!

On Mar 1, 7:48 am, Rajkishore Singh <rajkishore.si...@valuepitch.com>
wrote:

Oded Maimon

unread,
Mar 4, 2012, 3:30:56 AM3/4/12
to mongod...@googlegroups.com
Hi,
We are using version 2.0.2
the shard key is _id (NumberLong) and we are quering the users table by _id.

we didn't try to get the user again after the failure (it happens in our production java application), but we know the user exists.

Barrie

unread,
Mar 6, 2012, 3:58:49 PM3/6/12
to mongod...@googlegroups.com
Oded,

What's the query you're using?  Can you try and run it again to see if the data is returned?  I would recommend the same thing as laid out by Kristina in the post linked below:

"StaleConfigException means that the mongos you're querying has an old version of the sharding config because some of it moved to another shard and it hasn't updated its config yet.  Generally you can just catch this exception, retry the query, and it'll work.  Mongos should handle most of these, but sometimes it cannot and it'll slip through to the client (e.g., suppose it cannot reach the config servers so it cannot update its config... what should it return to the client?).  So you'll have to handle it in your application."

Hope this helps.

Barrie
Reply all
Reply to author
Forward
0 new messages