-
Notifications
You must be signed in to change notification settings - Fork 31
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
Newtonsoft.Json.JsonReaderException thrown using GetContinuousChangesAsync #140
Comments
Hi, I think it's not related to #133 as that is about the string builder for queries not being thread-safe. This one is about what CouchDB returns. And I thought I handled that, but I'll give a look |
@ulja-dd I added some code to check for multiple "lines" in 1 line, I suppose it will be slower but it should not break. Can you test the dev branch and let me know please? |
Thank you for having a look at this issue! And sorry for my late reply. I've done two tests:
In both cases the exception hasn't been thrown anymore. About 400k changes were processed so far. At the moment I can't say much about a potential performance drag caused by the fix, since I didn't do any dedicated benchmarking before and after. At the moment changes are handled in about 10ms. Where stop creating a new context for every change was a hugh performance improvment (obviously). So I think the issue is fixed in dev branch. Thank you :) |
@ulja-dd I am glad to hear that! I'll work on more bugs then I'll release everything |
Hi,
I'm using CouchCB.NET 3.1.0 via nuget.org
The exception occurs sometimes when there is high workload. In cases where the exception is thrown the changes feed response line has two concatenated change documents.
I guess the reason is that FlurlClient is mixing data of different requests.
Following is a more detailed explanation:
I'm using a BackgroundService to process changes from particular databases using the following code (Some logging and exception handling is droped here to shorten the code):
I'm using different scopes for the context because I assumed the issue is related to this issue. In fact, the frequence of the exceptions was reduced by using dedicated scopes and creating a context for each change. However, the same exception is thrown less frequent.
With little workload (1 change per second) the BackgroundService works fine. But with high workload (~1000 changes per second) somtimes a
Newtonsoft.Json.JsonReaderException
is thrown by theGetContinuousChangesAsync
method. Heres an example stacktrace:The change document causing the exception as well as the position of the additional text differs from test to test. (Sometimes even no exception is thrown at all). Of cause the changes feed is the exact same for every test.
I did some more debuging by adding a custom output in method
CouchDB.Driver.CouchDatabase.GetContinuousChangesAsync
:A normal
line
looks like:A
line
causing the exception has json of two changes. It looks like:The text was updated successfully, but these errors were encountered: