-
Notifications
You must be signed in to change notification settings - Fork 284
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
Crashes with "invalid memory operation" when inserting into mongo collection #1707
Comments
Do you have 447MB memory available? |
@TETYYS yes, I have about 870 Mb of RAM free at the moment of crash (according to |
Unfortunately it's hard to tell the root cause for the invalid memory operation error without a call stack, but the original trigger seems to be that the MongoDB server closes the connection. The reason appears to be that you are running into a hard limit there: https://docs.mongodb.com/manual/reference/limits/#Write-Command-Operation-Limit-Size I'll try to reproduce the invalid memory operation error later when I get some time. |
The 1000 operations limit is on the server side, and it is normally hidden from the app by a driver. See this SO discussion for details http://stackoverflow.com/questions/24237887/what-is-mongodb-batch-operation-max-size |
Exactly, the client driver in vibe.d currently doesn't do any effort to hide this fact, although this would certainly be a feature worth adding. |
@s-ludwig sorry for replying so late. While splitting the array into 1000-element chunks does help, I don't think this is the cause of the crash. The minimal example above executes successfully with 100000 elements, but crashes with 1 million elements. So how come an array of 100k elements can be inserted regardless of the 1000-operation limit? |
Good question. Did you verify that all 100k elements are actually in the database after the operation? I just used the code above to reproduce this locally and these are the current findings:
|
The size limit appears to be fixed, so to some degree this could also be abstracted away by the client driver, together with the 1000 operations limit. I've opened #1719 for this topic. |
Hello,
I'm getting this error in my applicaton:
This happens when saving arrays about 1000 structs long into a mongo using
MongoCollection.insert
.No problems with shorter arrays (~100 structs).
Minimal example to reproduce this issue:
The larger struct, the shorter array you need to cause a crash.
Any ideas what this might be caused by, and how to fix it?
The text was updated successfully, but these errors were encountered: