-
-
Notifications
You must be signed in to change notification settings - Fork 134
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
The driver is not thread-safe #15
Comments
Need to fix tests for AggregateException.
The driver connection is now thread-safe and can now be used in multi-threaded server processing environments like Internal Design NotesPreviously, the C# and Java driver followed the same
Next, starting with
Without the Setting a breakpoint inside the lock:
Run a query, break, then loading up the windows debugger on the process ID. Dump the heap for
The object we're intrested in is 52 bytes at address
The
Indeed, we see that the object header is a _thin-lock_. AWESOME. Thin-locks have the upper byte of the object header as
So, the managed thread ID 10 is actually thread 15 inside the operating system. Switch our thread context and double check we're inside the lock:
Indeed, we are the thread with the Sanity check by checking the syncblock table:
Nothing is indexed in the syncblock table, so we're going as fast as we can with this write-lock. 👌 While it might not always be the case that we are using _thin-lock_s because locks are handled by the CLR, we have some good empirical evidence that we're in fact using a _thin-lock_s for this workload. So, now reading responses
🚀 |
Addendum to this design note: I decided to implement Now the responsibility of removal of an awaiter from the awatier's dictionary is on the Overall, |
Just dawned on me using the driver while writing a server-side application. The
ReadResponse
isn't thread-safe. We possibly need a dedicated threadReadLoop
for reading responses from the network-stream, then dispatch / signal / handing off the response toawait
ing threads identified by their query token.The text was updated successfully, but these errors were encountered: