Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-84514

Enforce implicit rules around use of OperationContext on a RemoteCommandRequest

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Server Programmability
    • Service Arch 2024-02-05, Service Arch 2024-02-19, Service Arch 2024-03-04, Service Arch 2024-03-18, Service Arch 2024-04-01, Service Arch 2024-04-15

      When a RemoteCommandRequest has an OperationContext member, that member is only accessed on the thread that calls scheduleRemoteCommand/NetworkInterface::startCommand. The general historical rule (see this comment) is that the client-thread owning the OperationContext should be the one to call scheduleRemoteCommand, to ensure that the OperationContext is not destroyed before it is read off the RemoteCommandRequest.

      Generally, it is not safe to call scheduleRemoteCommand with an RCR with an OperationContext from a different thread, unless there is additional synchronization that ensures the OperationContext isn't destroyed.

      We should consider enforcing these rules in code, i.e. by insisting that the thread-local client of the thread calling scheduleRemoteCommand owns the OperationContext, etc.

            Assignee:
            Unassigned Unassigned
            Reporter:
            george.wangensteen@mongodb.com George Wangensteen
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: