gridfs-stream icon indicating copy to clipboard operation
gridfs-stream copied to clipboard

Concurrency error (mongo/util/concurrency/rwlock.h:204) durinag multiple files upload

Open koblents opened this issue 8 years ago • 0 comments

Hi, I have one more issue during multiple images upload to gridfs. our meteor version is 1.5 ostrio:files version is 1.7.17 and gridfs-stream version is 1.1.1

Here is the log

I20171102-11:14:37.016(2)? { [MongoError: assertion C:\data\mci\77b70aa30ca8170c4ee9bee2ba42cf1f\src\src\mongo/util/concurrency/rwlock.h:204]
I20171102-11:14:37.016(2)?   name: 'MongoError',
I20171102-11:14:37.017(2)?   message: 'assertion C:\\data\\mci\\77b70aa30ca8170c4ee9bee2ba42cf1f\\src\\src\\mongo/util/concurrency/rwlock.h:204',
I20171102-11:14:37.017(2)?   driver: true,
I20171102-11:14:37.017(2)?   index: 0,
I20171102-11:14:37.018(2)?   code: 8,
I20171102-11:14:37.018(2)?   errmsg: 'assertion C:\\data\\mci\\77b70aa30ca8170c4ee9bee2ba42cf1f\\src\\src\\mongo/util/concurrency/rwlock.h:204' }

I also tried to use gridfs-locking-stream instead, but result was the same.

Here is the code for streaming files to mongo

 fs.createReadStream(file.versions[metadata.versionName].path).pipe(writeStream);
                            writeStream.on('close', Meteor.bindEnvironment(function (filegrid) {
                                // If we store the ObjectID itself, Meteor (EJSON?) seems to convert it to a
                                // LocalCollection.ObjectID, which GFS doesn't understand.
                                var $set = {};
                                var idString = filegrid._id.toString();

                                var extension = '.' + Mime.extension(filegrid.contentType);
                                try {
                                    $set['versions.' + metadata.versionName + '.gridFsFileId'] = idString;
                                    this.Media.collection.update(filegrid.metadata.imageId, {
                                        $set: $set
                                    });
                                    fs.unlinkSync(file.versions[filegrid.metadata.versionName].path);
                                } catch (err) {
                                    console.log(err);
                                }
                            }));
                            writeStream.on('error', function (err) {
                                console.log(err);
                            });

After a while I am starting to catch on.error event.

Maybe it will also help - time to time I am uploading the same images. Thank you!

koblents avatar Nov 02 '17 09:11 koblents