intermittent MongoWriteConcernException on update using PHP 5.5 with PHP-Mongo Client 1.6.6 and Mongo Server 2.4.10

40 views
Skip to first unread message

Ed Aspra

unread,
Aug 1, 2015, 8:33:41 AM8/1/15
to mongodb-user
Hi,

Am having an intermittent write issue on a MongoDB replicaset setup. Here's the error:

[document:MongoWriteConcernException:private] => Array
        (
            [err] => not master
            [code] => 10054
            [n] => 0
            [lastOp] => MongoTimestamp Object
                (
                    [sec] => 0
                    [inc] => 0
                )

            [connectionId] => 632889
            [ok] => 1
        )

    [host] => 192.168.1.2:27017


I've got this replicaset:

dragonfly:PRIMARY> rs.status();
{
    "set" : "myreplicaset",
    "date" : ISODate("2015-08-01T09:52:53Z"),
    "myState" : 1,
    "members" : [
        {
            "_id" : 0,
            "name" : "192.168.1.1:27017",
            "health" : 1,
            "state" : 1,
            "stateStr" : "PRIMARY",
            "uptime" : 80496,
            "optime" : Timestamp(1438422773, 1),
            "optimeDate" : ISODate("2015-08-01T09:52:53Z"),
            "self" : true
        },
        {
            "_id" : 1,
            "name" : "192.168.1.2:27017",
            "health" : 1,
            "state" : 2,
            "stateStr" : "SECONDARY",
            "uptime" : 80496,
            "optime" : Timestamp(1438422772, 5),
            "optimeDate" : ISODate("2015-08-01T09:52:52Z"),
            "lastHeartbeat" : ISODate("2015-08-01T09:52:52Z"),
            "lastHeartbeatRecv" : ISODate("2015-08-01T09:52:51Z"),
            "pingMs" : 0,
            "syncingTo" : "192.168.100.1:27017"
        },
        {
            "_id" : 2,
            "name" : "192.168.1.3:27018",
            "health" : 1,
            "state" : 7,
            "stateStr" : "ARBITER",
            "uptime" : 80496,
            "lastHeartbeat" : ISODate("2015-08-01T09:52:53Z"),
            "lastHeartbeatRecv" : ISODate("2015-08-01T09:52:51Z"),
            "pingMs" : 0
        }
    ],
    "ok" : 1
}


The issue I encounter during an update as such:

$mymongoObj->update(array( 'trans_id' => 'XXXXX',
                                            'location' => 'mylocation'),
                                           $transaction,
                                           array('upsert' => true,
                                                 'w'   => 1)
                                     );


Sometimes it works, sometimes it doesn't.


Mongo Server is v.2.4.10
PHP Mongo Driver is v.1.6.6
PHP Version is v.5.5.24


Does anyone encountered the same issue and had a fix for such?

Thanks.

Ed

Jeremy Mikola

unread,
Aug 1, 2015, 5:59:20 PM8/1/15
to mongod...@googlegroups.com
Can you reproduce this problem with the latest PHP driver (1.6.10)? The exception you're seeing means that the driver is sending writes to a node that no longer identifies as a primary; however, I would expect the server to drop connections when falling from a primary to secondary.

If this is reproducible, collecting a log of driver activity with MongoLog::setCallback() may help provide some additional insight.

--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: http://www.mongodb.org/about/support/.
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/5a234646-fbde-44bf-8d95-80bddc1f164e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages