-
Notifications
You must be signed in to change notification settings - Fork 63
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
Precondition Failed: Inconsistency error occurred in OrderedDictionary #71
Comments
Hi @xanderdunn, first of all, I have to say that I don’t have experience with Swift on server and such multithreaded environments. Also, I haven’t tested
From what I can see in your very detailed description of the issue, it looks like it has something to do with access from multiple threads. Are you modifying the ordered dictionary
for myDataStream in Array(self.dataStreams.orderedValues) {
stopStreamsFutures.append(myDataStream.close())
}
Yes, that’s correct. As mentioned above, the question is where this is triggered. |
@lukaskubanek Thanks very much for the input. We recently switched over to We had another, unrelated situation where setting keys equal to nil and then later setting that same key to a non-nil value on |
Thanks for creating and maintaining this library, it's been very useful to me.
I recently encountered the below crashing error in OrderedDictionary while running my server:
which corresponds to this line. It appears that it's attempting to return
nil
for an existing key.My full backtrace:
MyDataHandler.swift:360 is this code in my project:
self.dataStreams
is:and
MyData
is a struct:I don't see this error on every server run. The only unusual aspect of this server run is that it hit a rare case where
MyData
keys had to be removed from the OrderedDictionary. There is a situation where I will set values tonil
for existing keys when thoseMyData
objects are no longer needed:self.dataStreams[myData] = nil
, but this is indicated as the correct way to remove key-value pairs in the example code. One possibility is that the keys that were set tonil
were later added back with a new value, but I don't think that should matter.My server is heavily multi-threaded, but I don't currently see any potential concurrency issues here. This particular call in my code is at the end of the server's life when a
stop
command has been issued to flush and close all data streams. The call is made on the main thread. Running with the thread sanitizer doesn't show any issues.Do you have any thoughts on what might be going wrong here?
The text was updated successfully, but these errors were encountered: