Skip to content
This repository has been archived by the owner on Dec 24, 2022. It is now read-only.

memory management of large byte[] #79

Merged
merged 1 commit into from
Aug 21, 2012
Merged

memory management of large byte[] #79

merged 1 commit into from
Aug 21, 2012

Conversation

bculberson
Copy link
Contributor

when using the Pooled Client Manager, never releasing the buffer is really problematic. for example if we have 50 in the pool, each one will grow to the size of the buggest object sent through it and that buffer is never released. this puts a large memory footprint on long running apps, like web services/web sites, especially when having some large data objects and having a large pool of connections.

mythz added a commit that referenced this pull request Aug 21, 2012
memory management of large byte[]
@mythz mythz merged commit edc6fbd into ServiceStack:master Aug 21, 2012
@mythz
Copy link
Member

mythz commented Aug 21, 2012

Cool, well it's a lot simpler and reduces the complexity so I'm happy with it.
Also I didn't know Socket's could take ArraySegment<byte> - so thx for the tip :)

BTW Congratz :)
ServiceStack/ServiceStack@091c46e

@desunit
Copy link
Member

desunit commented Aug 21, 2012

@bculberson The latest changes have broken the following tests:

RedisBenchmarkTests.Measure_pipeline_speedup
RedisClientTests.Can_GetTypeIdsSet
RedisClientTests.Can_StoreAll_RedisClient
RedisClientTests.Can_StoreAll_RedisTypedClient

Exception is: System.Net.Sockets.SocketException : Message too long

Can you review them and adjust code to eliminate that problem?

@bculberson
Copy link
Contributor Author

I ran those tests locally and could not recreate the SocketException. Do
you know how I may be able to recreate this?

Thanks!
Brad

On Tue, Aug 21, 2012 at 12:11 AM, Sergey Bogdanov
notifications@github.comwrote:

The latest changes have broken the following tests:

RedisBenchmarkTests.Measure_pipeline_speedup
RedisClientTests.Can_GetTypeIdsSet

RedisClientTests.Can_StoreAll_RedisClient

RedisClientTests.Can_StoreAll_RedisTypedClient

Exception is: Test(s) failed. System.Net.Sockets.SocketException : Message
too long

Can you review them and adjust code to eliminate that problem?


Reply to this email directly or view it on GitHubhttps://github.com//pull/79#issuecomment-7892470.

@desunit
Copy link
Member

desunit commented Aug 21, 2012

Yes, same here. Couldn't reproduce it locally - ServiceStack* TeamCity server returned:

Test(s) failed. System.Net.Sockets.SocketException : Message too long
  at System.Net.Sockets.Socket.Send (IList`1 buffers, SocketFlags socketFlags) [0x00000] in <filename unknown>:0 
  at ServiceStack.Redis.RedisNativeClient.FlushSendBuffer () [0x00000] in <filename unknown>:0 
  at ServiceStack.Redis.RedisAllPurposePipeline.Flush () [0x00000] in <filename unknown>:0 
  at ServiceStack.Redis.Tests.RedisBenchmarkTests.Measure_pipeline_speedup () [0x00000] in <filename unknown>:0 
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] pa

@mythz
Copy link
Member

mythz commented Aug 21, 2012

Yeah those tests work for me too.

@desunit did you run your tests individually on Mono/Linux ?

@desunit
Copy link
Member

desunit commented Aug 21, 2012

@mythz yup, easy to reproduce with:

# /opt/mono-2.11.3/bin/nunit-console -fixture=ServiceStack.Redis.Tests.RedisBenchmarkTests ServiceStack.Redis.Tests.dll  

Full output:

Test Case Failures:
1) ServiceStack.Redis.Tests.RedisBenchmarkTests.Measure_pipeline_speedup : System.Net.Sockets.SocketException : Message too long
at System.Net.Sockets.Socket.Send (IList`1 buffers, SocketFlags socketFlags) [0x00018] in /home/sstack/build/mono-2.11.3/mcs/class/System/System.Net.Sockets/Socket_2_1.cs:1919
at ServiceStack.Redis.RedisNativeClient.FlushSendBuffer () [0x00000] in /usr/local/teamcity/buildAgent/work/a129dfcd8b79320d/src/ServiceStack.Redis/RedisNativeClient_Utils.cs:236
at ServiceStack.Redis.RedisAllPurposePipeline.Flush () [0x00000] in /usr/local/teamcity/buildAgent/work/a129dfcd8b79320d/src/ServiceStack.Redis/Pipeline/RedisAllPurposePipeline.cs:36
at ServiceStack.Redis.Tests.RedisBenchmarkTests.Measure_pipeline_speedup () [0x00145] in /usr/local/teamcity/buildAgent/work/a129dfcd8b79320d/tests/ServiceStack.Redis.Tests/RedisBenchmarkTests.cs:43
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x000d0] in /home/sstack/build/mono-2.11.3/mcs/class/corlib/System.Reflection/MonoMethod.cs:229

@bculberson
Copy link
Contributor Author

ill take a look at it in mono, it looks like it is specific to that
runtime... my guess is its in the usage of the other socket.Send which is
now sending in an IList<ArraySegment>. i should be able to easily
work around that.

On Tue, Aug 21, 2012 at 9:59 AM, Sergey Bogdanov
notifications@github.comwrote:

@mythz https://github.com/mythz yup, easy to reproduce with:

/opt/mono-2.11.3/bin/nunit-console -fixture=ServiceStack.Redis.Tests.RedisBenchmarkTests ServiceStack.Redis.Tests.dll

Full output:

Test Case Failures:

  1. ServiceStack.Redis.Tests.RedisBenchmarkTests.Measure_pipeline_speedup : System.Net.Sockets.SocketException : Message too long
    at System.Net.Sockets.Socket.Send (IList`1 buffers, SocketFlags socketFlags) [0x00018] in /home/sstack/build/mono-2.11.3/mcs/class/System/System.Net.Sockets/Socket_2_1.cs:1919
    at ServiceStack.Redis.RedisNativeClient.FlushSendBuffer () [0x00000] in /usr/local/teamcity/buildAgent/work/a129dfcd8b79320d/src/ServiceStack.Redis/RedisNativeClient_Utils.cs:236
    at ServiceStack.Redis.RedisAllPurposePipeline.Flush () [0x00000] in /usr/local/teamcity/buildAgent/work/a129dfcd8b79320d/src/ServiceStack.Redis/Pipeline/RedisAllPurposePipeline.cs:36
    at ServiceStack.Redis.Tests.RedisBenchmarkTests.Measure_pipeline_speedup () [0x00145] in /usr/local/teamcity/buildAgent/work/a129dfcd8b79320d/tests/ServiceStack.Redis.Tests/RedisBenchmarkTests.cs:43
    at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
    at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x000d0] in /home/sstack/build/mono-2.11.3/mcs/class/corlib/System.Reflection/MonoMethod.cs:229


Reply to this email directly or view it on GitHubhttps://github.com//pull/79#issuecomment-7905957.

@desunit
Copy link
Member

desunit commented Aug 21, 2012

Yup, it looks like we have Linux specific issue
http://stackoverflow.com/questions/4795787/socket-error90message-too-long

@bculberson
Copy link
Contributor Author

checked in a fix for it not using the socket.Send of the ArraySegments.

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

Successfully merging this pull request may close these issues.

3 participants