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

Getting buffer overflow randomly in tests #59

Closed
altavir opened this issue Sep 12, 2019 · 2 comments
Closed

Getting buffer overflow randomly in tests #59

altavir opened this issue Sep 12, 2019 · 2 comments

Comments

@altavir
Copy link

altavir commented Sep 12, 2019

I am getting

java.nio.BufferOverflowException
	at java.base/java.nio.Buffer.nextPutIndex(Buffer.java:662)
	at java.base/java.nio.HeapByteBuffer.put(HeapByteBuffer.java:196)
	at kotlinx.io.core.IoBuffer.writeByte(IoBufferJVM.kt:164)
	at kotlinx.io.core.BytePacketBuilderBase.writeByte(Builder.kt:436)

in tests when I run a lot of tests simultaniously. When I run them individually, everything works fine. I tried to debug the problem, but it proved to be rather hard due to not always obvious borrowing logic. There is a check inside that should prevent this error, but is does not seem to work.

@altavir
Copy link
Author

altavir commented Oct 27, 2019

It seems that the problem is caused by the fact that IOBuffers created by ByteReadPacket(array) (which have the wrong size) are randomly being disposed into default pool and then reused. I think it should be fixed in io-2.

@fzhinkin
Copy link
Collaborator

We're rebooting the kotlinx-io development (see #131), all issues related to the previous versions will be closed. Consider reopening it if the issue remains (or the feature is still missing) in a new version.

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

2 participants