Skip to content
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

java.lang.NegativeArraySizeException in exchange-core #109

Open
shanhashcah opened this issue Nov 16, 2021 · 0 comments
Open

java.lang.NegativeArraySizeException in exchange-core #109

shanhashcah opened this issue Nov 16, 2021 · 0 comments

Comments

@shanhashcah
Copy link

I am running exchange-core in production . There are so many symbols. Offers and trades are happening in every second/minute. But sometime I get java.lang.NegativeArraySizeException for one symbol. Let's say I have symbol number from 241 to 300. After running some days exchange-core project throw java.lang.NegativeArraySizeException for 241. Then I am unable to view orderbook and placing offers for 241 symbol. Below I am sharing the lines where cause the exception.
java.lang.NegativeArraySizeException: null
at exchange.core2.core.common.L2MarketData.(L2MarketData.java:63) ~[classes/:0.0.1-SNAPSHOT]
at exchange.core2.core.orderbook.IOrderBook.getL2MarketDataSnapshot(IOrderBook.java:146) ~[classes/:0.0.1-SNAPSHOT]

After that I found below codes of L2MarketData.java in line no 63

public L2MarketData(int askSize, int bidSize) {
this.askPrices = new long[askSize];
this.bidPrices = new long[bidSize];
this.askVolumes = new long[askSize];
this.bidVolumes = new long[bidSize];
this.askOrders = new long[askSize];
this.bidOrders = new long[bidSize];
}

Below codes from IOrderBook interface in line no 146

default L2MarketData getL2MarketDataSnapshot(final int size) {
final int asksSize = getTotalAskBuckets(size);
final int bidsSize = getTotalBidBuckets(size);
final L2MarketData data = new L2MarketData(asksSize, bidsSize);
fillAsks(asksSize, data);
fillBids(bidsSize, data);
return data;
}

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant