[SERVER-1529] concurrency issues with yielding Created: 01/Aug/10  Updated: 12/Jul/16  Resolved: 02/Aug/10

Status: Closed
Project: Core Server
Component/s: Concurrency
Affects Version/s: None
Fix Version/s: 1.5.8

Type: Bug Priority: Critical - P2
Reporter: Eliot Horowitz (Inactive) Assignee: Eliot Horowitz (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Participants:

 Description   

see jstests/cursora.js

this exhibits 3 different problems for me randomly:

  • Sun Aug 1 02:01:30 uncaught exception: error:
    Unknown macro: { "$err" }
  • Sun Aug 1 02:01:18 uncaught exception: error: { "$err" : "cursor dropped during query", "code" : 13338 }
  • Sun Aug 1 02:01:13 uncaught exception: [0] != [1673] are not equal : after remove


 Comments   
Comment by auto [ 02/Aug/10 ]

Author:

{'login': 'erh', 'name': 'Eliot Horowitz', 'email': 'eliot@10gen.com'}

Message: enhance test for SERVER-1529
http://github.com/mongodb/mongo/commit/cd0cd9912db7a0945a316f04e31e221be5c0d3ea

Comment by auto [ 02/Aug/10 ]

Author:

{'login': 'erh', 'name': 'Eliot Horowitz', 'email': 'eliot@10gen.com'}

Message: fix update/remove concurrency - centralize for query SERVER-1529 SERVER-1518
http://github.com/mongodb/mongo/commit/74a6d11e6b7a74293f4b70aa9e36ca0bb6c317de

Comment by Aaron Staple [ 01/Aug/10 ]

There is a similar problem with deletes in 1.4

Comment by Aaron Staple [ 01/Aug/10 ]

So at first glance I think that in addition to query, it's necessary to do checkLocation after yielding in the implementations of update and delete as well as the query ops for update and delete, and also for count. And anywhere else we might be yielding

Comment by auto [ 01/Aug/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-1529 partial fix
http://github.com/mongodb/mongo/commit/8a95b40c90ed32259a94de6434e55630552e8bd0

Comment by Eliot Horowitz (Inactive) [ 01/Aug/10 ]

1) Ok - key node makes sense.
When i see your change I'll make sure update does the same.

2) i'll work on cursor dropped

3) duh

reassign back to me when you're done with #1

Comment by Aaron Staple [ 01/Aug/10 ]

The invalid key node is caused by checkLocation() being called for the cursor before deletion, but not after deletion (deletion may change the key offset within the btree bucket, but this is only known after deletion occurs). The quick fix is to call checkLocation() again after yielding, and I've done that.

  • There are probably some more places where we should add checkLocation() as well - and they are in write operations which are more serious in terms of preventing corruption.

I get the "cursor dropped during query" message during the eval query - you know what causes that.

I think the not equal after remove problem is because the spawned shell is exiting before the remove operation completes on the server. I added a getLastError() to try and fix.

Generated at Thu Feb 08 02:57:17 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.