...
Using a tailable cursor on a capped collection leads to memory leak in the server if the first cursor MoveNext does not get a record. BsonValue lastId = collection.FindAll().SetSortOrder(SortBy.Descending("_id")).SetLimit(1).First()["_id"]; cursor = collection.Find(Query.GT("_id", lastId)) .SetFlags(QueryFlags.AwaitData | QueryFlags.TailableCursor | QueryFlags.NoCursorTimeout); using (var enumerator = new MongoCursorEnumerator(cursor)) { while (triggerThread.IsAlive) { if (enumerator.MoveNext()) { var document = enumerator.Current; if (document != null) { HandleNextData(document); } } else { if (enumerator.IsDead) { break; } if (!enumerator.IsServerAwaitCapable) { Thread.Sleep(TimeSpan.FromMilliseconds(100)); } } } } If the cursor query is changed to "GTE" cursor = collection.Find(Query.GTE("_id", lastId)) so as the first result the last record is returned all works fine.
fpf_baden commented on Mon, 4 Apr 2016 07:55:03 +0000: diagnostic.data added ramon.fernandez commented on Mon, 28 Mar 2016 17:58:34 +0000: fpf_baden, we haven't heard back from you for some time. Do you think you can upload the diagnostic.data directory as requested by Thomas above? Thanks, Ramón. thomas.schubert commented on Thu, 10 Mar 2016 06:48:43 +0000: Hi fpf_baden, MongoDB 3.2 introduced a diagnostic data collection mechanism for logging server statistics to diagnostic files at periodic intervals. Can you please attach the contents the diagnostic.data directory to this ticket? To aid our investigation, when you upload the diagnostic.data files please note when the operation causing this behavior began and ended. Thank you, Thomas fpf_baden commented on Mon, 7 Mar 2016 09:38:40 +0000: Hello Ramon, as described in my last comment i set up a server to show the problem. Now i updated to V3.2.3, the problem still exists! RDP: mongodb-21095.cloudapp.net:55449 User: mongo Pwd: mongodb-21095 I also added a screenshot. ramon.fernandez commented on Sat, 5 Mar 2016 14:40:39 +0000: Hi fpf_baden, looks like after our failed attempts to reproduce this ticket fell through the cracks – sorry about that. Are you still seeing this behavior? Have you tried a newer version (e.g.: 3.0.9 or 3.2.3) by any chance? Thanks, Ramón. fpf_baden commented on Wed, 4 Nov 2015 10:29:32 +0000: For your convienience i set up a virtual machine to show the error. New installed Windows Server 2008 R2, MongoDB V3.0.7 local TestDb with a single "events" collection with a single record... RDP: mongodb-21095.cloudapp.net:55449 User: mongo Pwd: mongodb-21095 On the desktop is a link to a TestApp ... Hope this helps.. dan@10gen.com commented on Thu, 29 Oct 2015 21:20:24 +0000: Hi Frank, We tested this code on Windows 10, which is akin to Windows Server 2016. We can't reproduce this at all with either our old driver or our new one using server 2.4, 3.0, and 3.2.0-rc1. Is there any other special considerations we should keep in mind while trying your reproduction steps? fpf_baden commented on Tue, 27 Oct 2015 14:27:27 +0000: Log with memory leak fpf_baden commented on Tue, 27 Oct 2015 14:25:42 +0000: I missed tu specify the platform: Windows Server 2008 R2 64 bit, same on Win7x64 How are you measuring "memory leaked"? no need for special tools total system memory wasted in a few minutes... (TaskManager) Can you also include your measured numbers for the leak, and server logs please? attached log. Also, I assume you are not using wired tiger as the storage engine in 3.0.2 for your tests, correct? I think not, simply updatet the database scotthernandez commented on Fri, 23 Oct 2015 13:23:26 +0000: How are you measuring "memory leaked"? Can you also include your measured numbers for the leak, and server logs please? Also, I assume you are not using wired tiger as the storage engine in 3.0.2 for your tests, correct?
Create capped collection. Insert one record - save id, Create tailable cursor with query id > saved id. tyr to get next record in a loop. Every loop ther is an amount of memory leaked in the server.