New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client Error: bad object in message for a very specific find query #449

Closed
xprt64 opened this Issue Dec 13, 2017 · 4 comments

Comments

Projects
None yet
3 participants
@xprt64

xprt64 commented Dec 13, 2017

There is a special find query that fails with the message: Client Error: bad object in message: bson length doesn't match what we found in object with unknown _id

One can change the characters but not the length of strings and obtain the same exception.
If the order of fields is swapped then the exception is not thrown anymore.

The UnitTest I used to reproduce is this:

use MongoDB\BSON\ObjectID;
use MongoDB\BSON\Regex;

class SpecialFindTest extends FunctionalTestCase
{
    /** should not throw exception */
    public function testSpecification()
    {
        $this->collection->findOne([
            '_______'                             => new ObjectID('111111111111111111111111'),
            '___________________________________' => new Regex('_______________________________________________________', 'i'),
        ]);
    }
}

Environment:
MongoDB extension version: 1.3.4
libbson bundled version: 1.8.2
libmongoc bundled version: 1.8.2
mongodb/mongodb: 1.2.0
PHP 7.1.11-0ubuntu0.17.10.1 (cli) (built: Nov 1 2017 16:30:52) ( NTS )
PHP 7.1.3 (cli) (built: Mar 21 2017 23:12:30) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.1.3, Copyright (c) 1999-2017, by Zend Technologies

@jmikola jmikola added the bug label Dec 13, 2017

@jmikola jmikola self-assigned this Dec 13, 2017

@jmikola

This comment has been minimized.

Show comment
Hide comment
@jmikola

jmikola Dec 13, 2017

Member

I've opened PHPC-1067 to track this, and added some other observations to that ticket. Feel free to follow it for progress.

Member

jmikola commented Dec 13, 2017

I've opened PHPC-1067 to track this, and added some other observations to that ticket. Feel free to follow it for progress.

@derickr

This comment has been minimized.

Show comment
Hide comment
@derickr

derickr Jan 8, 2018

Member

This ended up being a bug in libbson: https://jira.mongodb.org/browse/CDRIVER-2455

Member

derickr commented Jan 8, 2018

This ended up being a bug in libbson: https://jira.mongodb.org/browse/CDRIVER-2455

@xprt64

This comment has been minimized.

Show comment
Hide comment
@xprt64

xprt64 Jan 8, 2018

In my production environment, in 400,000 of inserts only 1 produced this error.

xprt64 commented Jan 8, 2018

In my production environment, in 400,000 of inserts only 1 produced this error.

@jmikola

This comment has been minimized.

Show comment
Hide comment
@jmikola

jmikola Mar 22, 2018

Member

PHPC-1067 (our tracking ticket for CDRIVER-2455) was released in version 1.4.0 of the extension. This can be closed.

Member

jmikola commented Mar 22, 2018

PHPC-1067 (our tracking ticket for CDRIVER-2455) was released in version 1.4.0 of the extension. This can be closed.

@jmikola jmikola closed this Mar 22, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment