-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
[STREAM-KRAKEN] Exception java.util.ConcurrentModificationException: null is thrown #4943
Comments
Hello, @xgabri08
|
Hello @rizer1980, I'm sorry, but I haven't had much time lately and didn't get around to it sooner. I'll have to check all the points, but that will take some time. Today I started with point 2, which I think seems to me to be the most problematic. I made a mistake in my code and stored an orderBook (TreeSet) in the KrakenStreamingMarketDataService.getOrderBook method that came to me in the input. I then accessed it when I needed information from the orderBook. This could definitely cause problems, due to concurrent access to the object. I modified my code to make a copy of the orderBook in the KrakenStreamingMarketDataService.getOrderBook method and save that for later use. I'll try it and let you know if it helped. |
Is making copies the right thing To do? Should we not just be locking it
when we need to?
…On Sun, 15 Sept 2024, 10:11 xgabri08, ***@***.***> wrote:
Hello @rizer1980 <https://github.com/rizer1980>,
thank you for your very helpful message.
I'm sorry, but I haven't had much time lately and didn't get around to it
sooner.
I'll have to check all the points, but that will take some time.
Today I started with point 2, which I think seems to me to be the most
problematic.
I made a mistake in my code and stored an orderBook (TreeSet) in the
KrakenStreamingMarketDataService.getOrderBook method that came to me in the
input. I then accessed it when I needed information from the orderBook.
This could definitely cause problems, due to concurrent access to the
object.
I modified my code to make a copy of the orderBook in the
KrakenStreamingMarketDataService.getOrderBook method and save that for
later use.
I'll try it and let you know if it helped.
—
Reply to this email directly, view it on GitHub
<#4943 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABBUO2QGUKUI3S2W3F2A4ILZWVFKXAVCNFSM6AAAAABNOOKIFWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNJRGQ4DKMBXGA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
In general, it is incorrect. |
Humm, got the bit of code, generally we don't do this for other exchanges.
Just worried about memory blaooninglike it did on the binance orderbooks.
Douggie
…On Sun, 15 Sept 2024, 12:13 Ilya Smirnov, ***@***.***> wrote:
In general, it is incorrect.
But, for example, we need to save states of OrderBook at a certain point
in time.
Then, only a copy.
—
Reply to this email directly, view it on GitHub
<#4943 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABBUO2TBSKXRAZZ3YWH7FN3ZWVTVVAVCNFSM6AAAAABNOOKIFWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNJRGU2DENBZG4>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Hello,
I have a problem with the fact that when reading data from the Order book from Kraken, sometimes exceptions of the type java.util.ConcurrentModificationException: null appear.
Loading from the Order book runs 99% of the time and seems ok.
But sometimes the exceptions mentioned above start to appear.
Usually a large number of these exceptions come in a row within a short while. Sometimes it's just 3 exceptions, sometimes it's 400 in a row.
Sometimes after exceptions a large number of similar messages start to appear in the log:
Unknown message: [119996416,{"a":[["52686.80000","0.00000000","1725033319.029864"],["52700.90000","0.25000000","1725033315.535775","r"]],"c":"442562974"},"book-10","XBT/EUR"]
I'm not sure about this and just assume that the problem is in the CRC calculation for the OrderBook check. TreeSet is used to store bids and asks, which is not thread safe according to my information. So if there are changes to the order book and my server can't process them fast enough, the above mentioned errors may occur because probably several threads are trying to update the order book that is stored in TreeSet at the same time.
Have you encountered the same problem?
Does anyone have any advice on how to solve this problem?
If necessary, I can provide additional information.
Thank you for your answers
Exceptions occur in different places and that's why I'm posting a few stack traces, but it's probably still not all places
The text was updated successfully, but these errors were encountered: