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

Deadlock under load with large values #26

Open
jcoleman1969 opened this issue Feb 5, 2020 · 0 comments
Open

Deadlock under load with large values #26

jcoleman1969 opened this issue Feb 5, 2020 · 0 comments

Comments

@jcoleman1969
Copy link

We have tracked down an issue which caused a deadlock with RedisBoost. Our test suite runs several concurrent tests, and some of the hash items requested are in the 100k range. We found out that TryGet(out byte[] buffer) in BuffersPool.cs was returning false because MaxPoolSize had been reached. When it returns false, the calling function doesn't recover properly, and all current and future transactions fail.

We "fixed" it by eliminating the MaxPoolSize restriction (see below), but obviously this allows the buffer pools to grow unchecked. Without spending a lot more time understanding what it should do in this out of memory situation, we decided this was an acceptable trade-off. We wanted to post the issue to see if anyone knows what an actual fix would be (as well as to help others who may be seeing deadlock with large items).

		private bool TryGet(out byte[] buffer)
		{
			buffer = _pool.GetOrCreate(() =>
				{
					int iPoolSize = Interlocked.Increment(ref _poolSize);
					//if (iPoolSize > MaxPoolSize)
					//	return null;
					return new byte[BufferSize];
				}
			);
			return buffer != null;
		}
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