Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3356354
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:30:16+00:00 2026-05-18T02:30:16+00:00

I am trying to set up a mono asp.net 4.0 test website that uses

  • 0

I am trying to set up a mono asp.net 4.0 test website that uses memcached providers (http://memcachedproviders.codeplex.com/) using Enyim.Memcached to access memcached. The website and memcachedproviders work fine on a windows server.

I ported over the working asp.net website to mono (Ubuntu 10.10, Mono 2.8), and it runs correctly and pulls sessions from an external server running memcached, but inexplicably, every couple hours or so, the website crashes, and just returns a 500 error saying “The socket is not connected” This only happens when memcachedproviders session state is enabled.

Does anyone have any experience setting up memcachedproveders for a session in mono, or know at least where I should begin looking? While I’m familiar with linux and apache, I’m generally more comfortable with windows so there may be some configuration I’m missing.

As far as i can tell, this is the log from apache from the time the error, even with debugging enabled from mod_mono:

[Tue Nov 09 17:53:17 2010] [notice] caught SIGTERM, shutting down
[Tue Nov 09 17:53:19 2010] [notice] Apache/2.2.14 (Ubuntu) mod_mono/2.8 configured -- resuming normal operations
Listening on: /tmp/mod_mono_server_global
Root directory: /
Listening on: /tmp/mod_mono_server_global
Root directory: /
Error: There's already a server listening on /tmp/mod_mono_server_global
mod-mono-server4
mod-mono-server4
Listening on: /tmp/mod_mono_server_mysite
Root directory: /srv/www/mysite
[Tue Nov 09 17:53:58 2010] [error] (104)Connection reset by peer: read_data failed
[Tue Nov 09 17:53:58 2010] [error] Command stream corrupted, last command was -1

The general memcached configuration in web.config is something like:

<enyim.com>
    <memcached>
        <servers>
            <add address="##.##.##.##" port="11211"/>
        </servers>
        <socketPool minPoolSize="10" maxPoolSize="100" connectionTimeout="00:00:10" deadTimeout="00:02:00"/>
    </memcached>
</enyim.com>
...
<sessionState cookieless="false" regenerateExpiredSessionId="true" mode="Custom" customProvider="MemcachedSessionProvider">
    <providers>
        <add name="MemcachedSessionProvider" type="MemcachedProviders.Session.SessionStateProvider,MemcachedProviders" dbType="none" writeExceptionsToEventLog="true"/>
    </providers>
</sessionState>

And the stack trace:

System.Net.Sockets.SocketException: The socket is not connected
  at System.Net.Sockets.Socket.Shutdown (SocketShutdown how) [0x00058] in /home/monoweb/mono-2.8/mcs/class/System/System.Net.Sockets/Socket_2_1.cs:698 
  at Enyim.Caching.Memcached.PooledSocket.Dispose (Boolean disposing) [0x00000] in <filename unknown>:0 
  at Enyim.Caching.Memcached.PooledSocket.Destroy () [0x00000] in <filename unknown>:0 
  at Enyim.Caching.Memcached.MemcachedNode+InternalPoolImpl.ReleaseSocket (Enyim.Caching.Memcached.PooledSocket socket) [0x00000] in <filename unknown>:0 
  at Enyim.Caching.Memcached.PooledSocket.Dispose (Boolean disposing) [0x00000] in <filename unknown>:0 
  at Enyim.Caching.Memcached.PooledSocket.System.IDisposable.Dispose () [0x00000] in <filename unknown>:0 
  at Enyim.Caching.Memcached.ItemOperation.Dispose () [0x00000] in <filename unknown>:0 
  at Enyim.Caching.Memcached.Operation.System.IDisposable.Dispose () [0x00000] in <filename unknown>:0 
  at Enyim.Caching.MemcachedClient.Store (Enyim.Caching.Memcached.ServerPool pool, StoreCommand mode, System.String key, System.Object value, UInt64 casValue, TimeSpan validFor, DateTime expiresAt) [0x00000] in <filename unknown>:0 
  at Enyim.Caching.MemcachedClient.Store (StoreMode mode, System.String key, System.Object value, TimeSpan validFor) [0x00000] in <filename unknown>:0 
  at MemcachedProviders.Session.SessionStateProvider.SetAndReleaseItemExclusive (System.Web.HttpContext context, System.String id, System.Web.SessionState.SessionStateStoreData item, System.Object lockId, Boolean newItem) [0x00000] in <filename unknown>:0 
  at System.Web.SessionState.SessionStateModule.OnReleaseRequestState (System.Object o, System.EventArgs args) [0x0003f] in /home/monoweb/mono-2.8/mcs/class/System.Web/System.Web.SessionState_2.0/SessionStateModule.cs:292 
  at System.Web.HttpApplication+<RunHooks>c__Iterator1.MoveNext () [0x001aa] in /home/monoweb/mono-2.8/mcs/class/System.Web/System.Web/HttpApplication.cs:1026 
  at System.Web.HttpApplication+<Pipeline>c__Iterator2.MoveNext () [0x00ec9] in /home/monoweb/mono-2.8/mcs/class/System.Web/System.Web/HttpApplication.cs:1385 
  at System.Web.HttpApplication.Tick () [0x00000] in /home/monoweb/mono-2.8/mcs/class/System.Web/System.Web/HttpApplication.cs:914 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T02:30:16+00:00Added an answer on May 18, 2026 at 2:30 am

    I ended up fixing this by first downloading the source for memcachedproviders, and recompiling it to reference enyim.memcached 2.7 (the latest version). This involved some minor changes.

    After this, in mono I instead got a different error, within enyim memcached regarding string.IndexOfAny ( http://msdn.microsoft.com/en-us/library/11w09h50.aspx ) where the string being checked was null, and so was throwing an exception. If I’m reading the docs right, I think that it’s only supposed to throw an exception if the parameter is null, not if the string is. Either that or mod_mono randomly tries to access session[null], whereas asp.net does not.

    To fix this, I downloaded the enyim memcached source, and added a check that would replace a null with an empty string before the function call. memcached sessions have been up for over 24 hours so far without a hitch now.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to set a javascript date so that it can be submitted
I was trying to set a breakpoint in global.asa in an old classic ASP
I am trying set up databinding as described in the title. The problem I
Trying to set up caching on our datasets - we're using clr stored procedures
Im trying to set up a session and i am getting a header error,
I am trying to set a flag to show or hide a page element,
I'm trying to set the group type for a new Active Directory Entry via
I'm trying to set up an inheritance hierarchy similar to the following: abstract class
So we're trying to set up replicated repositories using PlasticSCM, one in the US,
I am trying to set a ViewState-variable when a button is pressed, but it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.