TheCloudlessSky / Harbour.RedisSessionStateStore

A Redis based SessionStateStoreProvider written in C# using ServiceStack.Redis.
MIT License
166 stars 76 forks source link

A transaction is already in use and other errors under load #25

Closed wliao008 closed 9 years ago

wliao008 commented 9 years ago

Hi! We just updated our app with v1.3 of the Harbour.RedisSessionStateStore. I tested our app manually, and everything appears to be working fine. However in our test (from jmeter, 600 threads hitting couple pages of the app in a loop), we see many errors in the log:

Also want to point out our app makes concurrent requests within a page. We're using servicestack.redis, with pool size set to 100, timeout set to 2000. Redis client connection set to timeout in 600 secs, disk persistent is turned off.

  1. Majority of the errors are "A transaction is already in use"
  2. Unexpected reply: +OK, sPort: 56516, LastCommand:
  3. A pipeline is already in use
  4. An established connection was aborted by the software in your host machine
  5. Unable to Connect: sPort: 0
  6. An existing connection was forcibly closed by the remote host

I understand some of these are probably just caused by network latency. But "A transaction is already in use" is a bit concerning, any help is appreciated.

wliao008 commented 9 years ago

A transaction is already in use, trace:

at ServiceStack.Redis.RedisAllPurposePipeline.Init() at ServiceStack.Redis.Support.Locking.DistributedLock.Lock(String key, Int32 acquisitionTimeout, Int32 lockTimeout, Int64& lockExpire, IRedisClient client) at ServiceStack.Redis.Support.Locking.DisposableDistributedLock..ctor(IRedisClient client, String globalLockKey, Int32 acquisitionTimeout, Int32 lockTimeout) at Core.SessionStore.RedisSessionStateStoreProvider.GetDistributedLock(IRedisClient client, String key) in d:\Builds\1\app\dev\src\Core\SessionStore\RedisSessionStateStoreProvider.cs:line 208 at Core.SessionStore.RedisSessionStateStoreProvider.UpdateSessionStateIfLocked(IRedisClient client, String id, Int32 lockId, Action`1 stateAction) in d:\Builds\1\app\dev\src\Core\SessionStore\RedisSessionStateStoreProvider.cs:line 416 at Core.SessionStore.RedisSessionStateStoreProvider.SetAndReleaseItemExclusive(HttpContext context, String id, SessionStateStoreData item, Object lockId, Boolean newItem) in d:\Builds\1\app\dev\src\Core\SessionStore\RedisSessionStateStoreProvider.cs:line 403 at System.Web.SessionState.SessionStateModule.OnReleaseState(Object source, EventArgs eventArgs) at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

TheCloudlessSky commented 9 years ago

Hey - This definitely sounds like a ServiceStack.Redis issue. I've pretty much abandoned this project because of a couple of reasons:

  1. ServiceStack.Redis's new licensing model is no longer truly FOSS (v4 requires a paid license to use in a commercial app).
  2. StackExchange.Redis is now my go-to Redis library for all of my projects.
  3. Microsoft released their own Redis session state provider that uses StackExchange.Redis!

Hopefully you'll be able to switch over without much pain!