Skip to content

BulkWrite Error working with Swoole HTTP Server #925

@MassiAtZend

Description

@MassiAtZend

The following error 'BulkWrite objects may only be executed once and this instance has already been executed' is generated on every post after the first one (the first does insert data correctly) working with Swoole HTTP server.

The setup is 'docker' based, PHP7.2-cli image, using latest version on the extension and the PHP Library. See below:


php -i


/usr/local/etc/php/conf.d/docker-php-ext-mongodb.ini,
mongodb
libbson bundled version => 1.12.0
libmongoc bundled version => 1.12.0
libmongoc SSL => enabled
libmongoc SSL library => OpenSSL
libmongoc crypto => enabled
libmongoc crypto library => libcrypto
libmongoc crypto system profile => disabled
libmongoc SASL => disabled
libmongoc ICU => disabled
libmongoc compression => enabled
libmongoc compression snappy => disabled
libmongoc compression zlib => enabled


composer.lock


{
            "name": "mongodb/mongodb",
            "version": "1.4.2",
            "source": {
                "type": "git",
                "url": "https://github.com/mongodb/mongo-php-library.git",
                "reference": "bd148eab0493e38354e45e2cd7db59b90fdcad79"
            },
            "dist": {
                "type": "zip",
                "url": "https://api.github.com/repos/mongodb/mongo-php-library/zipball/bd148eab0493e38354e45e2cd7db59b90fdcad79",
                "reference": "bd148eab0493e38354e45e2cd7db59b90fdcad79",
                "shasum": ""
            },
            "require": {
                "ext-hash": "*",
                "ext-json": "*",
                "ext-mongodb": "^1.5.0",
                "php": ">=5.5"
            },
            "require-dev": {
                "phpunit/phpunit": "^4.8.36 || ^6.4"
            },
            "type": "library",
            "extra": {
                "branch-alias": {
                    "dev-master": "1.4.x-dev"
                }
            },
            "autoload": {
                "psr-4": {
                    "MongoDB\\": "src/"
                },
                "files": [
                    "src/functions.php"
                ]
            },
            "notification-url": "https://packagist.org/downloads/",
            "license": [
                "Apache-2.0"
            ],
            "authors": [
                {
                    "name": "Jeremy Mikola",
                    "email": "jmikola@gmail.com"
                },
                {
                    "name": "Derick Rethans",
                    "email": "github@derickrethans.nl"
                },
                {
                    "name": "Katherine Walker",
                    "email": "katherine.walker@mongodb.com"
                }
            ],
            "description": "MongoDB driver library",
            "homepage": "https://jira.mongodb.org/browse/PHPLIB",
            "keywords": [
                "database",
                "driver",
                "mongodb",
                "persistence"
            ],
            "time": "2018-07-18T14:33:41+00:00"
        },

Modules


[PHP Modules]
Core
ctype
curl
date
dom
event
fileinfo
filter
ftp
hash
iconv
json
libxml
mbstring
mongodb
mysqlnd
openssl
pcre
PDO
pdo_sqlite
Phar
posix
readline
Reflection
session
SimpleXML
sockets
sodium
SPL
sqlite3
standard
swoole
tokenizer
uuid
xml
xmlreader
xmlwriter
Zend OPcache
zlib

[Zend Modules]
Zend OPcache

The project installation is done using zend-expressive + zend-expressive-swoole via composer; Swoole HTTP server is run via CLI.
Swoole compiled as follow:

    apt-get install -y --no-install-recommends \
    libhiredis0.13 libnghttp2-14 libhiredis-dev libnghttp2-dev && \
    cd /tmp && \
    git clone https://github.com/swoole/swoole-src.git swoole && \
	( \
		cd swoole \
		&& phpize \
		&& ./configure --enable-sockets --enable-async-redis --enable-openssl --enable-http2 --enable-swoole \
		&& make -j$(nproc) \
		&& make install \
	) && \
	docker-php-ext-install /tmp/swoole && \
    rm -r /tmp/swoole

The write model use is attached.
SavePdfDocument.txt

If necessary I can upload an archive of the entire project code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions