You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by GitBox <gi...@apache.org> on 2020/08/05 15:33:35 UTC

[GitHub] [qpid-dispatch] ChugR commented on a change in pull request #805: Proposal for run-time lock validation

ChugR commented on a change in pull request #805:
URL: https://github.com/apache/qpid-dispatch/pull/805#discussion_r465815463



##########
File path: docs/notes/RIPs/lock-validation.adoc
##########
@@ -0,0 +1,101 @@
+////
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License
+////
+
+= Mutex Locking Validation
+
+== Summary
+
+This RIP proposes a compile-time debug mechanism to ensure that thread
+locking is well behaved.
+
+== Introduction
+
+The Qpid Dispatch Router is a multi-threaded application.  These
+threads share state and use locks to ensure the consistency of that
+state.  The locking API is defined in
+include/qpid/dispatch/threading.h
+
+In general lock nesting (e.g. taking a lock while holding another) is
+not permitted.
+
+However in a few instances locks will nest. One example of permitted lock
+nesting is the Python lock (qd_python_lock()).  This lock must be held
+while a thread is running within the Python interpreter.  Occasionally
+the Python interpreter will invoke native C functions.  These
+functions may take addional locks, such as the global logging lock
+(log_lock).

Review comment:
       Log locking is used to keep the written log in strict chronological order. gettimeofday, vsnprintf, and write_log are the items that need to be locked but the code locks only a little more than that.
   It would be bad to have the logs out of order with respect to time of day.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org